From d1fc2db12e159461fa3c6a1fb60a1f8e395e91f8 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Thu, 8 Aug 2019 23:20:44 +0200 Subject: [PATCH] change SIMIX_simcall_handle() into ActorImpl::simcall_handle() --- doc/doxygen/inside_extending.doc | 2 +- include/simgrid/kernel/future.hpp | 2 +- src/kernel/activity/CommImpl.cpp | 10 +- src/kernel/actor/ActorImpl.hpp | 3 + src/mc/inspect/ObjectInformation.cpp | 3 +- src/mc/mc_base.cpp | 2 +- src/mc/mc_record.cpp | 2 +- src/mc/remote/Client.cpp | 2 +- src/simix/popping_bodies.cpp | 2 +- src/simix/popping_generated.cpp | 131 +++++++++++++++++++-------- src/simix/popping_private.hpp | 5 +- src/simix/simcalls.py | 22 ++--- src/simix/smx_global.cpp | 2 +- 13 files changed, 123 insertions(+), 65 deletions(-) diff --git a/doc/doxygen/inside_extending.doc b/doc/doxygen/inside_extending.doc index dc0c51e084..caab36893e 100644 --- a/doc/doxygen/inside_extending.doc +++ b/doc/doxygen/inside_extending.doc @@ -140,7 +140,7 @@ The workflow of a simcall is the following: - If maestro, executes the simcall directly (and return) - If not, call `ActorImpl::yield` to give back the control to maestro - ========== KERNEL MODE ========== - - `SIMIX_simcall_handle` large switch (on simcall) doing for each: + - `ActorImpl::simcall_handle` large switch (on simcall) doing for each: - `simcall_HANDLER_(simcall, )` (the manual code handling the simcall) - If the simcall is not marked as "blocking" in its definition, call `SIMIX_simcall_answer(simcall)` that adds back the issuer diff --git a/include/simgrid/kernel/future.hpp b/include/simgrid/kernel/future.hpp index fea70d43f0..e5873bdd66 100644 --- a/include/simgrid/kernel/future.hpp +++ b/include/simgrid/kernel/future.hpp @@ -74,7 +74,7 @@ public: schedule(std::move(continuation)); break; case FutureStatus::not_ready: - // The future is not ready so we mast keep the continuation for + // The future is not ready so we must keep the continuation for // executing it later: continuation_ = std::move(continuation); break; diff --git a/src/kernel/activity/CommImpl.cpp b/src/kernel/activity/CommImpl.cpp index 8d6c7e37bd..86bdff9228 100644 --- a/src/kernel/activity/CommImpl.cpp +++ b/src/kernel/activity/CommImpl.cpp @@ -26,7 +26,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sr { smx_activity_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate, src_buff, src_buff_size, match_fun, nullptr, copy_data_fun, data, 0); - SIMCALL_SET_MC_VALUE(simcall, 0); + SIMCALL_SET_MC_VALUE(*simcall, 0); simcall_HANDLER_comm_wait(simcall, static_cast(comm.get()), timeout); } @@ -104,7 +104,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t re { smx_activity_t comm = simcall_HANDLER_comm_irecv(simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); - SIMCALL_SET_MC_VALUE(simcall, 0); + SIMCALL_SET_MC_VALUE(*simcall, 0); simcall_HANDLER_comm_wait(simcall, static_cast(comm.get()), timeout); } @@ -191,7 +191,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity: comm->register_simcall(simcall); if (MC_is_active() || MC_record_replay_is_active()) { - int idx = SIMCALL_GET_MC_VALUE(simcall); + int idx = SIMCALL_GET_MC_VALUE(*simcall); if (idx == 0) { comm->state_ = SIMIX_DONE; } else { @@ -253,7 +253,7 @@ void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activi simcall_comm_testany__set__result(simcall, -1); if (MC_is_active() || MC_record_replay_is_active()) { - int idx = SIMCALL_GET_MC_VALUE(simcall); + int idx = SIMCALL_GET_MC_VALUE(*simcall); if (idx == -1) { SIMIX_simcall_answer(simcall); } else { @@ -297,7 +297,7 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activi if (MC_is_active() || MC_record_replay_is_active()) { if (timeout > 0.0) xbt_die("Timeout not implemented for waitany in the model-checker"); - int idx = SIMCALL_GET_MC_VALUE(simcall); + int idx = SIMCALL_GET_MC_VALUE(*simcall); auto* comm = comms[idx]; comm->simcalls_.push_back(simcall); simcall_comm_waitany__set__result(simcall, idx); diff --git a/src/kernel/actor/ActorImpl.hpp b/src/kernel/actor/ActorImpl.hpp index acf8f246af..54a67c6a56 100644 --- a/src/kernel/actor/ActorImpl.hpp +++ b/src/kernel/actor/ActorImpl.hpp @@ -129,6 +129,9 @@ public: activity::ActivityImplPtr sleep(double duration); /** Ask the actor to throw an exception right away */ void throw_exception(std::exception_ptr e); + + /** execute the pending simcall -- must be called from the maestro context */ + void simcall_handle(int value); }; class ProcessArg { diff --git a/src/mc/inspect/ObjectInformation.cpp b/src/mc/inspect/ObjectInformation.cpp index 75b39d40f9..64adf52a8c 100644 --- a/src/mc/inspect/ObjectInformation.cpp +++ b/src/mc/inspect/ObjectInformation.cpp @@ -83,9 +83,10 @@ simgrid::mc::Frame* ObjectInformation::find_function(const void* ip) const const simgrid::mc::Variable* ObjectInformation::find_variable(const char* name) const { - for (simgrid::mc::Variable const& variable : this->global_variables) + for (simgrid::mc::Variable const& variable : this->global_variables) { if (variable.name == name) return &variable; + } return nullptr; } diff --git a/src/mc/mc_base.cpp b/src/mc/mc_base.cpp index 76b27219fe..413e9a7d9b 100644 --- a/src/mc/mc_base.cpp +++ b/src/mc/mc_base.cpp @@ -43,7 +43,7 @@ void wait_for_requests() for (smx_actor_t const& process : simix_global->actors_that_ran) { smx_simcall_t req = &process->simcall; if (req->call != SIMCALL_NONE && not simgrid::mc::request_is_visible(req)) - SIMIX_simcall_handle(req, 0); + process->simcall_handle(0); } } #if SIMGRID_HAVE_MC diff --git a/src/mc/mc_record.cpp b/src/mc/mc_record.cpp index 685c491571..224eed8527 100644 --- a/src/mc/mc_record.cpp +++ b/src/mc/mc_record.cpp @@ -41,7 +41,7 @@ void replay(RecordTrace const& trace) xbt_die("Unexpected simcall."); // Execute the request: - SIMIX_simcall_handle(simcall, transition.argument); + simcall->issuer->simcall_handle(transition.argument); simgrid::mc::wait_for_requests(); } } diff --git a/src/mc/remote/Client.cpp b/src/mc/remote/Client.cpp index 4e774042b2..06916a44e0 100644 --- a/src/mc/remote/Client.cpp +++ b/src/mc/remote/Client.cpp @@ -97,7 +97,7 @@ void Client::handle_simcall(s_mc_message_simcall_handle_t* message) smx_actor_t process = SIMIX_process_from_PID(message->pid); if (not process) xbt_die("Invalid pid %lu", (unsigned long)message->pid); - SIMIX_simcall_handle(&process->simcall, message->value); + process->simcall_handle(message->value); if (channel_.send(MC_MESSAGE_WAITING)) xbt_die("Could not send MESSAGE_WAITING to model-checker"); } diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index f3af8b79fa..353945534b 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -34,7 +34,7 @@ inline static R simcall(e_smx_simcall_t call, T const&... t) (int)self->simcall.call); self->yield(); } else { - SIMIX_simcall_handle(&self->simcall, 0); + self->simcall_handle(0); } return simgrid::simix::unmarshal(self->simcall.result); } diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index 98f51cf723..2d144571ff 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -58,124 +58,179 @@ const char* simcall_names[] = { * * This function is generated from src/simix/simcalls.in */ -void SIMIX_simcall_handle(smx_simcall_t simcall, int value) { - XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call)); +void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) +{ + XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call)); SIMCALL_SET_MC_VALUE(simcall, value); - if (simcall->issuer->context_->iwannadie) + if (context_->iwannadie) return; - switch (simcall->call) { + switch (simcall.call) { case SIMCALL_PROCESS_SUSPEND: - simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_process_suspend(&simcall, simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_PROCESS_JOIN: - simcall_HANDLER_process_join(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1])); break; case SIMCALL_PROCESS_SLEEP: - simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_process_sleep(&simcall, simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_EXECUTION_WAIT: - simcall_HANDLER_execution_wait(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_execution_wait(&simcall, + simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_EXECUTION_WAITANY_FOR: - simcall_HANDLER_execution_waitany_for(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); + simcall_HANDLER_execution_waitany_for( + &simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]), simgrid::simix::unmarshal(simcall.args[2])); break; case SIMCALL_EXECUTION_TEST: - simcall_HANDLER_execution_test(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_execution_test(&simcall, + simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_COMM_SEND: - simcall_HANDLER_comm_send(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]), simgrid::simix::unmarshal(simcall->args[8]), simgrid::simix::unmarshal(simcall->args[9])); + simcall_HANDLER_comm_send( + &simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]), simgrid::simix::unmarshal(simcall.args[2]), + simgrid::simix::unmarshal(simcall.args[3]), + simgrid::simix::unmarshal(simcall.args[4]), + simgrid::simix::unmarshal(simcall.args[5]), + simgrid::simix::unmarshal(simcall.args[6]), + simgrid::simix::unmarshal(simcall.args[7]), + simgrid::simix::unmarshal(simcall.args[8]), simgrid::simix::unmarshal(simcall.args[9])); break; case SIMCALL_COMM_ISEND: - simgrid::simix::marshal>(simcall->result, simcall_HANDLER_comm_isend(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]), simgrid::simix::unmarshal(simcall->args[8]), simgrid::simix::unmarshal(simcall->args[9]), simgrid::simix::unmarshal(simcall->args[10]))); - SIMIX_simcall_answer(simcall); + simgrid::simix::marshal>( + simcall.result, simcall_HANDLER_comm_isend(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]), + simgrid::simix::unmarshal(simcall.args[2]), + simgrid::simix::unmarshal(simcall.args[3]), + simgrid::simix::unmarshal(simcall.args[4]), + simgrid::simix::unmarshal(simcall.args[5]), + simgrid::simix::unmarshal(simcall.args[6]), + simgrid::simix::unmarshal(simcall.args[7]), + simgrid::simix::unmarshal(simcall.args[8]), + simgrid::simix::unmarshal(simcall.args[9]), + simgrid::simix::unmarshal(simcall.args[10]))); + SIMIX_simcall_answer(&simcall); break; case SIMCALL_COMM_RECV: - simcall_HANDLER_comm_recv(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]), simgrid::simix::unmarshal(simcall->args[8])); + simcall_HANDLER_comm_recv(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]), + simgrid::simix::unmarshal(simcall.args[2]), + simgrid::simix::unmarshal(simcall.args[3]), + simgrid::simix::unmarshal(simcall.args[4]), + simgrid::simix::unmarshal(simcall.args[5]), + simgrid::simix::unmarshal(simcall.args[6]), + simgrid::simix::unmarshal(simcall.args[7]), + simgrid::simix::unmarshal(simcall.args[8])); break; case SIMCALL_COMM_IRECV: - simgrid::simix::marshal>(simcall->result, simcall_HANDLER_comm_irecv(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2]), simgrid::simix::unmarshal(simcall->args[3]), simgrid::simix::unmarshal(simcall->args[4]), simgrid::simix::unmarshal(simcall->args[5]), simgrid::simix::unmarshal(simcall->args[6]), simgrid::simix::unmarshal(simcall->args[7]))); - SIMIX_simcall_answer(simcall); + simgrid::simix::marshal>( + simcall.result, simcall_HANDLER_comm_irecv(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]), + simgrid::simix::unmarshal(simcall.args[2]), + simgrid::simix::unmarshal(simcall.args[3]), + simgrid::simix::unmarshal(simcall.args[4]), + simgrid::simix::unmarshal(simcall.args[5]), + simgrid::simix::unmarshal(simcall.args[6]), + simgrid::simix::unmarshal(simcall.args[7]))); + SIMIX_simcall_answer(&simcall); break; case SIMCALL_COMM_WAITANY: - simcall_HANDLER_comm_waitany(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); + simcall_HANDLER_comm_waitany( + &simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]), simgrid::simix::unmarshal(simcall.args[2])); break; case SIMCALL_COMM_WAIT: - simcall_HANDLER_comm_wait(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + simcall_HANDLER_comm_wait(&simcall, + simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1])); break; case SIMCALL_COMM_TEST: - simcall_HANDLER_comm_test(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_comm_test(&simcall, + simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_COMM_TESTANY: - simcall_HANDLER_comm_testany(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + simcall_HANDLER_comm_testany(&simcall, + simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1])); break; case SIMCALL_MUTEX_LOCK: - simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_mutex_lock(&simcall, simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_MUTEX_TRYLOCK: - simgrid::simix::marshal(simcall->result, simcall_HANDLER_mutex_trylock(simcall, simgrid::simix::unmarshal(simcall->args[0]))); - SIMIX_simcall_answer(simcall); + simgrid::simix::marshal( + simcall.result, + simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal(simcall.args[0]))); + SIMIX_simcall_answer(&simcall); break; case SIMCALL_MUTEX_UNLOCK: - simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal(simcall->args[0])); - SIMIX_simcall_answer(simcall); + simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal(simcall.args[0])); + SIMIX_simcall_answer(&simcall); break; case SIMCALL_COND_WAIT: - simcall_HANDLER_cond_wait(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1])); break; case SIMCALL_COND_WAIT_TIMEOUT: - simcall_HANDLER_cond_wait_timeout(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]), simgrid::simix::unmarshal(simcall->args[2])); + simcall_HANDLER_cond_wait_timeout(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]), + simgrid::simix::unmarshal(simcall.args[2])); break; case SIMCALL_SEM_ACQUIRE: - simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_sem_acquire(&simcall, simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_SEM_ACQUIRE_TIMEOUT: - simcall_HANDLER_sem_acquire_timeout(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1])); + simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1])); break; case SIMCALL_IO_WAIT: - simcall_HANDLER_io_wait(simcall, simgrid::simix::unmarshal(simcall->args[0])); + simcall_HANDLER_io_wait(&simcall, simgrid::simix::unmarshal(simcall.args[0])); break; case SIMCALL_MC_RANDOM: - simgrid::simix::marshal(simcall->result, simcall_HANDLER_mc_random(simcall, simgrid::simix::unmarshal(simcall->args[0]), simgrid::simix::unmarshal(simcall->args[1]))); - SIMIX_simcall_answer(simcall); + simgrid::simix::marshal(simcall.result, + simcall_HANDLER_mc_random(&simcall, simgrid::simix::unmarshal(simcall.args[0]), + simgrid::simix::unmarshal(simcall.args[1]))); + SIMIX_simcall_answer(&simcall); break; case SIMCALL_RUN_KERNEL: - SIMIX_run_kernel(simgrid::simix::unmarshal const*>(simcall->args[0])); - SIMIX_simcall_answer(simcall); + SIMIX_run_kernel(simgrid::simix::unmarshal const*>(simcall.args[0])); + SIMIX_simcall_answer(&simcall); break; case SIMCALL_RUN_BLOCKING: - SIMIX_run_blocking(simgrid::simix::unmarshal const*>(simcall->args[0])); + SIMIX_run_blocking(simgrid::simix::unmarshal const*>(simcall.args[0])); break; case NUM_SIMCALLS: break; case SIMCALL_NONE: - throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s", - simcall->issuer->get_cname(), - sg_host_get_name(simcall->issuer->get_host()))); + throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s", get_cname(), + sg_host_get_name(get_host()))); default: THROW_IMPOSSIBLE; } diff --git a/src/simix/popping_private.hpp b/src/simix/popping_private.hpp index e2fec6dacf..f537d909fd 100644 --- a/src/simix/popping_private.hpp +++ b/src/simix/popping_private.hpp @@ -51,13 +51,12 @@ struct s_smx_simcall { u_smx_scalar result; }; -#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value)) -#define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value) +#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall).mc_value = (value)) +#define SIMCALL_GET_MC_VALUE(simcall) ((simcall).mc_value) /******************************** General *************************************/ XBT_PRIVATE void SIMIX_simcall_answer(smx_simcall_t simcall); -XBT_PRIVATE void SIMIX_simcall_handle(smx_simcall_t simcall, int value); XBT_PRIVATE const char* SIMIX_simcall_name(e_smx_simcall_t kind); XBT_PRIVATE void SIMIX_run_kernel(std::function const* code); XBT_PRIVATE void SIMIX_run_blocking(std::function const* code); diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index 80fa19774b..c1f89bc206 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -130,21 +130,21 @@ class Simcall(object): def case(self): res = [] indent = ' ' - args = ["simgrid::simix::unmarshal<%s>(simcall->args[%d])" % (arg.rettype(), i) + args = ["simgrid::simix::unmarshal<%s>(simcall.args[%d])" % (arg.rettype(), i) for i, arg in enumerate(self.args)] res.append(indent + 'case SIMCALL_%s:' % (self.name.upper())) if self.need_handler: - call = "simcall_HANDLER_%s(simcall%s%s)" % (self.name, + call = "simcall_HANDLER_%s(&simcall%s%s)" % (self.name, ", " if len(args) > 0 else "", ', '.join(args)) else: call = "SIMIX_%s(%s)" % (self.name, ', '.join(args)) if self.call_kind == 'Func': - res.append(indent + " simgrid::simix::marshal<%s>(simcall->result, %s);" % (self.res.rettype(), call)) + res.append(indent + " simgrid::simix::marshal<%s>(simcall.result, %s);" % (self.res.rettype(), call)) else: res.append(indent + " " + call + ";") if self.call_kind != 'Blck': - res.append(indent + ' SIMIX_simcall_answer(simcall);') + res.append(indent + ' SIMIX_simcall_answer(&simcall);') res.append(indent + ' break;') res.append('') return '\n'.join(res) @@ -340,14 +340,14 @@ if __name__ == '__main__': fd.write(' * This function is generated from src/simix/simcalls.in\n') fd.write(' */\n') fd.write( - 'void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {\n') + 'void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) {\n') fd.write( - ' XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));\n') + ' XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call));\n') fd.write(' SIMCALL_SET_MC_VALUE(simcall, value);\n') fd.write( - ' if (simcall->issuer->context_->iwannadie)\n') + ' if (context_->iwannadie)\n') fd.write(' return;\n') - fd.write(' switch (simcall->call) {\n') + fd.write(' switch (simcall.call) {\n') handle(fd, Simcall.case, simcalls, simcalls_dict) @@ -355,8 +355,8 @@ if __name__ == '__main__': fd.write(' break;\n') fd.write(' case SIMCALL_NONE:\n') fd.write(' throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",\n') - fd.write(' simcall->issuer->get_cname(),\n') - fd.write(' sg_host_get_name(simcall->issuer->get_host())));\n') + fd.write(' get_cname(),\n') + fd.write(' sg_host_get_name(get_host())));\n') fd.write(' default:\n') fd.write(' THROW_IMPOSSIBLE;\n') fd.write(' }\n') @@ -389,7 +389,7 @@ inline static R simcall(e_smx_simcall_t call, T const&... t) (int)self->simcall.call); self->yield(); } else { - SIMIX_simcall_handle(&self->simcall, 0); + self->simcall_handle(0); } return simgrid::simix::unmarshal(self->simcall.result); } diff --git a/src/simix/smx_global.cpp b/src/simix/smx_global.cpp index 40b1beb727..5109eecfd0 100644 --- a/src/simix/smx_global.cpp +++ b/src/simix/smx_global.cpp @@ -468,7 +468,7 @@ void SIMIX_run() for (smx_actor_t const& process : simix_global->actors_that_ran) { if (process->simcall.call != SIMCALL_NONE) { - SIMIX_simcall_handle(&process->simcall, 0); + process->simcall_handle(0); } } -- 2.20.1