Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change SIMIX_simcall_handle() into ActorImpl::simcall_handle()
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Thu, 8 Aug 2019 21:20:44 +0000 (23:20 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 9 Aug 2019 09:14:19 +0000 (11:14 +0200)
13 files changed:
doc/doxygen/inside_extending.doc
include/simgrid/kernel/future.hpp
src/kernel/activity/CommImpl.cpp
src/kernel/actor/ActorImpl.hpp
src/mc/inspect/ObjectInformation.cpp
src/mc/mc_base.cpp
src/mc/mc_record.cpp
src/mc/remote/Client.cpp
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/popping_private.hpp
src/simix/simcalls.py
src/simix/smx_global.cpp

index dc0c51e..caab368 100644 (file)
@@ -140,7 +140,7 @@ The workflow of a simcall is the following:
   - If maestro, executes the simcall directly (and return)
   - If not, call `ActorImpl::yield` to give back the control to maestro
   - ========== KERNEL MODE ==========
   - If maestro, executes the simcall directly (and return)
   - If not, call `ActorImpl::yield` to give back the control to maestro
   - ========== KERNEL MODE ==========
-  - `SIMIX_simcall_handle` large switch (on simcall) doing for each:
+  - `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
    - `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
index fea70d4..e5873bd 100644 (file)
@@ -74,7 +74,7 @@ public:
       schedule(std::move(continuation));
       break;
     case FutureStatus::not_ready:
       schedule(std::move(continuation));
       break;
     case FutureStatus::not_ready:
-      // The future is not ready so we mast keep the continuation for
+      // The future is not ready so we must keep the continuation for
       // executing it later:
       continuation_ = std::move(continuation);
       break;
       // executing it later:
       continuation_ = std::move(continuation);
       break;
index 8d6c7e3..86bdff9 100644 (file)
@@ -26,7 +26,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sr
 {
   smx_activity_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate, src_buff, src_buff_size,
                                                    match_fun, nullptr, copy_data_fun, data, 0);
 {
   smx_activity_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate, src_buff, src_buff_size,
                                                    match_fun, nullptr, copy_data_fun, data, 0);
-  SIMCALL_SET_MC_VALUE(simcall, 0);
+  SIMCALL_SET_MC_VALUE(*simcall, 0);
   simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
 }
 
   simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
 }
 
@@ -104,7 +104,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t re
 {
   smx_activity_t comm = simcall_HANDLER_comm_irecv(simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun,
                                                    copy_data_fun, data, rate);
 {
   smx_activity_t comm = simcall_HANDLER_comm_irecv(simcall, receiver, mbox, dst_buff, dst_buff_size, match_fun,
                                                    copy_data_fun, data, rate);
-  SIMCALL_SET_MC_VALUE(simcall, 0);
+  SIMCALL_SET_MC_VALUE(*simcall, 0);
   simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
 }
 
   simcall_HANDLER_comm_wait(simcall, static_cast<simgrid::kernel::activity::CommImpl*>(comm.get()), timeout);
 }
 
