Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
convert SIMIX_simcall_answer() into ActorImpl::simcall_answer()
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 9 Aug 2019 10:24:48 +0000 (12:24 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 9 Aug 2019 10:24:48 +0000 (12:24 +0200)
16 files changed:
doc/doxygen/inside_extending.doc
src/kernel/activity/CommImpl.cpp
src/kernel/activity/ExecImpl.cpp
src/kernel/activity/IoImpl.cpp
src/kernel/activity/MutexImpl.cpp
src/kernel/activity/SemaphoreImpl.cpp
src/kernel/activity/SleepImpl.cpp
src/kernel/activity/SynchroRaw.cpp
src/kernel/actor/ActorImpl.cpp
src/kernel/actor/ActorImpl.hpp
src/simix/libsmx.cpp
src/simix/popping.cpp
src/simix/popping_generated.cpp
src/simix/popping_private.hpp
src/simix/simcalls.py
src/simix/smx_global.cpp

index caab368..b47395f 100644 (file)
@@ -143,10 +143,10 @@ The workflow of a simcall is the following:
   - `ActorImpl::simcall_handle` large switch (on simcall) doing for each:
    - `simcall_HANDLER_<name>(simcall, <args>)` (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
+     call `ActorImpl::simcall_answer()` that adds back the issuer
      process to the list of processes to run in the next scheduling round.
      It is thus the responsability of the blocking simcalls to call
-     `SIMIX_simcall_answer(simcall)` themselves in their handler.
+     `ActorImpl::simcall_answer()` themselves in their handler.
 
 Note that empty HANDLERs can be omitted. These functions usually do
 some parameter checking, or retrieve some information about the
index 86bdff9..3a3982d 100644 (file)
@@ -242,7 +242,7 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity:
     comm->simcalls_.push_back(simcall);
     comm->finish();
   } else {
-    SIMIX_simcall_answer(simcall);
+    simcall->issuer->simcall_answer();
   }
 }
 
@@ -255,7 +255,7 @@ void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activi
   if (MC_is_active() || MC_record_replay_is_active()) {
     int idx = SIMCALL_GET_MC_VALUE(*simcall);
     if (idx == -1) {
-      SIMIX_simcall_answer(simcall);
+      simcall->issuer->simcall_answer();
     } else {
       simgrid::kernel::activity::CommImpl* comm = comms[idx];
       simcall_comm_testany__set__result(simcall, idx);
@@ -275,7 +275,7 @@ void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activi
       return;
     }
   }
-  SIMIX_simcall_answer(simcall);
+  simcall->issuer->simcall_answer();
 }
 
 static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall)
@@ -312,7 +312,7 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activi
     simcall->timer = simgrid::simix::Timer::set(SIMIX_get_clock() + timeout, [simcall]() {
       SIMIX_waitany_remove_simcall_from_actions(simcall);
       simcall_comm_waitany__set__result(simcall, -1);
-      SIMIX_simcall_answer(simcall);
+      simcall->issuer->simcall_answer();
     });
   }
 
@@ -712,7 +712,7 @@ void CommImpl::finish()
     }
 
     if (simcall->issuer->get_host()->is_on())
-      SIMIX_simcall_answer(simcall);
+      simcall->issuer->simcall_answer();
     else
       simcall->issuer->context_->iwannadie = true;
   }
index b7ed243..2558315 100644 (file)
@@ -43,7 +43,7 @@ void simcall_HANDLER_execution_test(smx_simcall_t simcall, simgrid::kernel::acti
     synchro->simcalls_.push_back(simcall);
     synchro->finish();
   } else {
-    SIMIX_simcall_answer(simcall);
+    simcall->issuer->simcall_answer();
   }
   simcall_execution_test__set__result(simcall, res);
 }
@@ -63,7 +63,7 @@ void simcall_HANDLER_execution_waitany_for(smx_simcall_t simcall, simgrid::kerne
           exec->simcalls_.erase(j);
       }
       simcall_execution_waitany_for__set__result(simcall, -1);
-      SIMIX_simcall_answer(simcall);
+      simcall->issuer->simcall_answer();
     });
   }
 
@@ -279,7 +279,7 @@ void ExecImpl::finish()
     simcall->issuer->waiting_synchro = nullptr;
     /* Fail the process if the host is down */
     if (simcall->issuer->get_host()->is_on())
-      SIMIX_simcall_answer(simcall);
+      simcall->issuer->simcall_answer();
     else
       simcall->issuer->context_->iwannadie = true;
   }
index b7c10da..a4c845b 100644 (file)
@@ -100,7 +100,7 @@ void IoImpl::finish()
     }
 
     simcall->issuer->waiting_synchro = nullptr;
