Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
reduce the visibility of popping_private
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 27 Feb 2022 20:59:11 +0000 (21:59 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 27 Feb 2022 20:59:11 +0000 (21:59 +0100)
src/kernel/activity/SleepImpl.cpp
src/kernel/activity/Synchro.cpp
src/simix/libsmx.cpp
src/simix/popping.cpp
src/simix/popping_private.hpp

index 7a38388..a7c1cea 100644 (file)
@@ -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);
 
index 21dd002..56dc80d 100644 (file)
@@ -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)");
index 16a3681..4650a7e 100644 (file)
@@ -259,26 +259,6 @@ void simcall_run_blocking(std::function<void()> 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<int>(simcall.call_));
-  }
-}
-
 namespace simgrid {
 namespace simix {
 
index 2e7e046..1f7b423 100644 (file)
 #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<const char*, simgrid::simix::NUM_SIMCALLS> simcall_names{{
@@ -21,7 +25,6 @@ constexpr std::array<const char*, simgrid::simix::NUM_SIMCALLS> 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<void()> 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<void()> 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<int>(simcall.call_));
+  }
 }
index 73ef058..00b4381 100644 (file)
@@ -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<const char*, simgrid::simix::NUM_SIMCALLS> 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<void()> const* code);
-XBT_PRIVATE void SIMIX_run_blocking(std::function<void()> const* code);
 
 #endif