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-2020. 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_EXECUTION_WAITANY_FOR",
34 "SIMCALL_COMM_WAITANY",
37 "SIMCALL_COMM_TESTANY",
39 "SIMCALL_MUTEX_TRYLOCK",
40 "SIMCALL_MUTEX_UNLOCK",
42 "SIMCALL_COND_WAIT_TIMEOUT",
43 "SIMCALL_SEM_ACQUIRE",
44 "SIMCALL_SEM_ACQUIRE_TIMEOUT",
47 "SIMCALL_RUN_BLOCKING",
51 * @brief (in kernel mode) unpack the simcall and activate the handler
53 * This function is generated from src/simix/simcalls.in
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())
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]));
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]));
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])));
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]));
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])));
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]));
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]));
91 case SIMCALL_COMM_TEST:
92 simcall_HANDLER_comm_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args_[0]));
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]));
99 case SIMCALL_MUTEX_LOCK:
100 simcall_HANDLER_mutex_lock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0]));
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])));
108 case SIMCALL_MUTEX_UNLOCK:
109 simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args_[0]));
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]));
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]));
121 case SIMCALL_SEM_ACQUIRE:
122 simcall_HANDLER_sem_acquire(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args_[0]));
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]));
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])));
134 case SIMCALL_RUN_KERNEL:
135 SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args_[0]));
139 case SIMCALL_RUN_BLOCKING:
140 SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args_[0]));
146 throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
148 sg_host_get_name(get_host())));