Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
MC: untangle dependencies
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 6 Mar 2021 22:14:23 +0000 (23:14 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sat, 6 Mar 2021 22:46:14 +0000 (23:46 +0100)
src/mc/api.cpp

index 797ebd8..286f3e4 100644 (file)
@@ -142,43 +142,44 @@ static inline smx_simcall_t MC_state_choose_request_for_process(simgrid::mc::Sta
   state->executed_req_    = *req;
   // Fetch the data of the request and translate it:
   state->internal_req_ = *req;
+  simgrid::kernel::activity::CommImpl* chosen_comm;
   simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> remote_comm;
 
   /* The waitany and testany request are transformed into a wait or test request over the corresponding communication
    * action so it can be treated later by the dependence function. */
   switch (req->call_) {
-    case Simcall::COMM_WAITANY: {
+    case Simcall::COMM_WAITANY:
       state->internal_req_.call_ = Simcall::COMM_WAIT;
-      simgrid::kernel::activity::CommImpl* chosen_comm = mc_model_checker->get_remote_simulation().read(
+      chosen_comm                = mc_model_checker->get_remote_simulation().read(
           remote(simcall_comm_waitany__get__comms(req) + state->transition_.times_considered_));
 
       mc_model_checker->get_remote_simulation().read(remote_comm, remote(chosen_comm));
       simcall_comm_wait__set__comm(&state->internal_req_, remote_comm.get_buffer());
       simcall_comm_wait__set__timeout(&state->internal_req_, 0);
       break;
-    }
 
-    case Simcall::COMM_TESTANY: {
+    case Simcall::COMM_TESTANY:
       state->internal_req_.call_ = Simcall::COMM_TEST;
-      simgrid::kernel::activity::CommImpl* chosen_comm = mc_model_checker->get_remote_simulation().read(
+      chosen_comm                = mc_model_checker->get_remote_simulation().read(
           remote(simcall_comm_testany__get__comms(req) + state->transition_.times_considered_));
 
-      mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(chosen_comm));
-      simcall_comm_test__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
+      mc_model_checker->get_remote_simulation().read(remote_comm, remote(chosen_comm));
+      simcall_comm_test__set__comm(&state->internal_req_, remote_comm.get_buffer());
       simcall_comm_test__set__result(&state->internal_req_, state->transition_.times_considered_);
       break;
-    }
 
     case Simcall::COMM_WAIT:
-      mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(simcall_comm_wait__getraw__comm(req)));
+      chosen_comm = simcall_comm_wait__getraw__comm(req);
+      mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(chosen_comm));
       simcall_comm_wait__set__comm(&state->executed_req_, state->internal_comm_.get_buffer());
       simcall_comm_wait__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
       break;
 
     case Simcall::COMM_TEST:
-      mc_model_checker->get_remote_simulation().read(state->internal_comm_, remote(simcall_comm_test__getraw__comm(req)));
-      simcall_comm_test__set__comm(&state->executed_req_, state->internal_comm_.get_buffer());
-      simcall_comm_test__set__comm(&state->internal_req_, state->internal_comm_.get_buffer());
+      chosen_comm = simcall_comm_test__getraw__comm(req);
+      mc_model_checker->get_remote_simulation().read(remote_comm, remote(chosen_comm));
+      simcall_comm_test__set__comm(&state->executed_req_, remote_comm.get_buffer());
+      simcall_comm_test__set__comm(&state->internal_req_, remote_comm.get_buffer());
       break;
 
     default: