Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Add missing copyright notices.
[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/kernel/actor/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::COMM_RECV",
33     "Simcall::COMM_IRECV",
34     "Simcall::COMM_SEND",
35     "Simcall::COMM_ISEND",
36     "Simcall::COMM_TEST",
37     "Simcall::COMM_TESTANY",
38     "Simcall::COMM_WAITANY",
39     "Simcall::COMM_WAIT",
40     "Simcall::RUN_KERNEL",
41     "Simcall::RUN_BLOCKING",
42 }};
43
44 /** @private
45  * @brief (in kernel mode) unpack the simcall and activate the handler
46  *
47  * This function is generated from src/simix/simcalls.in
48  */
49 void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)
50 {
51   XBT_DEBUG("Handling simcall %p: %s", &simcall_, SIMIX_simcall_name(simcall_));
52   simcall_.mc_value_ = times_considered;
53   if (simcall_.observer_ != nullptr)
54     simcall_.observer_->prepare(times_considered);
55   if (context_->wannadie())
56     return;
57   switch (simcall_.call_) {
58     case Simcall::COMM_RECV:
59       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]));
60       break;
61
62     case Simcall::COMM_IRECV:
63       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])));
64       simcall_answer();
65       break;
66
67     case Simcall::COMM_SEND:
68       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       break;
70
71     case Simcall::COMM_ISEND:
72       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])));
73       simcall_answer();
74       break;
75
76     case Simcall::COMM_TEST:
77       simgrid::simix::marshal<bool>(simcall_.result_, simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0])));
78       simcall_answer();
79       break;
80
81     case Simcall::COMM_TESTANY:
82       simgrid::simix::marshal<int>(simcall_.result_, simcall_HANDLER_comm_testany(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall_.args_[0]), simgrid::simix::unmarshal<size_t>(simcall_.args_[1])));
83       simcall_answer();
84       break;
85
86     case Simcall::COMM_WAITANY:
87       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]));
88       break;
89
90     case Simcall::COMM_WAIT:
91       simcall_HANDLER_comm_wait(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
92       break;
93
94     case Simcall::RUN_KERNEL:
95       SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
96       simcall_answer();
97       break;
98
99     case Simcall::RUN_BLOCKING:
100       SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall_.args_[0]));
101       break;
102
103     case Simcall::NONE:
104       throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
105                                                               get_cname(),
106                                                               sg_host_get_name(get_host())));
107     default:
108       THROW_IMPOSSIBLE;
109   }
110 }