]> AND Public Git Repository - simgrid.git/blobdiff - src/mc/explo/DFSExplorer.hpp
Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
More automatic memory mgmt in MC
[simgrid.git] / src / mc / explo / DFSExplorer.hpp
index 353e00c43e23007e2e699c2b7afc567db85206eb..6510cfe2208ec2d1055204d7014c598120036372 100644 (file)
@@ -6,16 +6,23 @@
 #ifndef SIMGRID_MC_SAFETY_CHECKER_HPP
 #define SIMGRID_MC_SAFETY_CHECKER_HPP
 
-#include "src/mc/VisitedState.hpp"
+#include "src/mc/api/State.hpp"
 #include "src/mc/explo/Exploration.hpp"
 
+#if SIMGRID_HAVE_STATEFUL_MC
+#include "src/mc/VisitedState.hpp"
+#endif
+
 #include <list>
 #include <memory>
+#include <set>
 #include <string>
 #include <vector>
 
 namespace simgrid::mc {
 
+using stack_t = std::list<std::shared_ptr<State>>;
+
 class XBT_PRIVATE DFSExplorer : public Exploration {
   XBT_DECLARE_ENUM_CLASS(ReductionMode, none, dpor);
 
@@ -86,9 +93,25 @@ private:
   void backtrack();
 
   /** Stack representing the position in the exploration graph */
-  std::list<std::unique_ptr<State>> stack_;
+  stack_t stack_;
+#if SIMGRID_HAVE_STATEFUL_MC
   VisitedStates visited_states_;
   std::unique_ptr<VisitedState> visited_state_;
+#else
+  void* visited_state_ = nullptr; /* The code uses it to detect whether we are doing stateful MC */
+#endif
+
+  /** Opened states are states that still contains todo actors.
+   *  When backtracking, we pick a state from it*/
+  std::vector<std::shared_ptr<State>> opened_states_;
+  std::shared_ptr<State> best_opened_state();
+
+  /** Change current stack_ value to correspond to the one we would have
+   *  had if we executed transition to get to state. This is required when
+   *  backtracking, and achieved thanks to the fact states save their parent.*/
+  void restore_stack(std::shared_ptr<State> state);
+
+  RecordTrace get_record_trace_of_stack(stack_t stack);
 };
 
 } // namespace simgrid::mc