Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Further cleanups in simix remains
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 27 Feb 2022 21:51:37 +0000 (22:51 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 27 Feb 2022 21:51:37 +0000 (22:51 +0100)
src/simix/libsmx.cpp
src/simix/popping.cpp
src/simix/popping_private.hpp

index 4650a7e..2cbde14 100644 (file)
 #include <simgrid/Exception.hpp>
 #include <simgrid/s4u/Activity.hpp>
 
-#if SIMGRID_HAVE_MC
-#include "src/mc/mc_forward.hpp"
-#endif
-
 #include <boost/core/demangle.hpp>
 #include <string>
 #include <typeinfo>
@@ -244,7 +240,7 @@ void simcall_run_kernel(std::function<void()> const& code, simgrid::kernel::acto
   simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = observer;
   // The function `code` is called in kernel mode (either because we are already in maestor or after a context switch)
   // and simcall_answer() is called
-  simcall(simgrid::simix::Simcall::RUN_KERNEL, code);
+  simcall(simgrid::simix::Simcall::RUN_ANSWERED, code);
   simgrid::kernel::actor::ActorImpl::self()->simcall_.observer_ = nullptr;
 }
 
index 1f7b423..93544f8 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{{
     "Simcall::NONE",
-    "Simcall::RUN_KERNEL",
+    "Simcall::RUN_ANSWERED",
     "Simcall::RUN_BLOCKING",
 }};
 
@@ -33,32 +29,19 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)
     simcall_.observer_->prepare(times_considered);
   if (context_->wannadie())
     return;
-  switch (simcall_.call_) {
-    case simgrid::simix::Simcall::RUN_KERNEL:
-      (*simcall_.code_)();
-      simcall_answer();
-      break;
 
-    case simgrid::simix::Simcall::RUN_BLOCKING:
-      (*simcall_.code_)();
-      break;
+  xbt_assert(simcall_.call_ != simgrid::simix::Simcall::NONE, "Asked to do the noop syscall on %s@%s", get_cname(),
+             get_host()->get_cname());
 
-    case simgrid::simix::Simcall::NONE:
-      throw std::invalid_argument(
-          simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s", get_cname(), get_host()->get_cname()));
-    default:
-      THROW_IMPOSSIBLE;
-  }
+  (*simcall_.code_)();
+  if (simcall_.call_ == simgrid::simix::Simcall::RUN_ANSWERED)
+    simcall_answer();
 }
 
 /** @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());
index 00b4381..308d3f3 100644 (file)
@@ -18,7 +18,7 @@ namespace simix {
 /** All possible simcalls. */
 enum class Simcall {
   NONE,
-  RUN_KERNEL,
+  RUN_ANSWERED,
   RUN_BLOCKING,
 };
 constexpr int NUM_SIMCALLS = 3;