1 /**********************************************************************/
2 /* File generated by src/simix/simcalls.py from src/simix/simcalls.in */
4 /* DO NOT EVER CHANGE THIS FILE */
6 /* change simcalls specification in src/simix/simcalls.in */
7 /* Copyright (c) 2014-2019. The SimGrid Team. All rights reserved. */
8 /**********************************************************************/
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.
14 * That's not about http://en.wikipedia.org/wiki/Poop, despite the odor :)
17 #include "smx_private.hpp"
20 #include "src/mc/mc_forward.hpp"
22 #include "src/kernel/activity/ConditionVariableImpl.hpp"
24 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
26 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
27 const char* simcall_names[] = {
29 "SIMCALL_PROCESS_SUSPEND",
30 "SIMCALL_PROCESS_JOIN",
31 "SIMCALL_PROCESS_SLEEP",
32 "SIMCALL_EXECUTION_WAIT",
33 "SIMCALL_EXECUTION_WAITANY_FOR",
34 "SIMCALL_EXECUTION_TEST",
39 "SIMCALL_COMM_WAITANY",
42 "SIMCALL_COMM_TESTANY",
44 "SIMCALL_MUTEX_TRYLOCK",
45 "SIMCALL_MUTEX_UNLOCK",
47 "SIMCALL_COND_WAIT_TIMEOUT",
48 "SIMCALL_SEM_ACQUIRE",
49 "SIMCALL_SEM_ACQUIRE_TIMEOUT",
53 "SIMCALL_RUN_BLOCKING",
57 * @brief (in kernel mode) unpack the simcall and activate the handler
59 * This function is generated from src/simix/simcalls.in
61 void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) {
62 XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call));
63 SIMCALL_SET_MC_VALUE(simcall, value);
64 if (context_->iwannadie)
66 switch (simcall.call) {
67 case SIMCALL_PROCESS_SUSPEND:
68 simcall_HANDLER_process_suspend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]));
71 case SIMCALL_PROCESS_JOIN:
72 simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
75 case SIMCALL_PROCESS_SLEEP:
76 simcall_HANDLER_process_sleep(&simcall, simgrid::simix::unmarshal<double>(simcall.args[0]));
79 case SIMCALL_EXECUTION_WAIT:
80 simcall_HANDLER_execution_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
83 case SIMCALL_EXECUTION_WAITANY_FOR:
84 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]));
87 case SIMCALL_EXECUTION_TEST:
88 simcall_HANDLER_execution_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
91 case SIMCALL_COMM_SEND:
92 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]));
95 case SIMCALL_COMM_ISEND:
96 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])));
100 case SIMCALL_COMM_RECV:
101 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]));
104 case SIMCALL_COMM_IRECV:
105 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])));
109 case SIMCALL_COMM_WAITANY:
110 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]));
113 case SIMCALL_COMM_WAIT:
114 simcall_HANDLER_comm_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
117 case SIMCALL_COMM_TEST:
118 simcall_HANDLER_comm_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]));
121 case SIMCALL_COMM_TESTANY:
122 simcall_HANDLER_comm_testany(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]), simgrid::simix::unmarshal<size_t>(simcall.args[1]));
125 case SIMCALL_MUTEX_LOCK:
126 simcall_HANDLER_mutex_lock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
129 case SIMCALL_MUTEX_TRYLOCK:
130 simgrid::simix::marshal<int>(simcall.result, simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0])));
134 case SIMCALL_MUTEX_UNLOCK:
135 simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
139 case SIMCALL_COND_WAIT:
140 simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]));
143 case SIMCALL_COND_WAIT_TIMEOUT:
144 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 case SIMCALL_SEM_ACQUIRE:
148 simcall_HANDLER_sem_acquire(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]));
151 case SIMCALL_SEM_ACQUIRE_TIMEOUT:
152 simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
155 case SIMCALL_IO_WAIT:
156 simcall_HANDLER_io_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::IoImpl*>(simcall.args[0]));
159 case SIMCALL_MC_RANDOM:
160 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])));
164 case SIMCALL_RUN_KERNEL:
165 SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
169 case SIMCALL_RUN_BLOCKING:
170 SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
176 throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
178 sg_host_get_name(get_host())));