@@ -191,7 +191,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity:
   comm->register_simcall(simcall);
 
   if (MC_is_active() || MC_record_replay_is_active()) {
   comm->register_simcall(simcall);
 
   if (MC_is_active() || MC_record_replay_is_active()) {
-    int idx = SIMCALL_GET_MC_VALUE(simcall);
+    int idx = SIMCALL_GET_MC_VALUE(*simcall);
     if (idx == 0) {
       comm->state_ = SIMIX_DONE;
     } else {
     if (idx == 0) {
       comm->state_ = SIMIX_DONE;
     } else {
@@ -253,7 +253,7 @@ void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activi
   simcall_comm_testany__set__result(simcall, -1);
 
   if (MC_is_active() || MC_record_replay_is_active()) {
   simcall_comm_testany__set__result(simcall, -1);
 
   if (MC_is_active() || MC_record_replay_is_active()) {
-    int idx = SIMCALL_GET_MC_VALUE(simcall);
+    int idx = SIMCALL_GET_MC_VALUE(*simcall);
     if (idx == -1) {
       SIMIX_simcall_answer(simcall);
     } else {
     if (idx == -1) {
       SIMIX_simcall_answer(simcall);
     } else {
@@ -297,7 +297,7 @@ void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activi
   if (MC_is_active() || MC_record_replay_is_active()) {
     if (timeout > 0.0)
       xbt_die("Timeout not implemented for waitany in the model-checker");
   if (MC_is_active() || MC_record_replay_is_active()) {
     if (timeout > 0.0)
       xbt_die("Timeout not implemented for waitany in the model-checker");
-    int idx                 = SIMCALL_GET_MC_VALUE(simcall);
+    int idx                 = SIMCALL_GET_MC_VALUE(*simcall);
     auto* comm              = comms[idx];
     comm->simcalls_.push_back(simcall);
     simcall_comm_waitany__set__result(simcall, idx);
     auto* comm              = comms[idx];
     comm->simcalls_.push_back(simcall);
     simcall_comm_waitany__set__result(simcall, idx);
index acf8f24..54a67c6 100644 (file)
@@ -129,6 +129,9 @@ public:
   activity::ActivityImplPtr sleep(double duration);
   /** Ask the actor to throw an exception right away */
   void throw_exception(std::exception_ptr e);
   activity::ActivityImplPtr sleep(double duration);
   /** Ask the actor to throw an exception right away */
   void throw_exception(std::exception_ptr e);
+
+  /** execute the pending simcall -- must be called from the maestro context */
+  void simcall_handle(int value);
 };
 
 class ProcessArg {
 };
 
 class ProcessArg {
index 75b39d4..64adf52 100644 (file)
@@ -83,9 +83,10 @@ simgrid::mc::Frame* ObjectInformation::find_function(const void* ip) const
 
 const simgrid::mc::Variable* ObjectInformation::find_variable(const char* name) const
 {
 
 const simgrid::mc::Variable* ObjectInformation::find_variable(const char* name) const
 {
-  for (simgrid::mc::Variable const& variable : this->global_variables)
+  for (simgrid::mc::Variable const& variable : this->global_variables) {
     if (variable.name == name)
       return &variable;
     if (variable.name == name)
       return &variable;
+  }
   return nullptr;
 }
 
   return nullptr;
 }
 
index 76b2721..413e9a7 100644 (file)
@@ -43,7 +43,7 @@ void wait_for_requests()
     for (smx_actor_t const& process : simix_global->actors_that_ran) {
       smx_simcall_t req = &process->simcall;
       if (req->call != SIMCALL_NONE && not simgrid::mc::request_is_visible(req))
     for (smx_actor_t const& process : simix_global->actors_that_ran) {
       smx_simcall_t req = &process->simcall;
       if (req->call != SIMCALL_NONE && not simgrid::mc::request_is_visible(req))
-        SIMIX_simcall_handle(req, 0);
+        process->simcall_handle(0);
     }
   }
 #if SIMGRID_HAVE_MC
     }
   }
 #if SIMGRID_HAVE_MC
index 685c491..224eed8 100644 (file)
@@ -41,7 +41,7 @@ void replay(RecordTrace const& trace)
       xbt_die("Unexpected simcall.");
 
     // Execute the request:
       xbt_die("Unexpected simcall.");
 
     // Execute the request:
-    SIMIX_simcall_handle(simcall, transition.argument);
+    simcall->issuer->simcall_handle(transition.argument);
     simgrid::mc::wait_for_requests();
   }
 }
     simgrid::mc::wait_for_requests();
   }
 }
index 4e77404..06916a4 100644 (file)
@@ -97,7 +97,7 @@ void Client::handle_simcall(s_mc_message_simcall_handle_t* message)
   smx_actor_t process = SIMIX_process_from_PID(message->pid);
   if (not process)
     xbt_die("Invalid pid %lu", (unsigned long)message->pid);
   smx_actor_t process = SIMIX_process_from_PID(message->pid);
   if (not process)
     xbt_die("Invalid pid %lu", (unsigned long)message->pid);
-  SIMIX_simcall_handle(&process->simcall, message->value);
+  process->simcall_handle(message->value);
   if (channel_.send(MC_MESSAGE_WAITING))
     xbt_die("Could not send MESSAGE_WAITING to model-checker");
 }
   if (channel_.send(MC_MESSAGE_WAITING))
     xbt_die("Could not send MESSAGE_WAITING to model-checker");
 }
index f3af8b7..3539455 100644 (file)
@@ -34,7 +34,7 @@ inline static R simcall(e_smx_simcall_t call, T const&... t)
               (int)self->simcall.call);
     self->yield();
   } else {
               (int)self->simcall.call);
     self->yield();
   } else {
-    SIMIX_simcall_handle(&self->simcall, 0);
+    self->simcall_handle(0);
   }
   return simgrid::simix::unmarshal<R>(self->simcall.result);
 }
   }
   return simgrid::simix::unmarshal<R>(self->simcall.result);
 }