-    SIMIX_simcall_answer(simcall);
+    simcall->issuer->simcall_answer();
   }
 }
 
index 25a0c77..7d528fa 100644 (file)
@@ -30,7 +30,7 @@ void MutexImpl::lock(actor::ActorImpl* issuer)
     /* mutex free */
     locked_ = true;
     owner_  = issuer;
-    SIMIX_simcall_answer(&issuer->simcall);
+    issuer->simcall_answer();
   }
   XBT_OUT();
 }
@@ -68,12 +68,12 @@ void MutexImpl::unlock(actor::ActorImpl* issuer)
              owner_->get_cname(), owner_->get_pid());
 
   if (not sleeping_.empty()) {
-    /*process to wake up */
-    actor::ActorImpl* p = &sleeping_.front();
+    /* pick one actor to wake up */
+    actor::ActorImpl* act = &sleeping_.front();
     sleeping_.pop_front();
-    p->waiting_synchro = nullptr;
-    owner_             = p;
-    SIMIX_simcall_answer(&p->simcall);
+    act->waiting_synchro = nullptr;
+    owner_             = act;
+    act->simcall_answer();
   } else {
     /* nobody to wake up */
     locked_ = false;
index 66e9900..05dc8d7 100644 (file)
@@ -25,7 +25,7 @@ void SemaphoreImpl::acquire(actor::ActorImpl* issuer, double timeout)
     sleeping_.push_back(*issuer);
   } else {
     value_--;
-    SIMIX_simcall_answer(&issuer->simcall);
+    issuer->simcall_answer();
   }
 }
 void SemaphoreImpl::release()
@@ -36,7 +36,7 @@ void SemaphoreImpl::release()
     auto& actor = sleeping_.front();
     sleeping_.pop_front();
     actor.waiting_synchro = nullptr;
-    SIMIX_simcall_answer(&actor.simcall);
+    actor.simcall_answer();
   } else {
     value_++;
   }
index 055d596..90d88e9 100644 (file)
@@ -64,7 +64,7 @@ void SleepImpl::finish()
       simcall->issuer->suspended_ = false;
       simcall_HANDLER_process_suspend(simcall, simcall->issuer);
     } else {
-      SIMIX_simcall_answer(simcall);
+      simcall->issuer->simcall_answer();
     }
   }
 
index facb9d0..b98ab92 100644 (file)
@@ -105,7 +105,7 @@ void RawImpl::finish()
       THROW_IMPOSSIBLE;
   }
   simcall->issuer->waiting_synchro = nullptr;
-  SIMIX_simcall_answer(simcall);
+  simcall->issuer->simcall_answer();
 }
 
 } // namespace activity
index c943038..1919779 100644 (file)
@@ -440,6 +440,20 @@ void ActorImpl::throw_exception(std::exception_ptr e)
   }
 }
 
+void ActorImpl::simcall_answer()
+{
+  if (this != simix_global->maestro_process){
+    XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall.call), (int)simcall.call,
+              get_cname(), this);
+    simcall.call = SIMCALL_NONE;
+    xbt_assert(not XBT_LOG_ISENABLED(simix_process, xbt_log_priority_debug) ||
+                   std::find(begin(simix_global->actors_to_run), end(simix_global->actors_to_run), this) ==
+                       end(simix_global->actors_to_run),
+               "Actor %p should not exist in actors_to_run!", this);
+    simix_global->actors_to_run.push_back(this);
+  }
+}
+
 void ActorImpl::set_host(s4u::Host* dest)
 {
   xbt::intrusive_erase(host_->pimpl_->process_list_, *this);
@@ -545,7 +559,7 @@ void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t actor)
   smx_activity_t sync_suspend = actor->suspend(simcall->issuer);
 
   if (actor != simcall->issuer) {
-    SIMIX_simcall_answer(simcall);
+    simcall->issuer->simcall_answer();
   } else {
     sync_suspend->simcalls_.push_back(simcall);
     actor->waiting_synchro = sync_suspend;
@@ -586,15 +600,15 @@ const char* SIMIX_process_self_get_name()
   return process->get_cname();
 }
 
