Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
f70946c9aeb43639747b09ca7d3b90b2bf3332fa
[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-2018. 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 "smx_private.hpp"
18 #include <xbt/base.h>
19 #if SIMGRID_HAVE_MC
20 #include "src/mc/mc_forward.hpp"
21 #endif
22 #include "src/kernel/activity/ConditionVariableImpl.hpp"
23 #include "src/simix/smx_host_private.hpp"
24 #include "src/simix/smx_synchro_private.hpp"
25
26 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
27
28 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
29 const char* simcall_names[] = {
30     "SIMCALL_NONE",
31     "SIMCALL_PROCESS_KILLALL",
32     "SIMCALL_PROCESS_CLEANUP",
33     "SIMCALL_PROCESS_SUSPEND",
34     "SIMCALL_PROCESS_JOIN",
35     "SIMCALL_PROCESS_SLEEP",
36     "SIMCALL_EXECUTION_START",
37     "SIMCALL_EXECUTION_PARALLEL_START",
38     "SIMCALL_EXECUTION_WAIT",
39     "SIMCALL_EXECUTION_TEST",
40     "SIMCALL_PROCESS_ON_EXIT",
41     "SIMCALL_COMM_IPROBE",
42     "SIMCALL_COMM_SEND",
43     "SIMCALL_COMM_ISEND",
44     "SIMCALL_COMM_RECV",
45     "SIMCALL_COMM_IRECV",
46     "SIMCALL_COMM_WAITANY",
47     "SIMCALL_COMM_WAIT",
48     "SIMCALL_COMM_TEST",
49     "SIMCALL_COMM_TESTANY",
50     "SIMCALL_MUTEX_LOCK",
51     "SIMCALL_MUTEX_TRYLOCK",
52     "SIMCALL_MUTEX_UNLOCK",
53     "SIMCALL_COND_INIT",
54     "SIMCALL_COND_WAIT",
55     "SIMCALL_COND_WAIT_TIMEOUT",
56     "SIMCALL_SEM_ACQUIRE",
57     "SIMCALL_SEM_ACQUIRE_TIMEOUT",
58     "SIMCALL_STORAGE_READ",
59     "SIMCALL_STORAGE_WRITE",
60     "SIMCALL_MC_RANDOM",
61     "SIMCALL_SET_CATEGORY",
62     "SIMCALL_RUN_KERNEL",
63     "SIMCALL_RUN_BLOCKING",
64 };
65
66 /** @private
67  * @brief (in kernel mode) unpack the simcall and activate the handler
68  *
69  * This function is generated from src/simix/simcalls.in
70  */
71 void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
72   XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
73   SIMCALL_SET_MC_VALUE(simcall, value);
74   if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
75     return;
76   switch (simcall->call) {
77 case SIMCALL_PROCESS_KILLALL:
78   simcall_HANDLER_process_killall(simcall);
79   SIMIX_simcall_answer(simcall);
80   break;
81
82 case SIMCALL_PROCESS_CLEANUP:
83   SIMIX_process_cleanup(simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
84   SIMIX_simcall_answer(simcall);
85   break;
86
87 case SIMCALL_PROCESS_SUSPEND:
88   simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
89   break;
90
91 case SIMCALL_PROCESS_JOIN:
92   simcall_HANDLER_process_join(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
93   break;
94
95 case SIMCALL_PROCESS_SLEEP:
96   simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal<double>(simcall->args[0]));
97   break;
98
99 case SIMCALL_EXECUTION_START:
100   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(
101       simcall->result, SIMIX_execution_start(simgrid::simix::unmarshal<const char*>(simcall->args[0]),
102                                              simgrid::simix::unmarshal<double>(simcall->args[1]),
103                                              simgrid::simix::unmarshal<double>(simcall->args[2]),
104                                              simgrid::simix::unmarshal<double>(simcall->args[3]),
105                                              simgrid::simix::unmarshal<sg_host_t>(simcall->args[4])));
106   SIMIX_simcall_answer(simcall);
107   break;
108
109 case SIMCALL_EXECUTION_PARALLEL_START:
110   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(simcall->result, SIMIX_execution_parallel_start(simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]), simgrid::simix::unmarshal<sg_host_t*>(simcall->args[2]), simgrid::simix::unmarshal<double*>(simcall->args[3]), simgrid::simix::unmarshal<double*>(simcall->args[4]), simgrid::simix::unmarshal<double>(simcall->args[5]), simgrid::simix::unmarshal<double>(simcall->args[6])));
111   SIMIX_simcall_answer(simcall);
112   break;
113
114 case SIMCALL_EXECUTION_WAIT:
115   simcall_HANDLER_execution_wait(simcall, simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
116   break;
117
118 case SIMCALL_EXECUTION_TEST:
119   simcall_HANDLER_execution_test(
120       simcall,
121       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
122   break;
123
124 case SIMCALL_PROCESS_ON_EXIT:
125   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]));
126   SIMIX_simcall_answer(simcall);
127   break;
128
129 case SIMCALL_COMM_IPROBE:
130   simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->result, simcall_HANDLER_comm_iprobe(simcall, simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[2]), simgrid::simix::unmarshal<void*>(simcall->args[3])));
131   SIMIX_simcall_answer(simcall);
132   break;
133
134 case SIMCALL_COMM_SEND:
135   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]));
136   break;
137
138 case SIMCALL_COMM_ISEND:
139   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<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_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<int>(simcall->args[10])));
140   SIMIX_simcall_answer(simcall);
141   break;
142
143 case SIMCALL_COMM_RECV:
144   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]));
145   break;
146
147 case SIMCALL_COMM_IRECV:
148   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<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])));
149   SIMIX_simcall_answer(simcall);
150   break;
151
152 case SIMCALL_COMM_WAITANY:
153   simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal<xbt_dynar_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
154   break;
155
156 case SIMCALL_COMM_WAIT:
157   simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
158   break;
159
160 case SIMCALL_COMM_TEST:
161   simcall_HANDLER_comm_test(simcall, simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
162   break;
163
164 case SIMCALL_COMM_TESTANY:
165   simcall_HANDLER_comm_testany(simcall, simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>*>(simcall->args[0]), simgrid::simix::unmarshal<size_t>(simcall->args[1]));
166   break;
167
168 case SIMCALL_MUTEX_LOCK:
169   simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
170   break;
171
172 case SIMCALL_MUTEX_TRYLOCK:
173   simgrid::simix::marshal<int>(simcall->result, simcall_HANDLER_mutex_trylock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0])));
174   SIMIX_simcall_answer(simcall);
175   break;
176
177 case SIMCALL_MUTEX_UNLOCK:
178   simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
179   SIMIX_simcall_answer(simcall);
180   break;
181
182 case SIMCALL_COND_INIT:
183   simgrid::simix::marshal<smx_cond_t>(simcall->result, SIMIX_cond_init());
184   SIMIX_simcall_answer(simcall);
185   break;
186
187 case SIMCALL_COND_WAIT:
188   simcall_HANDLER_cond_wait(simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[1]));
189   break;
190
191 case SIMCALL_COND_WAIT_TIMEOUT:
192   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]));
193   break;
194
195 case SIMCALL_SEM_ACQUIRE:
196   simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
197   break;
198
199 case SIMCALL_SEM_ACQUIRE_TIMEOUT:
200   simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]));
201   break;
202
203 case SIMCALL_STORAGE_READ:
204   simcall_HANDLER_storage_read(simcall, simgrid::simix::unmarshal<surf_storage_t>(simcall->args[0]),
205                                simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
206   break;
207
208 case SIMCALL_STORAGE_WRITE:
209   simcall_HANDLER_storage_write(simcall, simgrid::simix::unmarshal<surf_storage_t>(simcall->args[0]),
210                                 simgrid::simix::unmarshal<sg_size_t>(simcall->args[1]));
211   break;
212
213 case SIMCALL_MC_RANDOM:
214   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])));
215   SIMIX_simcall_answer(simcall);
216   break;
217
218 case SIMCALL_SET_CATEGORY:
219   SIMIX_set_category(simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]), simgrid::simix::unmarshal<const char*>(simcall->args[1]));
220   SIMIX_simcall_answer(simcall);
221   break;
222
223 case SIMCALL_RUN_KERNEL:
224   SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
225   SIMIX_simcall_answer(simcall);
226   break;
227
228 case SIMCALL_RUN_BLOCKING:
229   SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
230   break;
231     case NUM_SIMCALLS:
232       break;
233     case SIMCALL_NONE:
234       THROWF(arg_error,0,"Asked to do the noop syscall on %s@%s",
235           simcall->issuer->name.c_str(),
236           sg_host_get_name(simcall->issuer->host)
237           );
238       break;
239     default:
240       THROW_IMPOSSIBLE;
241   }
242 }