Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sort comm_* simcalls alphabetically
[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-2021. 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 #include "src/mc/checker/SimcallObserver.hpp"
25
26 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
27
28 using simgrid::simix::Simcall;
29 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
30 constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
31     "Simcall::NONE",
32     "Simcall::EXECUTION_WAITANY_FOR",
33     "Simcall::COMM_RECV",
34     "Simcall::COMM_IRECV",
35     "Simcall::COMM_SEND",
36     "Simcall::COMM_ISEND",
37     "Simcall::COMM_TEST",
38     "Simcall::COMM_TESTANY",
39     "Simcall::COMM_WAITANY",
40     "Simcall::COMM_WAIT",
41     "Simcall::COND_WAIT",
42     "Simcall::COND_WAIT_TIMEOUT",
43     "Simcall::SEM_ACQUIRE",
44     "Simcall::SEM_ACQUIRE_TIMEOUT",
45     "Simcall::RUN_KERNEL",
46     "Simcall::RUN_BLOCKING",
47 }};
48
49 /** @private
50  * @brief (in kernel mode) unpack the simcall and activate the handler
51  *
52  * This function is generated from src/simix/simcalls.in
53  */
54 void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered_)
55 {
56   XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_.call_));
57   simcall_.mc_value_ = times_considered_;
58   if (simcall_.observer_ != nullptr)
59     simcall_.observer_->prepare(times_considered_);
60   if (context_->wannadie())
61     return;
62   switch (simcall_.call_) {
63     case Simcall::EXECUTION_WAITANY_FOR:
64       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       break;
66
67     case Simcall::COMM_RECV:
68       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]));
69       break;
70
71     case Simcall::COMM_IRECV:
72       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])));
73       simcall_answer();
74       break;
75
76     case Simcall::COMM_SEND:
77       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]));
78       break;
79
80     case Simcall::COMM_ISEND:
81       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])));
82       simcall_answer();
83       break;
84
85     case Simcall::COMM_TEST:
86       simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]));
87       break;
88
89     case Simcall::COMM_TESTANY:
90       simcall_HANDLER_comm_testany(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall_.args_[0]), simgrid::simix::unmarshal<size_t>(simcall_.args_[1]));
91       break;
92
93     case Simcall::COMM_WAITANY:
94       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]));
95       break;
96
97     case Simcall::COMM_WAIT:
98       simcall_HANDLER_comm_wait(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
99       break;
100
101     case Simcall::COND_WAIT:
102       simcall_HANDLER_cond_wait(&simcall_, simgrid::simix::unmarshal<smx_cond_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[1]));
103       break;
104
105     case Simcall::COND_WAIT_TIMEOUT:
106       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]));
107       break;
108
109     case Simcall::SEM_ACQUIRE:
110       simcall_HANDLER_sem_acquire(&simcall_, simgrid::simix::unmarshal<smx_sem_t>(simcall_.args_[0]));
111       break;
112
113     case Simcall::SEM_ACQUIRE_TIMEOUT:
114       simcall_HANDLER_sem_acquire_timeout(&simcall_, simgrid::simix::unmarshal<smx_sem_t>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
115       break;
116
117     case Simcall::RUN_KERNEL:
118       SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
119       simcall_answer();
120       break;
121
122     case Simcall::RUN_BLOCKING:
123       SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
124       break;
125
126     case Simcall::NONE:
127       throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
128                                                               get_cname(),
129                                                               sg_host_get_name(get_host())));
130     default:
131       THROW_IMPOSSIBLE;
132   }
133 }