Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Reduce the amount of MC locations reading the memory of the App
[simgrid.git] / src / mc / explo / LivenessChecker.cpp
index 699d506..64d9f36 100644 (file)
@@ -16,8 +16,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(mc_liveness, mc, "Logging specific to algorithms
 
 /********* Static functions *********/
 
-namespace simgrid {
-namespace mc {
+namespace simgrid::mc {
 
 VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
                          std::shared_ptr<const std::vector<int>> atomic_propositions,
@@ -28,7 +27,7 @@ VisitedPair::VisitedPair(int pair_num, xbt_automaton_state_t automaton_state,
   if (not this->graph_state->get_system_state())
     this->graph_state->set_system_state(std::make_shared<Snapshot>(pair_num));
   this->heap_bytes_used     = Api::get().get_remote_heap_bytes();
-  this->actors_count        = Api::get().get_actors().size();
+  this->actors_count        = mc_model_checker->get_remote_process().actors().size();
   this->other_num           = -1;
   this->atomic_propositions = std::move(atomic_propositions);
 }
@@ -225,18 +224,16 @@ std::shared_ptr<Pair> LivenessChecker::create_pair(const Pair* current_pair, xbt
   ++expanded_pairs_count_;
   auto next_pair                 = std::make_shared<Pair>(expanded_pairs_count_);
   next_pair->automaton_state     = state;
-  next_pair->graph_state         = std::make_shared<State>();
+  next_pair->graph_state         = std::make_shared<State>(get_session());
   next_pair->atomic_propositions = std::move(propositions);
   if (current_pair)
     next_pair->depth = current_pair->depth + 1;
   else
     next_pair->depth = 1;
   /* Add all enabled actors to the interleave set of the initial state */
-  for (auto& act : Api::get().get_actors()) {
-    auto actor = act.copy.get_buffer();
-    if (get_session().actor_is_enabled(actor->get_pid()))
-      next_pair->graph_state->mark_todo(actor->get_pid());
-  }
+  for (auto const& [aid, _] : next_pair->graph_state->get_actors_list())
+    if (next_pair->graph_state->is_actor_enabled(aid))
+      next_pair->graph_state->mark_todo(aid);
 
   next_pair->requests = next_pair->graph_state->count_todo();
   /* FIXME : get search_cycle value for each accepting state */
@@ -360,8 +357,9 @@ void LivenessChecker::run()
     // For each enabled transition in the property automaton, push a
     // (application_state, automaton_state) pair to the exploration stack:
     for (int i = xbt_dynar_length(current_pair->automaton_state->out) - 1; i >= 0; i--) {
-      auto transition_succ_label = Api::get().get_automaton_transition_label(current_pair->automaton_state->out, i);
-      auto transition_succ_dst   = Api::get().get_automaton_transition_dst(current_pair->automaton_state->out, i);
+      const auto* transition_succ_label =
+          Api::get().get_automaton_transition_label(current_pair->automaton_state->out, i);
+      auto* transition_succ_dst = Api::get().get_automaton_transition_dst(current_pair->automaton_state->out, i);
       if (evaluate_label(transition_succ_label, *prop_values))
         exploration_stack_.push_back(this->create_pair(current_pair.get(), transition_succ_dst, prop_values));
     }
@@ -376,5 +374,4 @@ Exploration* create_liveness_checker(Session* session)
   return new LivenessChecker(session);
 }
 
-} // namespace mc
-} // namespace simgrid
+} // namespace simgrid::mc