From b10171365eb016397cbe20e1bed5d02be72634e8 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Wed, 2 May 2018 22:50:35 +0200 Subject: [PATCH] Modernize simcall process_cleanup. --- include/simgrid/simix.h | 1 - src/kernel/context/Context.cpp | 2 +- src/simix/libsmx.cpp | 10 ---------- src/simix/popping_accessors.hpp | 13 ------------- src/simix/popping_bodies.cpp | 7 ------- src/simix/popping_enum.h | 1 - src/simix/popping_generated.cpp | 8 +------- src/simix/simcalls.in | 1 - src/simix/simcalls.py | 2 +- 9 files changed, 3 insertions(+), 42 deletions(-) diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 9d1ce9e7bd..3b75af828c 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -193,7 +193,6 @@ XBT_PUBLIC void simcall_process_killall(); XBT_PUBLIC void SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char* mesg); /* Process handling */ -XBT_PUBLIC void simcall_process_cleanup(smx_actor_t process); XBT_PUBLIC void simcall_process_suspend(smx_actor_t process); /* Getters and Setters */ diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index 79024d9f89..73dccc4c62 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -80,7 +80,7 @@ void Context::stop() this->process_->suspended = 0; this->iwannadie = false; - simcall_process_cleanup(this->process_); + simgrid::simix::kernelImmediate([this] { SIMIX_process_cleanup(this->process_); }); this->iwannadie = true; } diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 976492f9d9..254652cf35 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -186,16 +186,6 @@ void simcall_process_killall() simcall_BODY_process_killall(); } -/** - * \ingroup simix_process_management - * \brief Cleans up a SIMIX process. - * \param process poor victim (must have already been killed) - */ -void simcall_process_cleanup(smx_actor_t process) -{ - simcall_BODY_process_cleanup(process); -} - void simcall_process_join(smx_actor_t process, double timeout) { simcall_BODY_process_join(process, timeout); diff --git a/src/simix/popping_accessors.hpp b/src/simix/popping_accessors.hpp index cdb11ef555..698a84adf6 100644 --- a/src/simix/popping_accessors.hpp +++ b/src/simix/popping_accessors.hpp @@ -15,19 +15,6 @@ */ #include "src/simix/popping_private.hpp" -static inline smx_actor_t simcall_process_cleanup__get__process(smx_simcall_t simcall) -{ - return simgrid::simix::unmarshal(simcall->args[0]); -} -static inline smx_actor_t simcall_process_cleanup__getraw__process(smx_simcall_t simcall) -{ - return simgrid::simix::unmarshal_raw(simcall->args[0]); -} -static inline void simcall_process_cleanup__set__process(smx_simcall_t simcall, smx_actor_t arg) -{ - simgrid::simix::marshal(simcall->args[0], arg); -} - static inline smx_actor_t simcall_process_suspend__get__process(smx_simcall_t simcall) { return simgrid::simix::unmarshal(simcall->args[0]); diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index 7753890c81..458aa720cb 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -44,13 +44,6 @@ inline static void simcall_BODY_process_killall() return simcall(SIMCALL_PROCESS_KILLALL); } -inline static void simcall_BODY_process_cleanup(smx_actor_t process) -{ - if (0) /* Go to that function to follow the code flow through the simcall barrier */ - SIMIX_process_cleanup(process); - return simcall(SIMCALL_PROCESS_CLEANUP, process); -} - inline static void simcall_BODY_process_suspend(smx_actor_t process) { if (0) /* Go to that function to follow the code flow through the simcall barrier */ diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 624fcc1693..6cfa5c1dea 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -20,7 +20,6 @@ typedef enum { SIMCALL_NONE, SIMCALL_PROCESS_KILLALL, - SIMCALL_PROCESS_CLEANUP, SIMCALL_PROCESS_SUSPEND, SIMCALL_PROCESS_JOIN, SIMCALL_PROCESS_SLEEP, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index f70946c9ae..dcf20937e4 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -29,7 +29,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping); const char* simcall_names[] = { "SIMCALL_NONE", "SIMCALL_PROCESS_KILLALL", - "SIMCALL_PROCESS_CLEANUP", "SIMCALL_PROCESS_SUSPEND", "SIMCALL_PROCESS_JOIN", "SIMCALL_PROCESS_SLEEP", @@ -71,7 +70,7 @@ const char* simcall_names[] = { void SIMIX_simcall_handle(smx_simcall_t simcall, 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 && simcall->call != SIMCALL_PROCESS_CLEANUP) + if (simcall->issuer->context->iwannadie) return; switch (simcall->call) { case SIMCALL_PROCESS_KILLALL: @@ -79,11 +78,6 @@ case SIMCALL_PROCESS_KILLALL: SIMIX_simcall_answer(simcall); break; -case SIMCALL_PROCESS_CLEANUP: - SIMIX_process_cleanup(simgrid::simix::unmarshal(simcall->args[0])); - SIMIX_simcall_answer(simcall); - break; - case SIMCALL_PROCESS_SUSPEND: simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal(simcall->args[0])); break; diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 49f36d7253..aeda3cd11f 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -36,7 +36,6 @@ # ./include/simgrid/simix.h (otherwise you will get a warning at compile time) void process_killall(); -void process_cleanup(smx_actor_t process) [[nohandler]]; void process_suspend(smx_actor_t process) [[block]]; int process_join(smx_actor_t process, double timeout) [[block]]; int process_sleep(double duration) [[block]]; diff --git a/src/simix/simcalls.py b/src/simix/simcalls.py index d9a3ae145d..500b75e3d7 100755 --- a/src/simix/simcalls.py +++ b/src/simix/simcalls.py @@ -340,7 +340,7 @@ if __name__ == '__main__': ' 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 && simcall->call != SIMCALL_PROCESS_CLEANUP)\n') + ' if (simcall->issuer->context->iwannadie)\n') fd.write(' return;\n') fd.write(' switch (simcall->call) {\n') -- 2.20.1