Logo AND Algorithmique Numérique Distribuée

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