{
simgrid::mc::Pair* pair;
while ((pair = (simgrid::mc::Pair*) xbt_fifo_pop(stack)) != nullptr)
- simgrid::mc::pair_delete(pair);
+ delete pair;
}
}
/********* Static functions *********/
+namespace simgrid {
+namespace mc {
+
+Pair::Pair() : num(++mc_stats->expanded_pairs),
+ visited_pair_removed(_sg_mc_visited > 0 ? 0 : 1)
+{}
+
+Pair::~Pair() {
+ this->automaton_state = nullptr;
+ if (this->visited_pair_removed)
+ MC_state_delete(this->graph_state, 1);
+ xbt_dynar_free(&(this->atomic_propositions));
+}
+
static xbt_dynar_t get_atomic_propositions_values()
{
unsigned int cursor = 0;
xbt_dynar_foreach(simgrid::mc::property_automaton->states, cursor, automaton_state) {
if (automaton_state->type == -1) { /* Initial automaton state */
- initial_pair = simgrid::mc::pair_new();
+ initial_pair = new Pair();
initial_pair->automaton_state = automaton_state;
initial_pair->graph_state = MC_state_new();
initial_pair->atomic_propositions = get_atomic_propositions_values();
transition_succ = (xbt_automaton_transition_t)xbt_dynar_get_as(current_pair->automaton_state->out, cursor, xbt_automaton_transition_t);
res = MC_automaton_evaluate_label(transition_succ->label, prop_values);
if (res == 1 || res == 2) { /* 1 = True transition (always enabled), 2 = enabled transition according to atomic prop values */
- next_pair = simgrid::mc::pair_new();
+ next_pair = new Pair();
next_pair->graph_state = MC_state_new();
next_pair->automaton_state = transition_succ->dst;
next_pair->atomic_propositions = get_atomic_propositions_values();
XBT_DEBUG("Delete pair %d at depth %d", current_pair->num, current_pair->depth);
if (current_pair->automaton_state->type == 1)
remove_acceptance_pair(current_pair->num);
- simgrid::mc::pair_delete(current_pair);
+ delete current_pair;
}
}
return SIMGRID_MC_EXIT_SUCCESS;
}
-namespace simgrid {
-namespace mc {
-
int modelcheck_liveness(void)
{
if (mc_reduce_kind == e_mc_reduce_unset)
extern XBT_PRIVATE xbt_automaton_t property_automaton;
struct XBT_PRIVATE Pair {
- int num;
- int search_cycle;
- mc_state_t graph_state; /* System state included */
- xbt_automaton_state_t automaton_state;
- xbt_dynar_t atomic_propositions;
- int requests;
- int depth;
- int exploration_started;
- int visited_pair_removed;
+ int num = 0;
+ int search_cycle = 0;
+ mc_state_t graph_state = nullptr; /* System state included */
+ xbt_automaton_state_t automaton_state = nullptr;
+ xbt_dynar_t atomic_propositions = nullptr;
+ int requests = 0;
+ int depth = 0;
+ int exploration_started = 0;
+ int visited_pair_removed = 0;
+
+ Pair();
+ ~Pair();
+
+ Pair(Pair const&) = delete;
+ Pair& operator=(Pair const&) = delete;
};
struct XBT_PRIVATE VisitedPair {
int visited_removed;
};
-XBT_PRIVATE simgrid::mc::Pair* pair_new(void);
-XBT_PRIVATE void pair_delete(simgrid::mc::Pair*);
XBT_PRIVATE simgrid::mc::VisitedPair* visited_pair_new(int pair_num, xbt_automaton_state_t automaton_state, xbt_dynar_t atomic_propositions, mc_state_t graph_state);
XBT_PRIVATE void visited_pair_delete(simgrid::mc::VisitedPair* p);
+++ /dev/null
-/* Copyright (c) 2013-2015. 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. */
-
-#include <xbt/dynar.h>
-#include <xbt/sysdep.h>
-
-#include "src/mc/mc_liveness.h"
-#include "src/mc/mc_private.h"
-
-namespace simgrid {
-namespace mc {
-
-simgrid::mc::Pair* pair_new()
-{
- simgrid::mc::Pair* p = nullptr;
- p = xbt_new0(simgrid::mc::Pair, 1);
- p->num = ++mc_stats->expanded_pairs;
- p->exploration_started = 0;
- p->search_cycle = 0;
- p->visited_pair_removed = _sg_mc_visited > 0 ? 0 : 1;
- return p;
-}
-
-void pair_delete(simgrid::mc::Pair* p)
-{
- p->automaton_state = nullptr;
- if(p->visited_pair_removed)
- MC_state_delete(p->graph_state, 1);
- xbt_dynar_free(&(p->atomic_propositions));
- xbt_free(p);
- p = nullptr;
-}
-
-}
-}
\ No newline at end of file
src/mc/mc_record.cpp
src/mc/mc_member.cpp
src/mc/mc_memory.cpp
- src/mc/mc_pair.cpp
src/mc/mc_private.h
src/mc/mc_request.h
src/mc/mc_request.cpp