Logo AND Algorithmique Numérique Distribuée

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