Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] s/value/req_num/ because 'value' does not convey any meaning
[simgrid.git] / src / mc / mc_global.cpp
index 38609f9..766665b 100644 (file)
@@ -115,6 +115,17 @@ void MC_run()
 namespace simgrid {
 namespace mc {
 
+void handle_simcall(smx_simcall_t req, int req_num)
+{
+  for (auto& pi : mc_model_checker->process().smx_process_infos)
+    if (req == &pi.copy.simcall) {
+      mc_model_checker->simcall_handle(
+        mc_model_checker->process(), pi.copy.pid, req_num);
+      return;
+    }
+  xbt_die("Could not find the request");
+}
+
 /**
  * \brief Re-executes from the state at position start all the transitions indicated by
  *        a given model-checker stack.
@@ -160,8 +171,8 @@ void replay(std::list<std::unique_ptr<simgrid::mc::State>> const& stack)
     if (state == stack.back())
       break;
 
-    int value;
-    smx_simcall_t saved_req = MC_state_get_executed_request(state.get(), &value);
+    int req_num = state->req_num;
+    smx_simcall_t saved_req = &state->executed_req;
     
     if (saved_req) {
       /* because we got a copy of the executed request, we have to fetch the  
@@ -173,7 +184,7 @@ void replay(std::list<std::unique_ptr<simgrid::mc::State>> const& stack)
       /* Debug information */
       XBT_DEBUG("Replay: %s (%p)",
         simgrid::mc::request_to_string(
-          req, value, simgrid::mc::RequestType::simix).c_str(),
+          req, req_num, simgrid::mc::RequestType::simix).c_str(),
         state.get());
 
       /* TODO : handle test and testany simcalls */
@@ -181,11 +192,9 @@ void replay(std::list<std::unique_ptr<simgrid::mc::State>> const& stack)
       if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
         call = MC_get_call_type(req);
 
-      simgrid::mc::handle_simcall(req, value);
-
+      simgrid::mc::handle_simcall(req, req_num);
       if (_sg_mc_comms_determinism || _sg_mc_send_determinism)
-        MC_handle_comm_pattern(call, req, value, nullptr, 1);
-
+        MC_handle_comm_pattern(call, req, req_num, nullptr, 1);
       mc_model_checker->wait_for_requests();
 
       count++;