From 16e87acf00914bbe8a17f80a352dda60a02894ad Mon Sep 17 00:00:00 2001 From: Maxwell Pirtle Date: Thu, 25 May 2023 11:18:31 +0200 Subject: [PATCH] Keep pointers to transitions instead of slices Prior to this commit, sleep sets contained slices --- src/mc/api/State.cpp | 5 ++--- src/mc/api/State.hpp | 9 +++------ src/mc/explo/DFSExplorer.cpp | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mc/api/State.cpp b/src/mc/api/State.cpp index c8059b5fe5..4600c3e030 100644 --- a/src/mc/api/State.cpp +++ b/src/mc/api/State.cpp @@ -63,16 +63,15 @@ State::State(RemoteApp& remote_app, std::shared_ptr parent_state) * And if we kept it and the actor is enabled in this state, mark the actor as already done, so that * it is not explored*/ for (auto& [aid, transition] : parent_state_->get_sleep_set()) { - if (not incoming_transition_->depends(&transition)) { + if (not incoming_transition_->depends(transition.get())) { sleep_set_.try_emplace(aid, transition); if (strategy_->actors_to_run_.count(aid) != 0) { XBT_DEBUG("Actor %ld will not be explored, for it is in the sleep set", aid); - strategy_->actors_to_run_.at(aid).mark_done(); } } else XBT_DEBUG("Transition >>%s<< removed from the sleep set because it was dependent with incoming >>%s<<", - transition.to_string().c_str(), incoming_transition_->to_string().c_str()); + transition->to_string().c_str(), incoming_transition_->to_string().c_str()); } } } diff --git a/src/mc/api/State.hpp b/src/mc/api/State.hpp index 7f0290baa1..0fee31f710 100644 --- a/src/mc/api/State.hpp +++ b/src/mc/api/State.hpp @@ -44,7 +44,7 @@ class XBT_PRIVATE State : public xbt::Extendable { /* Sleep sets are composed of the actor and the corresponding transition that made it being added to the sleep * set. With this information, it is check whether it should be removed from it or not when exploring a new * transition */ - std::map sleep_set_; + std::map> sleep_set_; /** * The wakeup tree with respect to the execution represented @@ -117,11 +117,8 @@ public: std::unordered_set get_backtrack_set() const; std::unordered_set get_sleeping_actors() const; std::unordered_set get_enabled_actors() const; - std::map const& get_sleep_set() const { return sleep_set_; } - void add_sleep_set(std::shared_ptr t) - { - sleep_set_.insert_or_assign(t->aid_, Transition(t->type_, t->aid_, t->times_considered_)); - } + std::map> const& get_sleep_set() const { return sleep_set_; } + void add_sleep_set(std::shared_ptr t) { sleep_set_.insert_or_assign(t->aid_, std::move(t)); } bool is_actor_sleeping(aid_t actor) const { return std::find_if(sleep_set_.begin(), sleep_set_.end(), [=](const auto& pair) { return pair.first == actor; }) != diff --git a/src/mc/explo/DFSExplorer.cpp b/src/mc/explo/DFSExplorer.cpp index af2d8ba442..2aef8ce8be 100644 --- a/src/mc/explo/DFSExplorer.cpp +++ b/src/mc/explo/DFSExplorer.cpp @@ -209,7 +209,7 @@ void DFSExplorer::run() if (_sg_mc_sleep_set && XBT_LOG_ISENABLED(mc_dfs, xbt_log_priority_verbose)) { XBT_VERB("Sleep set actually containing:"); for (auto& [aid, transition] : state->get_sleep_set()) - XBT_VERB(" <%ld,%s>", aid, transition.to_string().c_str()); + XBT_VERB(" <%ld,%s>", aid, transition->to_string().c_str()); } /* Actually answer the request: let's execute the selected request (MCed does one step) */ -- 2.20.1