-void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout)
+void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t actor, double timeout)
 {
-  if (process->finished_) {
+  if (actor->finished_) {
     // The joined process is already finished, just wake up the issuer process right away
     simcall_process_sleep__set__result(simcall, SIMIX_DONE);
-    SIMIX_simcall_answer(simcall);
+    simcall->issuer->simcall_answer();
     return;
   }
-  smx_activity_t sync = simcall->issuer->join(process, timeout);
+  smx_activity_t sync = simcall->issuer->join(actor, timeout);
   sync->simcalls_.push_back(simcall);
   simcall->issuer->waiting_synchro = sync;
 }
@@ -604,7 +618,7 @@ void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration)
   if (MC_is_active() || MC_record_replay_is_active()) {
     MC_process_clock_add(simcall->issuer, duration);
     simcall_process_sleep__set__result(simcall, SIMIX_DONE);
-    SIMIX_simcall_answer(simcall);
+    simcall->issuer->simcall_answer();
     return;
   }
   smx_activity_t sync = simcall->issuer->sleep(duration);
index 54a67c6..2713a56 100644 (file)
@@ -132,6 +132,8 @@ public:
 
   /** execute the pending simcall -- must be called from the maestro context */
   void simcall_handle(int value);
+  /** Terminates a simcall currently executed in maestro context */
+  void simcall_answer();
 };
 
 class ProcessArg {
index e1b7856..402c6a7 100644 (file)
@@ -347,10 +347,10 @@ const char *SIMIX_simcall_name(e_smx_simcall_t kind) {
 namespace simgrid {
 namespace simix {
 
-void unblock(smx_actor_t process)
+void unblock(smx_actor_t actor)
 {
   xbt_assert(SIMIX_is_maestro());
-  SIMIX_simcall_answer(&process->simcall);
+  actor->simcall_answer();
 }
 } // namespace simix
 } // namespace simgrid
index 21a1331..8babbe6 100644 (file)
@@ -8,20 +8,6 @@
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_popping, simix,
                                 "Popping part of SIMIX (transmuting from user request into kernel handlers)");
 
-void SIMIX_simcall_answer(smx_simcall_t simcall)
-{
-  if (simcall->issuer != simix_global->maestro_process){
-    XBT_DEBUG("Answer simcall %s (%d) issued by %s (%p)", SIMIX_simcall_name(simcall->call), (int)simcall->call,
-              simcall->issuer->get_cname(), simcall->issuer);
-    simcall->issuer->simcall.call = SIMCALL_NONE;
-    xbt_assert(not XBT_LOG_ISENABLED(simix_popping, xbt_log_priority_debug) ||
-                   std::find(begin(simix_global->actors_to_run), end(simix_global->actors_to_run), simcall->issuer) ==
-                       end(simix_global->actors_to_run),
-               "Actor %p should not exist in actors_to_run!", simcall->issuer);
-    simix_global->actors_to_run.push_back(simcall->issuer);
-  }
-}
-
 void SIMIX_run_kernel(std::function<void()> const* code)
 {
   (*code)();
@@ -32,7 +18,7 @@ void SIMIX_run_kernel(std::function<void()> const* code)
  * The implementation looks a lot like SIMIX_run_kernel ^^
  *
  * However, this `run_blocking` is blocking so the process will not be woken
- * up until `SIMIX_simcall_answer(simcall)`` is called by the kernel.
+ * 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)
index 2d14457..a4cc938 100644 (file)
@@ -58,8 +58,7 @@ const char* simcall_names[] = {
  *
  * This function is generated from src/simix/simcalls.in
  */
-void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
-{
+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 (context_->iwannadie)
@@ -70,8 +69,7 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
       break;
 
     case SIMCALL_PROCESS_JOIN:
-      simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
-                                   simgrid::simix::unmarshal<double>(simcall.args[1]));
+      simcall_HANDLER_process_join(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
       break;
 
     case SIMCALL_PROCESS_SLEEP:
@@ -79,95 +77,49 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
       break;
 
     case SIMCALL_EXECUTION_WAIT:
-      simcall_HANDLER_execution_wait(&simcall,
-                                     simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
+      simcall_HANDLER_execution_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
       break;
 
     case SIMCALL_EXECUTION_WAITANY_FOR:
-      simcall_HANDLER_execution_waitany_for(
-          &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args[0]),
-          simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
+      simcall_HANDLER_execution_waitany_for(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl**>(simcall.args[0]), simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
       break;
 
     case SIMCALL_EXECUTION_TEST:
-      simcall_HANDLER_execution_test(&simcall,
-                                     simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
+      simcall_HANDLER_execution_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::ExecImpl*>(simcall.args[0]));
       break;
 
     case SIMCALL_COMM_SEND:
-      simcall_HANDLER_comm_send(
-          &simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
-          simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]),
-          simgrid::simix::unmarshal<double>(simcall.args[3]),
-          simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]),
-          simgrid::simix::unmarshal<size_t>(simcall.args[5]),
-          simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]),
-          simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[7]),
-          simgrid::simix::unmarshal<void*>(simcall.args[8]), simgrid::simix::unmarshal<double>(simcall.args[9]));
+      simcall_HANDLER_comm_send(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]), simgrid::simix::unmarshal<double>(simcall.args[3]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]), simgrid::simix::unmarshal<size_t>(simcall.args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[7]), simgrid::simix::unmarshal<void*>(simcall.args[8]), simgrid::simix::unmarshal<double>(simcall.args[9]));
       break;
 
     case SIMCALL_COMM_ISEND:
-      simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
-          simcall.result, simcall_HANDLER_comm_isend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
-                                                     simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
-                                                     simgrid::simix::unmarshal<double>(simcall.args[2]),
-                                                     simgrid::simix::unmarshal<double>(simcall.args[3]),
-                                                     simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]),
-                                                     simgrid::simix::unmarshal<size_t>(simcall.args[5]),
-                                                     simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]),
-                                                     simgrid::simix::unmarshal<simix_clean_func_t>(simcall.args[7]),
-                                                     simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[8]),
-                                                     simgrid::simix::unmarshal<void*>(simcall.args[9]),
-                                                     simgrid::simix::unmarshal<bool>(simcall.args[10])));
-      SIMIX_simcall_answer(&simcall);
+      simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall.result, simcall_HANDLER_comm_isend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]), simgrid::simix::unmarshal<double>(simcall.args[3]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[4]), simgrid::simix::unmarshal<size_t>(simcall.args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[6]), simgrid::simix::unmarshal<simix_clean_func_t>(simcall.args[7]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[8]), simgrid::simix::unmarshal<void*>(simcall.args[9]), simgrid::simix::unmarshal<bool>(simcall.args[10])));
+      simcall_answer();
       break;
 
     case SIMCALL_COMM_RECV:
-      simcall_HANDLER_comm_recv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
-                                simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
-                                simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]),
-                                simgrid::simix::unmarshal<size_t*>(simcall.args[3]),
-                                simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]),
-                                simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]),
-                                simgrid::simix::unmarshal<void*>(simcall.args[6]),
-                                simgrid::simix::unmarshal<double>(simcall.args[7]),
-                                simgrid::simix::unmarshal<double>(simcall.args[8]));
+      simcall_HANDLER_comm_recv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]), simgrid::simix::unmarshal<size_t*>(simcall.args[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]), simgrid::simix::unmarshal<void*>(simcall.args[6]), simgrid::simix::unmarshal<double>(simcall.args[7]), simgrid::simix::unmarshal<double>(simcall.args[8]));
       break;
 
     case SIMCALL_COMM_IRECV:
-      simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(
-          simcall.result, simcall_HANDLER_comm_irecv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]),
-                                                     simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]),
-                                                     simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]),
-                                                     simgrid::simix::unmarshal<size_t*>(simcall.args[3]),
-                                                     simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]),
-                                                     simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]),
-                                                     simgrid::simix::unmarshal<void*>(simcall.args[6]),
-                                                     simgrid::simix::unmarshal<double>(simcall.args[7])));
-      SIMIX_simcall_answer(&simcall);
+      simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall.result, simcall_HANDLER_comm_irecv(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall.args[1]), simgrid::simix::unmarshal<unsigned char*>(simcall.args[2]), simgrid::simix::unmarshal<size_t*>(simcall.args[3]), simgrid::simix::unmarshal<simix_match_func_t>(simcall.args[4]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall.args[5]), simgrid::simix::unmarshal<void*>(simcall.args[6]), simgrid::simix::unmarshal<double>(simcall.args[7])));
+      simcall_answer();
       break;
 
     case SIMCALL_COMM_WAITANY:
-      simcall_HANDLER_comm_waitany(
-          &simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]),
-          simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
+      simcall_HANDLER_comm_waitany(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]), simgrid::simix::unmarshal<size_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
       break;
 
     case SIMCALL_COMM_WAIT:
-      simcall_HANDLER_comm_wait(&simcall,
-                                simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]),
-                                simgrid::simix::unmarshal<double>(simcall.args[1]));
+      simcall_HANDLER_comm_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
       break;
 
     case SIMCALL_COMM_TEST:
-      simcall_HANDLER_comm_test(&simcall,
-                                simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]));
+      simcall_HANDLER_comm_test(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall.args[0]));
       break;
 
     case SIMCALL_COMM_TESTANY:
-      simcall_HANDLER_comm_testany(&simcall,
-                                   simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]),
-                                   simgrid::simix::unmarshal<size_t>(simcall.args[1]));
+      simcall_HANDLER_comm_testany(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl**>(simcall.args[0]), simgrid::simix::unmarshal<size_t>(simcall.args[1]));
       break;
 
     case SIMCALL_MUTEX_LOCK:
@@ -175,26 +127,21 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
       break;
 
     case SIMCALL_MUTEX_TRYLOCK:
-      simgrid::simix::marshal<int>(
-          simcall.result,
-          simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0])));
-      SIMIX_simcall_answer(&simcall);
+      simgrid::simix::marshal<int>(simcall.result, simcall_HANDLER_mutex_trylock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0])));
+      simcall_answer();
       break;
 
     case SIMCALL_MUTEX_UNLOCK:
       simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
-      SIMIX_simcall_answer(&simcall);
+      simcall_answer();
       break;
 
     case SIMCALL_COND_WAIT:
-      simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]),
-                                simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]));
+      simcall_HANDLER_cond_wait(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]));
       break;
 
     case SIMCALL_COND_WAIT_TIMEOUT:
-      simcall_HANDLER_cond_wait_timeout(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]),
-                                        simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]),
-                                        simgrid::simix::unmarshal<double>(simcall.args[2]));
+      simcall_HANDLER_cond_wait_timeout(&simcall, simgrid::simix::unmarshal<smx_cond_t>(simcall.args[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[1]), simgrid::simix::unmarshal<double>(simcall.args[2]));
       break;
 
     case SIMCALL_SEM_ACQUIRE:
@@ -202,8 +149,7 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
       break;
 
     case SIMCALL_SEM_ACQUIRE_TIMEOUT:
-      simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]),
-                                          simgrid::simix::unmarshal<double>(simcall.args[1]));
+      simcall_HANDLER_sem_acquire_timeout(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]), simgrid::simix::unmarshal<double>(simcall.args[1]));
       break;
 
     case SIMCALL_IO_WAIT:
@@ -211,15 +157,13 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
       break;
 
     case SIMCALL_MC_RANDOM:
-      simgrid::simix::marshal<int>(simcall.result,
-                                   simcall_HANDLER_mc_random(&simcall, simgrid::simix::unmarshal<int>(simcall.args[0]),
-                                                             simgrid::simix::unmarshal<int>(simcall.args[1])));
-      SIMIX_simcall_answer(&simcall);
+      simgrid::simix::marshal<int>(simcall.result, simcall_HANDLER_mc_random(&simcall, simgrid::simix::unmarshal<int>(simcall.args[0]), simgrid::simix::unmarshal<int>(simcall.args[1])));
+      simcall_answer();
       break;
 
     case SIMCALL_RUN_KERNEL:
       SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
-      SIMIX_simcall_answer(&simcall);
+      simcall_answer();
       break;
 
     case SIMCALL_RUN_BLOCKING:
@@ -229,7 +173,8 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int value)
     case NUM_SIMCALLS:
       break;
     case SIMCALL_NONE:
-      throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s", get_cname(),
+      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;
index f537d90..476c871 100644 (file)
@@ -56,7 +56,6 @@ struct s_smx_simcall {
 
 /******************************** General *************************************/
 
-XBT_PRIVATE void SIMIX_simcall_answer(smx_simcall_t simcall);
 XBT_PRIVATE const char* SIMIX_simcall_name(e_smx_simcall_t kind);
 XBT_PRIVATE void SIMIX_run_kernel(std::function<void()> const* code);
 XBT_PRIVATE void SIMIX_run_blocking(std::function<void()> const* code);
index c1f89bc..9fecf1e 100755 (executable)
@@ -144,7 +144,7 @@ class Simcall(object):
         else:
             res.append(indent + "  " + call + ";")
         if self.call_kind != 'Blck':
-            res.append(indent + '  SIMIX_simcall_answer(&simcall);')
+            res.append(indent + '  simcall_answer();')
         res.append(indent + '  break;')
         res.append('')
         return '\n'.join(res)
index 5109eec..2662eba 100644 (file)
@@ -426,7 +426,7 @@ void SIMIX_run()
        *        - If a process is added because it's getting killed, its subsequent actions shouldn't matter
        *        - If a process gets added to actors_to_run because one of their blocking action constituting the meat
        *          of a simcall terminates, we're still good. Proof:
-       *          - You are added from SIMIX_simcall_answer() only. When this function is called depends on the resource
+       *          - You are added from ActorImpl::simcall_answer() only. When this function is called depends on the resource
        *            kind (network, cpu, disk, whatever), but the same arguments hold. Let's take communications as an
        *            example.
        *          - For communications, this function is called from SIMIX_comm_finish().