From 80778e856b09b86fba1663275ffc8bc320dea9ce Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sun, 27 Feb 2022 21:59:11 +0100 Subject: [PATCH] reduce the visibility of popping_private --- src/kernel/activity/SleepImpl.cpp | 1 - src/kernel/activity/Synchro.cpp | 1 - src/simix/libsmx.cpp | 20 ---------------- src/simix/popping.cpp | 39 +++++++++++++++++-------------- src/simix/popping_private.hpp | 8 ------- 5 files changed, 22 insertions(+), 47 deletions(-) diff --git a/src/kernel/activity/SleepImpl.cpp b/src/kernel/activity/SleepImpl.cpp index 7a38388260..a7c1cea468 100644 --- a/src/kernel/activity/SleepImpl.cpp +++ b/src/kernel/activity/SleepImpl.cpp @@ -8,7 +8,6 @@ #include "src/kernel/activity/SleepImpl.hpp" #include "src/kernel/actor/ActorImpl.hpp" #include "src/kernel/resource/CpuImpl.hpp" -#include "src/simix/popping_private.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(ker_actor); diff --git a/src/kernel/activity/Synchro.cpp b/src/kernel/activity/Synchro.cpp index 21dd002330..56dc80d3ae 100644 --- a/src/kernel/activity/Synchro.cpp +++ b/src/kernel/activity/Synchro.cpp @@ -10,7 +10,6 @@ #include "src/kernel/actor/ActorImpl.hpp" #include "src/kernel/context/Context.hpp" #include "src/kernel/resource/CpuImpl.hpp" -#include "src/simix/popping_private.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(ker_synchro, kernel, "Kernel synchronization activity (lock/acquire on a mutex, semaphore or condition)"); diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 16a3681600..4650a7e3f6 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -259,26 +259,6 @@ void simcall_run_blocking(std::function const& code, simgrid::kernel::ac /* ************************************************************************** */ -/** @brief returns a printable string representing a simcall */ -const char* SIMIX_simcall_name(const s_smx_simcall& simcall) -{ - if (simcall.observer_ != nullptr) { -#if SIMGRID_HAVE_MC - if (mc_model_checker != nullptr) // Do not try to use the observer from the MCer - return "(remotely observed)"; -#endif - - static std::string name; - name = boost::core::demangle(typeid(*simcall.observer_).name()); - const char* cname = name.c_str(); - if (name.rfind("simgrid::kernel::", 0) == 0) - cname += 17; // strip prefix "simgrid::kernel::" - return cname; - } else { - return simcall_names.at(static_cast(simcall.call_)); - } -} - namespace simgrid { namespace simix { diff --git a/src/simix/popping.cpp b/src/simix/popping.cpp index 2e7e046bee..1f7b423ad7 100644 --- a/src/simix/popping.cpp +++ b/src/simix/popping.cpp @@ -10,6 +10,10 @@ #include "src/simix/popping_private.hpp" #include "xbt/log.h" +#if SIMGRID_HAVE_MC +#include "src/mc/mc_forward.hpp" +#endif + XBT_LOG_NEW_DEFAULT_CATEGORY(simix, "transmuting from user request into kernel handlers"); constexpr std::array simcall_names{{ @@ -21,7 +25,6 @@ constexpr std::array simcall_names{{ /** @private * @brief (in kernel mode) unpack the simcall and activate the handler * - * This function is generated from src/simix/simcalls.in */ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered) { @@ -32,12 +35,12 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered) return; switch (simcall_.call_) { case simgrid::simix::Simcall::RUN_KERNEL: - SIMIX_run_kernel(simcall_.code_); + (*simcall_.code_)(); simcall_answer(); break; case simgrid::simix::Simcall::RUN_BLOCKING: - SIMIX_run_blocking(simcall_.code_); + (*simcall_.code_)(); break; case simgrid::simix::Simcall::NONE: @@ -48,20 +51,22 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered) } } -void SIMIX_run_kernel(std::function const* code) +/** @brief returns a printable string representing a simcall */ +const char* SIMIX_simcall_name(const s_smx_simcall& simcall) { - (*code)(); -} + if (simcall.observer_ != nullptr) { +#if SIMGRID_HAVE_MC + if (mc_model_checker != nullptr) // Do not try to use the observer from the MCer + return "(remotely observed)"; +#endif -/** Kernel code for run_blocking - * - * The implementation looks a lot like SIMIX_run_kernel ^^ - * - * However, this `run_blocking` is blocking so the process will not be woken - * up until `ActorImpl::simcall_answer()`` is called by the kernel. - * This means that `code` is responsible for doing this. - */ -void SIMIX_run_blocking(std::function const* code) -{ - (*code)(); + static std::string name; + name = boost::core::demangle(typeid(*simcall.observer_).name()); + const char* cname = name.c_str(); + if (name.rfind("simgrid::kernel::", 0) == 0) + cname += 17; // strip prefix "simgrid::kernel::" + return cname; + } else { + return simcall_names.at(static_cast(simcall.call_)); + } } diff --git a/src/simix/popping_private.hpp b/src/simix/popping_private.hpp index 73ef058847..00b43812ac 100644 --- a/src/simix/popping_private.hpp +++ b/src/simix/popping_private.hpp @@ -22,15 +22,9 @@ enum class Simcall { RUN_BLOCKING, }; constexpr int NUM_SIMCALLS = 3; -/** @brief Simcalls' names */ } // namespace simix } // namespace simgrid -XBT_PUBLIC_DATA const std::array simcall_names; /* Name of each simcall */ - -using simix_match_func_t = bool (*)(void*, void*, simgrid::kernel::activity::CommImpl*); -using simix_copy_data_func_t = void (*)(simgrid::kernel::activity::CommImpl*, void*, size_t); -using simix_clean_func_t = void (*)(void*); /** * @brief Represents a simcall to the kernel. @@ -48,7 +42,5 @@ struct s_smx_simcall { /******************************** General *************************************/ XBT_PRIVATE const char* SIMIX_simcall_name(const s_smx_simcall& simcall); -XBT_PRIVATE void SIMIX_run_kernel(std::function const* code); -XBT_PRIVATE void SIMIX_run_blocking(std::function const* code); #endif -- 2.20.1