Logo AND Algorithmique Numérique Distribuée

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