X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/9a4ec91cc24a9a54ff3a060cc2828ac54d0c0c26..5f5a10db6fc4552782638abb4817041223e17775:/src/mc/explo/LivenessChecker.hpp diff --git a/src/mc/explo/LivenessChecker.hpp b/src/mc/explo/LivenessChecker.hpp deleted file mode 100644 index baed48eb0f..0000000000 --- a/src/mc/explo/LivenessChecker.hpp +++ /dev/null @@ -1,109 +0,0 @@ -/* Copyright (c) 2007-2023. The SimGrid Team. - * All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#ifndef SIMGRID_MC_LIVENESS_CHECKER_HPP -#define SIMGRID_MC_LIVENESS_CHECKER_HPP - -#include "src/mc/api/State.hpp" -#include "src/mc/explo/Exploration.hpp" -#include "xbt/automaton.hpp" - -#include -#include -#include - -namespace simgrid::mc { - -class XBT_PRIVATE Pair { -public: - 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; - bool exploration_started = false; - - explicit Pair(unsigned long expanded_pairs); - - Pair(Pair const&) = delete; - Pair& operator=(Pair const&) = delete; -}; - -class XBT_PRIVATE VisitedPair { -public: - int num; - int other_num = 0; /* Dot output for */ - 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 prop_state, - std::shared_ptr> atomic_propositions, std::shared_ptr app_state, - RemoteApp& remote_app); -}; - -class XBT_PRIVATE LivenessChecker : public Exploration { -public: - explicit LivenessChecker(const std::vector& args); - ~LivenessChecker() override; - - void run() override; - RecordTrace get_record_trace() override; - void log_state() override; - -private: - std::shared_ptr> get_proposition_values() const; - std::shared_ptr insert_acceptance_pair(Pair* pair); - int insert_visited_pair(std::shared_ptr visited_pair, Pair* pair); - void show_acceptance_cycle(std::size_t depth); - void replay(); - void remove_acceptance_pair(int pair_num); - void purge_visited_pairs(); - void backtrack(); - std::shared_ptr create_pair(const Pair* pair, xbt_automaton_state_t state, - std::shared_ptr> propositions); - - // A stack of (application_state, automaton_state) pairs for DFS exploration: - std::list> exploration_stack_; - std::list> acceptance_pairs_; - std::list> visited_pairs_; - unsigned long visited_pairs_count_ = 0; - 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(RemoteProcessMemory const& remote_process, const char* name, - RemotePtr addr); -}; - -} // namespace simgrid::mc - -#endif