index 98f51cf..2d14457 100644 (file)
@@ -58,124 +58,179 @@ const char* simcall_names[] = {
  *
  * This function is generated from src/simix/simcalls.in
  */
  *
  * This function is generated from src/simix/simcalls.in
  */
-void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
-  XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));
+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);
   SIMCALL_SET_MC_VALUE(simcall, value);
-  if (simcall->issuer->context_->iwannadie)
+  if (context_->iwannadie)
     return;
     return;
-  switch (simcall->call) {
+  switch (simcall.call) {
     case SIMCALL_PROCESS_SUSPEND:
     case SIMCALL_PROCESS_SUSPEND:
-      simcall_HANDLER_process_suspend(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
+      simcall_HANDLER_process_suspend(&simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall.args[0]));
       break;
 
     case SIMCALL_PROCESS_JOIN:
       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:
       break;
 
     case SIMCALL_PROCESS_SLEEP:
-      simcall_HANDLER_process_sleep(simcall, simgrid::simix::unmarshal<double>(simcall->args[0]));
+      simcall_HANDLER_process_sleep(&simcall, simgrid::simix::unmarshal<double>(simcall.args[0]));
       break;
 
     case SIMCALL_EXECUTION_WAIT:
       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:
       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:
       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:
       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:
       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])));
+      SIMIX_simcall_answer(&simcall);
       break;
 
     case SIMCALL_COMM_RECV:
       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:
       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])));
+      SIMIX_simcall_answer(&simcall);
       break;
 
     case SIMCALL_COMM_WAITANY:
       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:
       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:
       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:
       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:
       break;
 
     case SIMCALL_MUTEX_LOCK:
-      simcall_HANDLER_mutex_lock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
+      simcall_HANDLER_mutex_lock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
       break;
 
     case SIMCALL_MUTEX_TRYLOCK:
       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])));
+      SIMIX_simcall_answer(&simcall);
       break;
 
     case SIMCALL_MUTEX_UNLOCK:
       break;
 
     case SIMCALL_MUTEX_UNLOCK:
-      simcall_HANDLER_mutex_unlock(simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall->args[0]));
-      SIMIX_simcall_answer(simcall);
+      simcall_HANDLER_mutex_unlock(&simcall, simgrid::simix::unmarshal<smx_mutex_t>(simcall.args[0]));
+      SIMIX_simcall_answer(&simcall);
       break;
 
     case SIMCALL_COND_WAIT:
       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:
       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:
       break;
 
     case SIMCALL_SEM_ACQUIRE:
-      simcall_HANDLER_sem_acquire(simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall->args[0]));
+      simcall_HANDLER_sem_acquire(&simcall, simgrid::simix::unmarshal<smx_sem_t>(simcall.args[0]));
       break;
 
     case SIMCALL_SEM_ACQUIRE_TIMEOUT:
       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:
       break;
 
     case SIMCALL_IO_WAIT:
