Logo AND Algorithmique Numérique Distribuée

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