Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines for 2022.
[simgrid.git] / src / simix / popping_generated.cpp
1 /**********************************************************************/
2 /* File generated by src/simix/simcalls.py from src/simix/simcalls.in */
3 /*                                                                    */
4 /*                    DO NOT EVER CHANGE THIS FILE                    */
5 /*                                                                    */
6 /* change simcalls specification in src/simix/simcalls.in             */
7 /* Copyright (c) 2014-2022. The SimGrid Team. All rights reserved.    */
8 /**********************************************************************/
9
10 /*
11  * Note that the name comes from http://en.wikipedia.org/wiki/Popping
12  * Indeed, the control flow is doing a strange dance in there.
13  *
14  * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
15  */
16
17 #include <simgrid/config.h>
18 #include <simgrid/host.h>
19 #include <xbt/base.h>
20 #if SIMGRID_HAVE_MC
21 #include "src/mc/mc_forward.hpp"
22 #endif
23 #include "src/kernel/activity/ConditionVariableImpl.hpp"
24 #include "src/kernel/actor/SimcallObserver.hpp"
25 #include "src/kernel/context/Context.hpp"
26
27 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
28
29 using simgrid::simix::Simcall;
30 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
31 constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
32     "Simcall::NONE",
33     "Simcall::COMM_RECV",
34     "Simcall::COMM_IRECV",
35     "Simcall::COMM_SEND",
36     "Simcall::COMM_ISEND",
37     "Simcall::COMM_TEST",
38     "Simcall::COMM_TESTANY",
39     "Simcall::COMM_WAITANY",
40     "Simcall::COMM_WAIT",
41     "Simcall::RUN_KERNEL",
42     "Simcall::RUN_BLOCKING",
43 }};
44
45 /** @private
46  * @brief (in kernel mode) unpack the simcall and activate the handler
47  *
48  * This function is generated from src/simix/simcalls.in
49  */
50 void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)
51 {
52   XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_));
53   simcall_.mc_value_ = times_considered;
54   if (simcall_.observer_ != nullptr)
55     simcall_.observer_->prepare(times_considered);
56   if (context_->wannadie())
57     return;
58   switch (simcall_.call_) {
59     case Simcall::COMM_RECV:
60       simcall_HANDLER_comm_recv(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[2]), simgrid::simix::unmarshal<size_t*>(simcall_.args_[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[5]), simgrid::simix::unmarshal<void*>(simcall_.args_[6]), simgrid::simix::unmarshal<double>(simcall_.args_[7]), simgrid::simix::unmarshal<double>(simcall_.args_[8]));
61       break;
62
63     case Simcall::COMM_IRECV:
64       simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall_.result_, simcall_HANDLER_comm_irecv(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[2]), simgrid::simix::unmarshal<size_t*>(simcall_.args_[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[5]), simgrid::simix::unmarshal<void*>(simcall_.args_[6]), simgrid::simix::unmarshal<double>(simcall_.args_[7])));
65       simcall_answer();
66       break;
67
68     case Simcall::COMM_SEND:
69       simcall_HANDLER_comm_send(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]), simgrid::simix::unmarshal<double>(simcall_.args_[3]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[4]), simgrid::simix::unmarshal<size_t>(simcall_.args_[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[6]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[7]), simgrid::simix::unmarshal<void*>(simcall_.args_[8]), simgrid::simix::unmarshal<double>(simcall_.args_[9]));
70       break;
71
72     case Simcall::COMM_ISEND:
73       simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall_.result_, simcall_HANDLER_comm_isend(&simcall_, simgrid::simix::unmarshal<smx_actor_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]), simgrid::simix::unmarshal<double>(simcall_.args_[3]), simgrid::simix::unmarshal<unsigned char*>(simcall_.args_[4]), simgrid::simix::unmarshal<size_t>(simcall_.args_[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall_.args_[6]), simgrid::simix::unmarshal<simix_clean_func_t>(simcall_.args_[7]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall_.args_[8]), simgrid::simix::unmarshal<void*>(simcall_.args_[9]), simgrid::simix::unmarshal<bool>(simcall_.args_[10])));
74       simcall_answer();
75       break;
76
77     case Simcall::COMM_TEST:
78       simgrid::simix::marshal<bool>(simcall_.result_, simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0])));
79       simcall_answer();
80       break;
81
82     case Simcall::COMM_TESTANY:
83       simgrid::simix::marshal<ssize_t>(simcall_.result_, simcall_HANDLER_comm_testany(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall_.args_[0]), simgrid::simix::unmarshal<size_t>(simcall_.args_[1])));
84       simcall_answer();
85       break;
86
87     case Simcall::COMM_WAITANY:
88       simcall_HANDLER_comm_waitany(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall_.args_[0]), simgrid::simix::unmarshal<size_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]));
89       break;
90
91     case Simcall::COMM_WAIT:
92       simcall_HANDLER_comm_wait(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
93       break;
94
95     case Simcall::RUN_KERNEL:
96       SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
97       simcall_answer();
98       break;
99
100     case Simcall::RUN_BLOCKING:
101       SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
102       break;
103
104     case Simcall::NONE:
105       throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
106                                                               get_cname(),
107                                                               sg_host_get_name(get_host())));
108     default:
109       THROW_IMPOSSIBLE;
110   }
111 }