X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/992bc1ec57d376cf14b124ea21b58b30f1e162f9..3203afd846219ef8b41cadda945ea0a98103c46f:/src/mc/explo/LivenessChecker.hpp diff --git a/src/mc/explo/LivenessChecker.hpp b/src/mc/explo/LivenessChecker.hpp index a783d46b62..50307cacd1 100644 --- a/src/mc/explo/LivenessChecker.hpp +++ b/src/mc/explo/LivenessChecker.hpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2007-2022. The SimGrid Team. +/* Copyright (c) 2007-2023. The SimGrid Team. * All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it @@ -19,10 +19,10 @@ namespace simgrid::mc { class XBT_PRIVATE Pair { public: - int num = 0; - bool search_cycle = false; - std::shared_ptr graph_state = nullptr; /* System state included */ - xbt_automaton_state_t automaton_state = nullptr; + int num = 0; + bool search_cycle = false; + std::shared_ptr app_state_ = nullptr; /* State of the application (including system state) */ + xbt_automaton_state_t prop_state_ = nullptr; /* State of the property automaton */ std::shared_ptr> atomic_propositions; int requests = 0; int depth = 0; @@ -38,19 +38,21 @@ class XBT_PRIVATE VisitedPair { public: int num; int other_num = 0; /* Dot output for */ - std::shared_ptr graph_state = nullptr; /* System state included */ - xbt_automaton_state_t automaton_state; + std::shared_ptr app_state_ = nullptr; /* State of the application (including system state) */ + xbt_automaton_state_t prop_state_; /* State of the property automaton */ std::shared_ptr> atomic_propositions; std::size_t heap_bytes_used = 0; int actor_count_; - VisitedPair(int pair_num, xbt_automaton_state_t automaton_state, - std::shared_ptr> atomic_propositions, std::shared_ptr graph_state); + VisitedPair(int pair_num, xbt_automaton_state_t prop_state, + std::shared_ptr> atomic_propositions, std::shared_ptr app_state); }; class XBT_PRIVATE LivenessChecker : public Exploration { public: - explicit LivenessChecker(Session* session); + explicit LivenessChecker(const std::vector& args); + ~LivenessChecker() override; + void run() override; RecordTrace get_record_trace() override; std::vector get_textual_trace() override; @@ -76,6 +78,29 @@ private: unsigned long expanded_pairs_count_ = 0; int previous_pair_ = 0; std::string previous_request_; + + /* The property automaton must be a static because it's sometimes used before the explorer is even created. + * + * This can happen if some symbols are created during the application's initialization process, before the first + * decision point for the model-checker. Since the first snapshot is taken at the first decision point and since the + * explorer is created after the first snapshot, this may result in some symbols being registered even before the + * model-checker notices that this is a LivenessChecker to create. + * + * This situation is unfortunate, but I guess that it's the best I can achieve given the state of our initialization + * code. + */ + static xbt_automaton_t property_automaton_; + bool evaluate_label(const xbt_automaton_exp_label* l, std::vector const& values); + +public: + void automaton_load(const char* file) const; + std::vector automaton_propositional_symbol_evaluate() const; + std::vector get_automaton_state() const; + int compare_automaton_exp_label(const xbt_automaton_exp_label* l) const; + void set_property_automaton(xbt_automaton_state_t const& automaton_state) const; + xbt_automaton_exp_label_t get_automaton_transition_label(xbt_dynar_t const& dynar, int index) const; + xbt_automaton_state_t get_automaton_transition_dst(xbt_dynar_t const& dynar, int index) const; + static void automaton_register_symbol(RemoteProcess const& remote_process, const char* name, RemotePtr addr); }; } // namespace simgrid::mc