1 /**********************************************************************/
2 /* File generated by src/simix/simcalls.py from src/simix/simcalls.in */
4 /* DO NOT EVER CHANGE THIS FILE */
6 /* change simcalls specification in src/simix/simcalls.in */
7 /* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved. */
8 /**********************************************************************/
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.
14 * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
17 #include "smx_private.hpp"
20 #include "src/mc/mc_forward.hpp"
22 #include "src/kernel/activity/ConditionVariableImpl.hpp"
24 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
26 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
27 const char* simcall_names[] = {
29 "SIMCALL_EXECUTION_WAIT",
30 "SIMCALL_EXECUTION_WAITANY_FOR",
31 "SIMCALL_EXECUTION_TEST",
36 "SIMCALL_COMM_WAITANY",
39 "SIMCALL_COMM_TESTANY",
41 "SIMCALL_MUTEX_TRYLOCK",
42 "SIMCALL_MUTEX_UNLOCK",
44 "SIMCALL_COND_WAIT_TIMEOUT",
45 "SIMCALL_SEM_ACQUIRE",
46 "SIMCALL_SEM_ACQUIRE_TIMEOUT",
50 "SIMCALL_RUN_BLOCKING",
54 * @brief (in kernel mode) unpack the simcall and activate the handler
56 * This function is generated from src/simix/simcalls.in
58 void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) {
59 XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call_));
60 SIMCALL_SET_MC_VALUE(simcall, value);
61 if (context_->iwannadie)
63 switch (simcall.call_) {
64 case SIMCALL_EXECUTION_WAIT:
65 simcall_HANDLER_execution_wait(&simcall,
66 simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args_[0]));
69 case SIMCALL_EXECUTION_WAITANY_FOR:
70 simcall_HANDLER_execution_waitany_for(
71 &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args_[0]),
72 simgrid::simix::unmarshal<size_t>(simcall.args_[1]), simgrid::simix::unmarshal<double>(simcall.args_[2]));
75 case SIMCALL_EXECUTION_TEST:
76 simcall_HANDLER_execution_test(&simcall,
77 simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args_[0]));
80 case SIMCALL_COMM_SEND:
81 simcall_HANDLER_comm_send(
82 &simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args_[0]),
83 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args_[1]),
84 simgrid::simix::unmarshal<double>(simcall.args_[2]), simgrid::simix::unmarshal<double>(simcall.args_[3]),
85 simgrid::simix::unmarshal<unsigned char*>(simcall.args_[4]),
86 simgrid::simix::unmarshal<size_t>(simcall.args_[5]),
87 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args_[6]),
88 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args_[7]),
89 simgrid::simix::unmarshal<void*>(simcall.args_[8]), simgrid::simix::unmarshal<double>(simcall.args_[9]));
92 case SIMCALL_COMM_ISEND:
93 simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
95 simcall_HANDLER_comm_isend(
96 &simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args_[0]),
97 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args_[1]),
98 simgrid::simix::unmarshal<double>(simcall.args_[2]), simgrid::simix::unmarshal<double>(simcall.args_[3]),
99 simgrid::simix::unmarshal<unsigned char*>(simcall.args_[4]),
100 simgrid::simix::unmarshal<size_t>(simcall.args_[5]),
101 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args_[6]),
102 simgrid::simix::unmarshal<simix_clean_func_t>(simcall.args_[7]),
103 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args_[8]),
104 simgrid::simix::unmarshal<void*>(simcall.args_[9]), simgrid::simix::unmarshal<bool>(simcall.args_[10])));
108 case SIMCALL_COMM_RECV:
109 simcall_HANDLER_comm_recv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args_[0]),
110 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args_[1]),
111 simgrid::simix::unmarshal<unsigned char*>(simcall.args_[2]),
112 simgrid::simix::unmarshal<size_t*>(simcall.args_[3]),
113 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args_[4]),
114 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args_[5]),
115 simgrid::simix::unmarshal<void*>(simcall.args_[6]),
116 simgrid::simix::unmarshal<double>(simcall.args_[7]),
117 simgrid::simix::unmarshal<double>(simcall.args_[8]));
120 case SIMCALL_COMM_IRECV:
121 simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
123 simcall_HANDLER_comm_irecv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args_[0]),
124 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args_[1]),
125 simgrid::simix::unmarshal<unsigned char*>(simcall.args_[2]),
126 simgrid::simix::unmarshal<size_t*>(simcall.args_[3]),
127 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args_[4]),
128 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args_[5]),
129 simgrid::simix::unmarshal<void*>(simcall.args_[6]),
130 simgrid::simix::unmarshal<double>(simcall.args_[7])));
134 case SIMCALL_COMM_WAITANY:
135 simcall_HANDLER_comm_waitany(
136 &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args_[0]),
137 simgrid::simix::unmarshal<size_t>(simcall.args_[1]), simgrid::simix::unmarshal<double>(simcall.args_[2]));
140 case SIMCALL_COMM_WAIT:
141 simcall_HANDLER_comm_wait(&simcall,
142 simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args_[0]),
143 simgrid::simix::unmarshal<double>(simcall.args_[1]));
146 case SIMCALL_COMM_TEST:
147 simcall_HANDLER_comm_test(&simcall,
148 simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args_[0]));
151 case SIMCALL_COMM_TESTANY:
152 simcall_HANDLER_comm_testany(&simcall,
153 simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args_[0]),
154 simgrid::simix::unmarshal<size_t>(simcall.args_[1]));
157 case SIMCALL_MUTEX_LOCK:
158 simcall_HANDLER_mutex_lock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0]));
161 case SIMCALL_MUTEX_TRYLOCK:
162 simgrid::simix::marshal<int>(
164 simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0])));
168 case SIMCALL_MUTEX_UNLOCK:
169 simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0]));
173 case SIMCALL_COND_WAIT:
174 simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args_[0]),
175 simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[1]));
178 case SIMCALL_COND_WAIT_TIMEOUT:
179 simcall_HANDLER_cond_wait_timeout(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args_[0]),
180 simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[1]),
181 simgrid::simix::unmarshal<double>(simcall.args_[2]));
184 case SIMCALL_SEM_ACQUIRE:
185 simcall_HANDLER_sem_acquire(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args_[0]));
188 case SIMCALL_SEM_ACQUIRE_TIMEOUT:
189 simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args_[0]),
190 simgrid::simix::unmarshal<double>(simcall.args_[1]));
193 case SIMCALL_IO_WAIT:
194 simcall_HANDLER_io_wait(&simcall,
195 simgrid::simix::unmarshal<simgrid::kernel::activity::IoImpl*>(simcall.args_[0]));
198 case SIMCALL_MC_RANDOM:
199 simgrid::simix::marshal<int>(simcall.result_,
200 simcall_HANDLER_mc_random(&simcall, simgrid::simix::unmarshal<int>(simcall.args_[0]),
201 simgrid::simix::unmarshal<int>(simcall.args_[1])));
205 case SIMCALL_RUN_KERNEL:
206 SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args_[0]));
210 case SIMCALL_RUN_BLOCKING:
211 SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args_[0]));
217 throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
219 sg_host_get_name(get_host())));