Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
0de896d6bf2672b29e305487fa64added5fa4181
[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-2017. 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 <xbt/base.h>
18 #include "smx_private.h"
19 #if SIMGRID_HAVE_MC
20 #include "src/mc/mc_forward.hpp"
21 #endif
22
23 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
24
25 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
26 const char* simcall_names[] = {
27     "SIMCALL_NONE",
28     "SIMCALL_PROCESS_KILL",
29     "SIMCALL_PROCESS_KILLALL",
30     "SIMCALL_PROCESS_CLEANUP",
31     "SIMCALL_PROCESS_SUSPEND",
32     "SIMCALL_PROCESS_JOIN",
33     "SIMCALL_PROCESS_SLEEP",
34     "SIMCALL_EXECUTION_START",
35     "SIMCALL_EXECUTION_PARALLEL_START",
36     "SIMCALL_EXECUTION_CANCEL",
37     "SIMCALL_EXECUTION_SET_PRIORITY",
38     "SIMCALL_EXECUTION_SET_BOUND",
39     "SIMCALL_EXECUTION_WAIT",
40     "SIMCALL_PROCESS_ON_EXIT",
41     "SIMCALL_PROCESS_AUTO_RESTART_SET",
42     "SIMCALL_PROCESS_RESTART",
43     "SIMCALL_COMM_IPROBE",
44     "SIMCALL_COMM_SEND",
45     "SIMCALL_COMM_ISEND",
46     "SIMCALL_COMM_RECV",
47     "SIMCALL_COMM_IRECV",
48     "SIMCALL_COMM_WAITANY",
49     "SIMCALL_COMM_WAIT",
50     "SIMCALL_COMM_TEST",
51     "SIMCALL_COMM_TESTANY",
52     "SIMCALL_MUTEX_INIT",
53     "SIMCALL_MUTEX_LOCK",
54     "SIMCALL_MUTEX_TRYLOCK",
55     "SIMCALL_MUTEX_UNLOCK",
56     "SIMCALL_COND_INIT",
57     "SIMCALL_COND_SIGNAL",
58     "SIMCALL_COND_WAIT",
59     "SIMCALL_COND_WAIT_TIMEOUT",
60     "SIMCALL_COND_BROADCAST",
61     "SIMCALL_SEM_INIT",
62     "SIMCALL_SEM_RELEASE",
63     "SIMCALL_SEM_WOULD_BLOCK",
64     "SIMCALL_SEM_ACQUIRE",
65     "SIMCALL_SEM_ACQUIRE_TIMEOUT",
66     "SIMCALL_SEM_GET_CAPACITY",
67     "SIMCALL_FILE_READ",
68     "SIMCALL_FILE_WRITE",
69     "SIMCALL_MC_RANDOM",
70     "SIMCALL_SET_CATEGORY",
71     "SIMCALL_RUN_KERNEL",
72     "SIMCALL_RUN_BLOCKING",
73 };
74
75 /** @private
76  * @brief (in kernel mode) unpack the simcall and activate the handler
77  *
78  * This function is generated from src/simix/simcalls.in
79  */
80 void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
81   XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
82   SIMCALL_SET_MC_VALUE(simcall, value);
83   if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
84     return;
85   switch (simcall->call) {
86 case SIMCALL_PROCESS_KILL:
87       simcall_HANDLER_process_kill(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
88       SIMIX_simcall_answer(simcall);
89       break;
90
91 case SIMCALL_PROCESS_KILLALL:
92       simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]));
93       SIMIX_simcall_answer(simcall);
94       break;
95
96 case SIMCALL_PROCESS_CLEANUP:
97       SIMIX_process_cleanup(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
98       SIMIX_simcall_answer(simcall);
99       break;
100
101 case SIMCALL_PROCESS_SUSPEND:
102       simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
103       break;
104
105 case SIMCALL_PROCESS_JOIN:
106       simcall_HANDLER_process_join(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
107       break;
108
109 case SIMCALL_PROCESS_SLEEP:
110       simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal<double>(simcall->args[0]));
111       break;
112
113 case SIMCALL_EXECUTION_START:
114   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(
115       simcall->result,
116       simcall_HANDLER_execution_start(simcall, simgrid::simix::unmarshal<const char*>(simcall->args[0]),
117                                       simgrid::simix::unmarshal<double>(simcall->args[1]),
118                                       simgrid::simix::unmarshal<double>(simcall->args[2]),
119                                       simgrid::simix::unmarshal<double>(simcall->args[3])));
120   SIMIX_simcall_answer(simcall);
121   break;
122
123 case SIMCALL_EXECUTION_PARALLEL_START:
124   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(
125       simcall->result,
126       SIMIX_execution_parallel_start(
127           simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]),
128           simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]), simgrid::simix::unmarshal<double*>(simcall->args[3]),
129           simgrid::simix::unmarshal<double*>(simcall->args[4]), simgrid::simix::unmarshal<double>(simcall->args[5]),
130           simgrid::simix::unmarshal<double>(simcall->args[6]), simgrid::simix::unmarshal<double>(simcall->args[7])));
131   SIMIX_simcall_answer(simcall);
132   break;
133
134 case SIMCALL_EXECUTION_CANCEL:
135   SIMIX_execution_cancel(
136       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
137   SIMIX_simcall_answer(simcall);
138   break;
139
140 case SIMCALL_EXECUTION_SET_PRIORITY:
141   SIMIX_execution_set_priority(
142       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]),
143       simgrid::simix::unmarshal<double>(simcall->args[1]));
144   SIMIX_simcall_answer(simcall);
145   break;
146
147 case SIMCALL_EXECUTION_SET_BOUND:
148   SIMIX_execution_set_bound(
149       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]),
150       simgrid::simix::unmarshal<double>(simcall->args[1]));
151   SIMIX_simcall_answer(simcall);
152   break;
153
154 case SIMCALL_EXECUTION_WAIT:
155   simcall_HANDLER_execution_wait(
156       simcall,
157       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
158   break;
159
160 case SIMCALL_PROCESS_ON_EXIT:
161       SIMIX_process_on_exit(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<int_f_pvoid_pvoid_t>(simcall->args[1]), simgrid::simix::unmarshal<void*>(simcall->args[2]));
162       SIMIX_simcall_answer(simcall);
163       break;
164
165 case SIMCALL_PROCESS_AUTO_RESTART_SET:
166       SIMIX_process_auto_restart_set(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]));
167       SIMIX_simcall_answer(simcall);
168       break;
169
170 case SIMCALL_PROCESS_RESTART:
171       simgrid::simix::marshal<smx_actor_t>(simcall->result, simcall_HANDLER_process_restart(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0])));
172       SIMIX_simcall_answer(simcall);
173       break;
174
175 case SIMCALL_COMM_IPROBE:
176   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
177       simcall->result, simcall_HANDLER_comm_iprobe(simcall, simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]),
178                                                    simgrid::simix::unmarshal<int>(simcall->args[1]),
179                                                    simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[2]),
180                                                    simgrid::simix::unmarshal<void*>(simcall->args[3])));
181   SIMIX_simcall_answer(simcall);
182   break;
183
184 case SIMCALL_COMM_SEND:
185       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<void*>(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]));
186       break;
187
188 case SIMCALL_COMM_ISEND:
189   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
190       simcall->result,
191       simcall_HANDLER_comm_isend(
192           simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]),
193           simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]),
194           simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3]),
195           simgrid::simix::unmarshal<void*>(simcall->args[4]), simgrid::simix::unmarshal<size_t>(simcall->args[5]),
196           simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]),
197           simgrid::simix::unmarshal<simix_clean_func_t>(simcall->args[7]),
198           simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[8]),
199           simgrid::simix::unmarshal<void*>(simcall->args[9]), simgrid::simix::unmarshal<int>(simcall->args[10])));
200   SIMIX_simcall_answer(simcall);
201   break;
202
203 case SIMCALL_COMM_RECV:
204       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<void*>(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]));
205       break;
206
207 case SIMCALL_COMM_IRECV:
208   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
209       simcall->result, simcall_HANDLER_comm_irecv(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]),
210                                                   simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]),
211                                                   simgrid::simix::unmarshal<void*>(simcall->args[2]),
212                                                   simgrid::simix::unmarshal<size_t*>(simcall->args[3]),
213                                                   simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[4]),
214                                                   simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[5]),
215                                                   simgrid::simix::unmarshal<void*>(simcall->args[6]),
216                                                   simgrid::simix::unmarshal<double>(simcall->args[7])));
217   SIMIX_simcall_answer(simcall);
218   break;
219
220 case SIMCALL_COMM_WAITANY:
221       simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal<xbt_dynar_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
222       break;
223
224 case SIMCALL_COMM_WAIT:
225   simcall_HANDLER_comm_wait(
226       simcall,
227       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]),
228       simgrid::simix::unmarshal<double>(simcall->args[1]));
229   break;
230
231 case SIMCALL_COMM_TEST:
232   simcall_HANDLER_comm_test(
233       simcall,
234       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
235   break;
236
237 case SIMCALL_COMM_TESTANY:
238   simcall_HANDLER_comm_testany(
239       simcall,
240       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>*>(simcall->args[0]),
241       simgrid::simix::unmarshal<size_t>(simcall->args[1]));
242   break;
243
244 case SIMCALL_MUTEX_INIT:
245       simgrid::simix::marshal<smx_mutex_t>(simcall->result, simcall_HANDLER_mutex_init(simcall));
246       SIMIX_simcall_answer(simcall);
247       break;
248
249 case SIMCALL_MUTEX_LOCK:
250       simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
251       break;
252
253 case SIMCALL_MUTEX_TRYLOCK:
254       simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mutex_trylock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0])));
255       SIMIX_simcall_answer(simcall);
256       break;
257
258 case SIMCALL_MUTEX_UNLOCK:
259       simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
260       SIMIX_simcall_answer(simcall);
261       break;
262
263 case SIMCALL_COND_INIT:
264       simgrid::simix::marshal<smx_cond_t>(simcall->result, SIMIX_cond_init());
265       SIMIX_simcall_answer(simcall);
266       break;
267
268 case SIMCALL_COND_SIGNAL:
269       SIMIX_cond_signal(simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]));
270       SIMIX_simcall_answer(simcall);
271       break;
272
273 case SIMCALL_COND_WAIT:
274       simcall_HANDLER_cond_wait(simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]));
275       break;
276
277 case SIMCALL_COND_WAIT_TIMEOUT:
278       simcall_HANDLER_cond_wait_timeout(simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]));
279       break;
280
281 case SIMCALL_COND_BROADCAST:
282       SIMIX_cond_broadcast(simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]));
283       SIMIX_simcall_answer(simcall);
284       break;
285
286 case SIMCALL_SEM_INIT:
287       simgrid::simix::marshal<smx_sem_t>(simcall->result, SIMIX_sem_init(simgrid::simix::unmarshal<unsigned int>(simcall->args[0])));
288       SIMIX_simcall_answer(simcall);
289       break;
290
291 case SIMCALL_SEM_RELEASE:
292       simcall_HANDLER_sem_release(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
293       SIMIX_simcall_answer(simcall);
294       break;
295
296 case SIMCALL_SEM_WOULD_BLOCK:
297       simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_sem_would_block(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0])));
298       SIMIX_simcall_answer(simcall);
299       break;
300
301 case SIMCALL_SEM_ACQUIRE:
302       simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
303       break;
304
305 case SIMCALL_SEM_ACQUIRE_TIMEOUT:
306       simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
307       break;
308
309 case SIMCALL_SEM_GET_CAPACITY:
310       simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_sem_get_capacity(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0])));
311       SIMIX_simcall_answer(simcall);
312       break;
313
314 case SIMCALL_FILE_READ:
315   simcall_HANDLER_file_read(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
316                             simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
317   break;
318
319 case SIMCALL_FILE_WRITE:
320   simcall_HANDLER_file_write(simcall, simgrid::simix::unmarshal<surf_file_t>(simcall->args[0]),
321                              simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
322   break;
323
324 case SIMCALL_MC_RANDOM:
325       simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1])));
326       SIMIX_simcall_answer(simcall);
327       break;
328
329 case SIMCALL_SET_CATEGORY:
330   SIMIX_set_category(
331       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]),
332       simgrid::simix::unmarshal<const char*>(simcall->args[1]));
333   SIMIX_simcall_answer(simcall);
334   break;
335
336 case SIMCALL_RUN_KERNEL:
337       SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
338       SIMIX_simcall_answer(simcall);
339       break;
340
341 case SIMCALL_RUN_BLOCKING:
342       SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
343       break;
344     case NUM_SIMCALLS:
345       break;
346     case SIMCALL_NONE:
347       THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
348           simcall->issuer->name.c_str(),
349           sg_host_get_name(simcall->issuer->host)
350           );
351       break;
352
353   }
354 }