-      simcall_HANDLER_io_wait(simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::IoImpl*>(simcall->args[0]));
+      simcall_HANDLER_io_wait(&simcall, simgrid::simix::unmarshal<simgrid::kernel::activity::IoImpl*>(simcall.args[0]));
       break;
 
     case SIMCALL_MC_RANDOM:
       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])));
+      SIMIX_simcall_answer(&simcall);
       break;
 
     case SIMCALL_RUN_KERNEL:
       break;
 
     case SIMCALL_RUN_KERNEL:
-      SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
-      SIMIX_simcall_answer(simcall);
+      SIMIX_run_kernel(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
+      SIMIX_simcall_answer(&simcall);
       break;
 
     case SIMCALL_RUN_BLOCKING:
       break;
 
     case SIMCALL_RUN_BLOCKING:
-      SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall->args[0]));
+      SIMIX_run_blocking(simgrid::simix::unmarshal<std::function<void()> const*>(simcall.args[0]));
       break;
 
     case NUM_SIMCALLS:
       break;
     case SIMCALL_NONE:
       break;
 
     case NUM_SIMCALLS:
       break;
     case SIMCALL_NONE:
-      throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",
-                                                              simcall->issuer->get_cname(),
-                                                              sg_host_get_name(simcall->issuer->get_host())));
+      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;
   }
     default:
       THROW_IMPOSSIBLE;
   }
index e2fec6d..f537d90 100644 (file)
@@ -51,13 +51,12 @@ struct s_smx_simcall {
   u_smx_scalar result;
 };
 
   u_smx_scalar result;
 };
 
-#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall)->mc_value = (value))
-#define SIMCALL_GET_MC_VALUE(simcall) ((simcall)->mc_value)
+#define SIMCALL_SET_MC_VALUE(simcall, value) ((simcall).mc_value = (value))
+#define SIMCALL_GET_MC_VALUE(simcall) ((simcall).mc_value)
 
 /******************************** General *************************************/
 
 XBT_PRIVATE void SIMIX_simcall_answer(smx_simcall_t simcall);
 
 /******************************** General *************************************/
 
 XBT_PRIVATE void SIMIX_simcall_answer(smx_simcall_t simcall);
-XBT_PRIVATE void SIMIX_simcall_handle(smx_simcall_t simcall, int value);
 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);
 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 80fa197..c1f89bc 100755 (executable)
@@ -130,21 +130,21 @@ class Simcall(object):
     def case(self):
         res = []
         indent = '    '
     def case(self):
         res = []
         indent = '    '
-        args = ["simgrid::simix::unmarshal<%s>(simcall->args[%d])" % (arg.rettype(), i)
+        args = ["simgrid::simix::unmarshal<%s>(simcall.args[%d])" % (arg.rettype(), i)
                 for i, arg in enumerate(self.args)]
         res.append(indent + 'case SIMCALL_%s:' % (self.name.upper()))
         if self.need_handler:
                 for i, arg in enumerate(self.args)]
         res.append(indent + 'case SIMCALL_%s:' % (self.name.upper()))
         if self.need_handler:
-            call = "simcall_HANDLER_%s(simcall%s%s)" % (self.name,
+            call = "simcall_HANDLER_%s(&simcall%s%s)" % (self.name,
                                                         ", " if len(args) > 0 else "",
                                                         ', '.join(args))
         else:
             call = "SIMIX_%s(%s)" % (self.name, ', '.join(args))
         if self.call_kind == 'Func':
                                                         ", " if len(args) > 0 else "",
                                                         ', '.join(args))
         else:
             call = "SIMIX_%s(%s)" % (self.name, ', '.join(args))
         if self.call_kind == 'Func':
