Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[mc] Move MC_report() functions as static functions where they're used
[simgrid.git] / src / mc / mc_base.cpp
index f68fc96..42906fe 100644 (file)
@@ -38,7 +38,6 @@ int MC_random(int min, int max)
   xbt_assert(mc_mode != MC_MODE_SERVER);
   /* TODO, if the MC is disabled we do not really need to make a simcall for
    * this :) */
-  /* FIXME: return mc_current_state->executed_transition->random.value; */
   return simcall_mc_random(min, max);
 }
 
@@ -154,16 +153,19 @@ bool request_is_enabled(smx_simcall_t req)
       mutex = &temp_mutex;
     }
 #endif
+
     if(mutex->owner == nullptr)
       return true;
-    else
 #if HAVE_MC
+    else if (mc_mode == MC_MODE_SERVER) {
+      simgrid::mc::Process& modelchecked = mc_model_checker->process();
       // TODO, *(mutex->owner) :/
-      return MC_smx_resolve_process(mutex->owner)->pid ==
-        MC_smx_resolve_process(req->issuer)->pid;
-#else
-      return mutex->owner->pid == req->issuer->pid;
+      return modelchecked.resolveProcess(simgrid::mc::remote(mutex->owner))->pid
+        == modelchecked.resolveProcess(simgrid::mc::remote(req->issuer))->pid;
+    }
 #endif
+    else
+      return mutex->owner->pid == req->issuer->pid;
     }
 
   default:
@@ -214,30 +216,3 @@ int simcall_HANDLER_mc_random(smx_simcall_t simcall, int min, int max)
     return prng_random(min, max);
   return simcall->mc_value;
 }
-
-namespace simgrid {
-namespace mc {
-
-void handle_simcall(smx_simcall_t req, int value)
-{
-#if !HAVE_MC
-  SIMIX_simcall_handle(req, value);
-#else
-  if (mc_mode == MC_MODE_CLIENT) {
-    SIMIX_simcall_handle(req, value);
-    return;
-  }
-
-  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, value);
-      return;
-    }
-
-  xbt_die("Could not find the request");
-#endif
-}
-
-}
-}