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_PROCESS_SUSPEND",
30 "SIMCALL_PROCESS_JOIN",
31 "SIMCALL_PROCESS_SLEEP",
32 "SIMCALL_EXECUTION_WAIT",
33 "SIMCALL_EXECUTION_WAITANY_FOR",
34 "SIMCALL_EXECUTION_TEST",
39 "SIMCALL_COMM_WAITANY",
42 "SIMCALL_COMM_TESTANY",
44 "SIMCALL_MUTEX_TRYLOCK",
45 "SIMCALL_MUTEX_UNLOCK",
47 "SIMCALL_COND_WAIT_TIMEOUT",
48 "SIMCALL_SEM_ACQUIRE",
49 "SIMCALL_SEM_ACQUIRE_TIMEOUT",
53 "SIMCALL_RUN_BLOCKING",
57 * @brief (in kernel mode) unpack the simcall and activate the handler
59 * This function is generated from src/simix/simcalls.in
61 void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
63 XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call));
64 SIMCALL_SET_MC_VALUE(simcall, value);
65 if (context_->iwannadie)
67 switch (simcall.call) {
68 case SIMCALL_PROCESS_SUSPEND:
69 simcall_HANDLER_process_suspend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]));
72 case SIMCALL_PROCESS_JOIN:
73 simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
74 simgrid::simix::unmarshal<double>(simcall.args[1]));
77 case SIMCALL_PROCESS_SLEEP:
78 simcall_HANDLER_process_sleep(&simcall, simgrid::simix::unmarshal<double>(simcall.args[0]));
81 case SIMCALL_EXECUTION_WAIT:
82 simcall_HANDLER_execution_wait(&simcall,
83 simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
86 case SIMCALL_EXECUTION_WAITANY_FOR:
87 simcall_HANDLER_execution_waitany_for(
88 &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args[0]),
89 simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
92 case SIMCALL_EXECUTION_TEST:
93 simcall_HANDLER_execution_test(&simcall,
94 simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
97 case SIMCALL_COMM_SEND:
98 simcall_HANDLER_comm_send(
99 &simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
100 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]),
101 simgrid::simix::unmarshal<double>(simcall.args[3]),
102 simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]),
103 simgrid::simix::unmarshal<size_t>(simcall.args[5]),
104 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]),
105 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[7]),
106 simgrid::simix::unmarshal<void*>(simcall.args[8]), simgrid::simix::unmarshal<double>(simcall.args[9]));
109 case SIMCALL_COMM_ISEND:
110 simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
111 simcall.result, simcall_HANDLER_comm_isend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
112 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
113 simgrid::simix::unmarshal<double>(simcall.args[2]),
114 simgrid::simix::unmarshal<double>(simcall.args[3]),
115 simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]),
116 simgrid::simix::unmarshal<size_t>(simcall.args[5]),
117 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]),
118 simgrid::simix::unmarshal<simix_clean_func_t>(simcall.args[7]),
119 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[8]),
120 simgrid::simix::unmarshal<void*>(simcall.args[9]),
121 simgrid::simix::unmarshal<bool>(simcall.args[10])));
122 SIMIX_simcall_answer(&simcall);
125 case SIMCALL_COMM_RECV:
126 simcall_HANDLER_comm_recv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
127 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
128 simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]),
129 simgrid::simix::unmarshal<size_t*>(simcall.args[3]),
130 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]),
131 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]),
132 simgrid::simix::unmarshal<void*>(simcall.args[6]),
133 simgrid::simix::unmarshal<double>(simcall.args[7]),
134 simgrid::simix::unmarshal<double>(simcall.args[8]));
137 case SIMCALL_COMM_IRECV:
138 simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
139 simcall.result, simcall_HANDLER_comm_irecv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
140 simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
141 simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]),
142 simgrid::simix::unmarshal<size_t*>(simcall.args[3]),
143 simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]),
144 simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]),
145 simgrid::simix::unmarshal<void*>(simcall.args[6]),
146 simgrid::simix::unmarshal<double>(simcall.args[7])));
147 SIMIX_simcall_answer(&simcall);
150 case SIMCALL_COMM_WAITANY:
151 simcall_HANDLER_comm_waitany(
152 &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]),
153 simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
156 case SIMCALL_COMM_WAIT:
157 simcall_HANDLER_comm_wait(&simcall,
158 simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]),
159 simgrid::simix::unmarshal<double>(simcall.args[1]));
162 case SIMCALL_COMM_TEST:
163 simcall_HANDLER_comm_test(&simcall,
164 simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]));
167 case SIMCALL_COMM_TESTANY:
168 simcall_HANDLER_comm_testany(&simcall,
169 simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]),
170 simgrid::simix::unmarshal<size_t>(simcall.args[1]));
173 case SIMCALL_MUTEX_LOCK:
174 simcall_HANDLER_mutex_lock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
177 case SIMCALL_MUTEX_TRYLOCK:
178 simgrid::simix::marshal<int>(
180 simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0])));
181 SIMIX_simcall_answer(&simcall);
184 case SIMCALL_MUTEX_UNLOCK:
185 simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
186 SIMIX_simcall_answer(&simcall);
189 case SIMCALL_COND_WAIT:
190 simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]),
191 simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]));
194 case SIMCALL_COND_WAIT_TIMEOUT:
195 simcall_HANDLER_cond_wait_timeout(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]),
196 simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]),
197 simgrid::simix::unmarshal<double>(simcall.args[2]));
200 case SIMCALL_SEM_ACQUIRE:
201 simcall_HANDLER_sem_acquire(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]));
204 case SIMCALL_SEM_ACQUIRE_TIMEOUT:
205 simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]),
206 simgrid::simix::unmarshal<double>(simcall.args[1]));
209 case SIMCALL_IO_WAIT:
210 simcall_HANDLER_io_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::IoImpl*>(simcall.args[0]));
213 case SIMCALL_MC_RANDOM:
214 simgrid::simix::marshal<int>(simcall.result,
215 simcall_HANDLER_mc_random(&simcall, simgrid::simix::unmarshal<int>(simcall.args[0]),
216 simgrid::simix::unmarshal<int>(simcall.args[1])));
217 SIMIX_simcall_answer(&simcall);
220 case SIMCALL_RUN_KERNEL:
221 SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
222 SIMIX_simcall_answer(&simcall);
225 case SIMCALL_RUN_BLOCKING:
226 SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
232 throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s", get_cname(),
233 sg_host_get_name(get_host())));