-            res.append(indent + "  simgrid::simix::marshal<%s>(simcall->result, %s);" % (self.res.rettype(), call))
+            res.append(indent + "  simgrid::simix::marshal<%s>(simcall.result, %s);" % (self.res.rettype(), call))
         else:
             res.append(indent + "  " + call + ";")
         if self.call_kind != 'Blck':
         else:
             res.append(indent + "  " + call + ";")
         if self.call_kind != 'Blck':
-            res.append(indent + '  SIMIX_simcall_answer(simcall);')
+            res.append(indent + '  SIMIX_simcall_answer(&simcall);')
         res.append(indent + '  break;')
         res.append('')
         return '\n'.join(res)
         res.append(indent + '  break;')
         res.append('')
         return '\n'.join(res)
@@ -340,14 +340,14 @@ if __name__ == '__main__':
     fd.write(' * This function is generated from src/simix/simcalls.in\n')
     fd.write(' */\n')
     fd.write(
     fd.write(' * This function is generated from src/simix/simcalls.in\n')
     fd.write(' */\n')
     fd.write(
-        'void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {\n')
+        'void simgrid::kernel::actor::ActorImpl::simcall_handle(int value) {\n')
     fd.write(
     fd.write(
-        '  XBT_DEBUG("Handling simcall %p: %s", simcall, SIMIX_simcall_name(simcall->call));\n')
+        '  XBT_DEBUG("Handling simcall %p: %s", &simcall, SIMIX_simcall_name(simcall.call));\n')
     fd.write('  SIMCALL_SET_MC_VALUE(simcall, value);\n')
     fd.write(
     fd.write('  SIMCALL_SET_MC_VALUE(simcall, value);\n')
     fd.write(
-        '  if (simcall->issuer->context_->iwannadie)\n')
+        '  if (context_->iwannadie)\n')
     fd.write('    return;\n')
     fd.write('    return;\n')
-    fd.write('  switch (simcall->call) {\n')
+    fd.write('  switch (simcall.call) {\n')
 
     handle(fd, Simcall.case, simcalls, simcalls_dict)
 
 
     handle(fd, Simcall.case, simcalls, simcalls_dict)
 
@@ -355,8 +355,8 @@ if __name__ == '__main__':
     fd.write('      break;\n')
     fd.write('    case SIMCALL_NONE:\n')
     fd.write('      throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",\n')
     fd.write('      break;\n')
     fd.write('    case SIMCALL_NONE:\n')
     fd.write('      throw std::invalid_argument(simgrid::xbt::string_printf("Asked to do the noop syscall on %s@%s",\n')
-    fd.write('                                                              simcall->issuer->get_cname(),\n')
-    fd.write('                                                              sg_host_get_name(simcall->issuer->get_host())));\n')
+    fd.write('                                                              get_cname(),\n')
+    fd.write('                                                              sg_host_get_name(get_host())));\n')
     fd.write('    default:\n')
     fd.write('      THROW_IMPOSSIBLE;\n')
     fd.write('  }\n')
     fd.write('    default:\n')
     fd.write('      THROW_IMPOSSIBLE;\n')
     fd.write('  }\n')
@@ -389,7 +389,7 @@ inline static R simcall(e_smx_simcall_t call, T const&... t)
               (int)self->simcall.call);
     self->yield();
   } else {
               (int)self->simcall.call);
     self->yield();
   } else {
-    SIMIX_simcall_handle(&self->simcall, 0);
+    self->simcall_handle(0);
   }
   return simgrid::simix::unmarshal<R>(self->simcall.result);
 }
   }
   return simgrid::simix::unmarshal<R>(self->simcall.result);
 }
index 40b1beb..5109eec 100644 (file)
@@ -468,7 +468,7 @@ void SIMIX_run()
 
       for (smx_actor_t const& process : simix_global->actors_that_ran) {
         if (process->simcall.call != SIMCALL_NONE) {
 
       for (smx_actor_t const& process : simix_global->actors_that_ran) {
         if (process->simcall.call != SIMCALL_NONE) {
-          SIMIX_simcall_handle(&process->simcall, 0);
+          process->simcall_handle(0);
         }
       }
 
         }
       }