Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge s4u wait_any
[simgrid.git] / src / mc / mc_request.cpp
index 1d37779..1feb6e8 100644 (file)
@@ -142,7 +142,7 @@ bool request_depend(smx_simcall_t r1, smx_simcall_t r2)
   if (r1->issuer == r2->issuer)
     return false;
 
-  /* Wait with timeout transitions are not considered by the independance theorem, thus we consider them as dependant with all other transitions */
+  /* Wait with timeout transitions are not considered by the independence theorem, thus we consider them as dependant with all other transitions */
   if ((r1->call == SIMCALL_COMM_WAIT && simcall_comm_wait__get__timeout(r1) > 0)
       || (r2->call == SIMCALL_COMM_WAIT
           && simcall_comm_wait__get__timeout(r2) > 0))
@@ -291,7 +291,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
       if (use_remote_comm) {
         mc_model_checker->process().read(temp_synchro, remote(
           static_cast<simgrid::simix::Comm*>(remote_act)));
-        act = static_cast<simgrid::simix::Comm*>(temp_synchro.data());
+        act = temp_synchro.getBuffer();
       } else
         act = remote_act;
 
@@ -319,7 +319,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     if (use_remote_comm) {
       mc_model_checker->process().read(temp_synchro, remote(
         static_cast<simgrid::simix::Comm*>(remote_act)));
-      act = static_cast<simgrid::simix::Comm*>(temp_synchro.data());
+      act = temp_synchro.getBuffer();
     } else
       act = remote_act;
 
@@ -375,8 +375,7 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
       type = "TestAny";
       args =
           bprintf("(%d of %zu)", value + 1,
-                  read_length(mc_model_checker->process(),
-                    simcall_comm_testany__get__comms(req)));
+                    simcall_comm_testany__get__count(req));
     }
     break;
 
@@ -387,8 +386,8 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
     else
       type = "Mutex TRYLOCK";
 
-    s_smx_mutex_t mutex;
-    mc_model_checker->process().read_bytes(&mutex, sizeof(mutex),
+    simgrid::mc::Remote<simgrid::simix::Mutex> mutex;
+    mc_model_checker->process().read_bytes(mutex.getBuffer(), sizeof(mutex),
       remote(
         req->call == SIMCALL_MUTEX_LOCK
         ? simcall_mutex_lock__get__mutex(req)
@@ -396,12 +395,12 @@ std::string simgrid::mc::request_to_string(smx_simcall_t req, int value, simgrid
       ));
     s_xbt_swag_t mutex_sleeping;
     mc_model_checker->process().read_bytes(&mutex_sleeping, sizeof(mutex_sleeping),
-      remote(mutex.sleeping));
+      remote(mutex.getBuffer()->sleeping));
 
     args = bprintf("locked = %d, owner = %d, sleeping = %d",
-      mutex.locked,
-      mutex.owner != nullptr ? (int) mc_model_checker->process().resolveProcess(
-        simgrid::mc::remote(mutex.owner))->pid : -1,
+      mutex.getBuffer()->locked,
+      mutex.getBuffer()->owner != nullptr ? (int) mc_model_checker->process().resolveProcess(
+        simgrid::mc::remote(mutex.getBuffer()->owner))->pid : -1,
       mutex_sleeping.count);
     break;
   }
@@ -451,12 +450,9 @@ bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
     }
     break;
 
-  case SIMCALL_COMM_TESTANY: {
-    read_element(
-      mc_model_checker->process(), &remote_act,
-      remote(simcall_comm_testany__get__comms(req)),
-      idx, sizeof(remote_act));
-    }
+  case SIMCALL_COMM_TESTANY:
+    remote_act = mc_model_checker->process().read(remote(
+      simcall_comm_testany__get__comms(req) + idx));
     break;
 
   default:
@@ -466,7 +462,7 @@ bool request_is_enabled_by_idx(smx_simcall_t req, unsigned int idx)
   simgrid::mc::Remote<simgrid::simix::Comm> temp_comm;
   mc_model_checker->process().read(temp_comm, remote(
     static_cast<simgrid::simix::Comm*>(remote_act)));
-  simgrid::simix::Comm* comm = static_cast<simgrid::simix::Comm*>(temp_comm.data());
+  simgrid::simix::Comm* comm = temp_comm.getBuffer();
   return comm->src_proc && comm->dst_proc;
 }
 
@@ -531,7 +527,7 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
       simgrid::mc::Remote<simgrid::simix::Comm> temp_comm;
       mc_model_checker->process().read(temp_comm, remote(
         static_cast<simgrid::simix::Comm*>(remote_act)));
-      simgrid::simix::Comm* comm = static_cast<simgrid::simix::Comm*>(temp_comm.data());
+      simgrid::simix::Comm* comm = temp_comm.getBuffer();
 
       smx_process_t src_proc = mc_model_checker->process().resolveProcess(
         simgrid::mc::remote(comm->src_proc));
@@ -557,7 +553,7 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
     simgrid::mc::Remote<simgrid::simix::Comm> temp_comm;
     mc_model_checker->process().read(temp_comm, remote(
       static_cast<simgrid::simix::Comm*>(remote_act)));
-    simgrid::simix::Comm* comm = static_cast<simgrid::simix::Comm*>(temp_comm.data());
+    simgrid::simix::Comm* comm = temp_comm.getBuffer();
     if (comm->src_proc == nullptr || comm->dst_proc == nullptr) {
       if (issuer->host)
         label = simgrid::xbt::string_printf("[(%lu)%s] Test FALSE",
@@ -601,12 +597,12 @@ std::string request_get_dot_output(smx_simcall_t req, int value)
         label = simgrid::xbt::string_printf("[(%lu)%s] TestAny TRUE [%d of %lu]",
                     issuer->pid,
                     MC_smx_process_get_host_name(issuer), value + 1,
-                    xbt_dynar_length(simcall_comm_testany__get__comms(req)));
+                    simcall_comm_testany__get__count(req));
       else
         label = simgrid::xbt::string_printf("[(%lu)] TestAny TRUE [%d of %lu]",
                     issuer->pid,
                     value + 1,
-                    xbt_dynar_length(simcall_comm_testany__get__comms(req)));
+                    simcall_comm_testany__get__count(req));
     }
     break;