Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Take simcalls {execution,io}_wait toward modernity.
[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-2020. 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_EXECUTION_WAITANY_FOR",
30     "SIMCALL_COMM_SEND",
31     "SIMCALL_COMM_ISEND",
32     "SIMCALL_COMM_RECV",
33     "SIMCALL_COMM_IRECV",
34     "SIMCALL_COMM_WAITANY",
35     "SIMCALL_COMM_WAIT",
36     "SIMCALL_COMM_TEST",
37     "SIMCALL_COMM_TESTANY",
38     "SIMCALL_MUTEX_LOCK",
39     "SIMCALL_MUTEX_TRYLOCK",
40     "SIMCALL_MUTEX_UNLOCK",
41     "SIMCALL_COND_WAIT",
42     "SIMCALL_COND_WAIT_TIMEOUT",
43     "SIMCALL_SEM_ACQUIRE",
44     "SIMCALL_SEM_ACQUIRE_TIMEOUT",
45     "SIMCALL_MC_RANDOM",
46     "SIMCALL_RUN_KERNEL",
47     "SIMCALL_RUN_BLOCKING",
48 };
49
50 /** @private
51  * @brief (in kernel mode) unpack the simcall and activate the handler
52  *
53  * This function is generated from src/simix/simcalls.in
54  */
55 void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) {
56   XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call_));
57   SIMCALL_SET_MC_VALUE(simcall, value);
58   if (context_->wannadie())
59     return;
60   switch (simcall.call_) {
61     case SIMCALL_EXECUTION_WAITANY_FOR:
62       simcall_HANDLER_execution_waitany_for(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args_[0]), simgrid::simix::unmarshal<size_t>(simcall.args_[1]), simgrid::simix::unmarshal<double>(simcall.args_[2]));
63       break;
64
65     case SIMCALL_COMM_SEND:
66       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<unsigned char*>(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]));
67       break;
68
69     case SIMCALL_COMM_ISEND:
70       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<unsigned char*>(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<bool>(simcall.args_[10])));
71       simcall_answer();
72       break;
73
74     case SIMCALL_COMM_RECV:
75       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<unsigned char*>(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]));
76       break;
77
78     case SIMCALL_COMM_IRECV:
79       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<unsigned char*>(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])));
80       simcall_answer();
81       break;
82
83     case SIMCALL_COMM_WAITANY:
84       simcall_HANDLER_comm_waitany(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args_[0]), simgrid::simix::unmarshal<size_t>(simcall.args_[1]), simgrid::simix::unmarshal<double>(simcall.args_[2]));
85       break;
86
87     case SIMCALL_COMM_WAIT:
88       simcall_HANDLER_comm_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args_[0]), simgrid::simix::unmarshal<double>(simcall.args_[1]));
89       break;
90
91     case SIMCALL_COMM_TEST:
92       simcall_HANDLER_comm_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args_[0]));
93       break;
94
95     case SIMCALL_COMM_TESTANY:
96       simcall_HANDLER_comm_testany(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args_[0]), simgrid::simix::unmarshal<size_t>(simcall.args_[1]));
97       break;
98
99     case SIMCALL_MUTEX_LOCK:
100       simcall_HANDLER_mutex_lock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0]));
101       break;
102
103     case SIMCALL_MUTEX_TRYLOCK:
104       simgrid::simix::marshal<int>(simcall.result_, simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0])));
105       simcall_answer();
106       break;
107
108     case SIMCALL_MUTEX_UNLOCK:
109       simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0]));
110       simcall_answer();
111       break;
112
113     case SIMCALL_COND_WAIT:
114       simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args_[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[1]));
115       break;
116
117     case SIMCALL_COND_WAIT_TIMEOUT:
118       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]));
119       break;
120
121     case SIMCALL_SEM_ACQUIRE:
122       simcall_HANDLER_sem_acquire(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args_[0]));
123       break;
124
125     case SIMCALL_SEM_ACQUIRE_TIMEOUT:
126       simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args_[0]), simgrid::simix::unmarshal<double>(simcall.args_[1]));
127       break;
128
129     case SIMCALL_MC_RANDOM:
130       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])));
131       simcall_answer();
132       break;
133
134     case SIMCALL_RUN_KERNEL:
135       SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args_[0]));
136       simcall_answer();
137       break;
138
139     case SIMCALL_RUN_BLOCKING:
140       SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args_[0]));
141       break;
142
143     case NUM_SIMCALLS:
144       break;
145     case SIMCALL_NONE:
146       throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
147                                                               get_cname(),
148                                                               sg_host_get_name(get_host())));
149     default:
150       THROW_IMPOSSIBLE;
151   }
152 }