From 7b88a171c9ec147f2c3707861364402dbc2e9da3 Mon Sep 17 00:00:00 2001 From: Gabriel Corona Date: Thu, 24 Mar 2016 12:06:27 +0100 Subject: [PATCH] [mc] Move some snapshot_compare() overload with their respective checker --- src/mc/SafetyChecker.cpp | 9 +++++++++ src/mc/mc_compare.cpp | 18 ------------------ src/mc/mc_safety.h | 1 - src/mc/mc_state.h | 8 -------- src/mc/mc_visited.cpp | 9 +++++++++ 5 files changed, 18 insertions(+), 27 deletions(-) diff --git a/src/mc/SafetyChecker.cpp b/src/mc/SafetyChecker.cpp index dfd9863f96..e1b87d3076 100644 --- a/src/mc/SafetyChecker.cpp +++ b/src/mc/SafetyChecker.cpp @@ -43,6 +43,15 @@ static void MC_show_non_termination(void) MC_print_statistics(mc_stats); } +static int snapshot_compare(mc_state_t state1, mc_state_t state2) +{ + simgrid::mc::Snapshot* s1 = state1->system_state; + simgrid::mc::Snapshot* s2 = state2->system_state; + int num1 = state1->num; + int num2 = state2->num; + return snapshot_compare(num1, s1, num2, s2); +} + static int is_exploration_stack_state(mc_state_t current_state){ xbt_fifo_item_t item; diff --git a/src/mc/mc_compare.cpp b/src/mc/mc_compare.cpp index fc84a15db9..9874969b4c 100644 --- a/src/mc/mc_compare.cpp +++ b/src/mc/mc_compare.cpp @@ -542,23 +542,5 @@ int snapshot_compare(int num1, simgrid::mc::Snapshot* s1, int num2, simgrid::mc: return errors > 0 || hash_result; } -int snapshot_compare(mc_state_t state1, mc_state_t state2) -{ - simgrid::mc::Snapshot* s1 = state1->system_state; - simgrid::mc::Snapshot* s2 = state2->system_state; - int num1 = state1->num; - int num2 = state2->num; - return snapshot_compare(num1, s1, num2, s2); -} - -int snapshot_compare(simgrid::mc::VisitedState* state1, simgrid::mc::VisitedState* state2) -{ - simgrid::mc::Snapshot* s1 = state1->system_state; - simgrid::mc::Snapshot* s2 = state2->system_state; - int num1 = state1->num; - int num2 = state2->num; - return snapshot_compare(num1, s1, num2, s2); -} - } } diff --git a/src/mc/mc_safety.h b/src/mc/mc_safety.h index 4ee245f647..688134a786 100644 --- a/src/mc/mc_safety.h +++ b/src/mc/mc_safety.h @@ -44,7 +44,6 @@ struct XBT_PRIVATE VisitedState { extern XBT_PRIVATE std::vector> visited_states; XBT_PRIVATE std::unique_ptr is_visited_state(mc_state_t graph_state, bool compare_snpashots); -XBT_PRIVATE int snapshot_compare(simgrid::mc::VisitedState* state1, simgrid::mc::VisitedState* state2); } } diff --git a/src/mc/mc_state.h b/src/mc/mc_state.h index 93b350ffee..292d15ceb2 100644 --- a/src/mc/mc_state.h +++ b/src/mc/mc_state.h @@ -68,12 +68,4 @@ XBT_PRIVATE void MC_state_remove_interleave_process(mc_state_t state, smx_proces SG_END_DECL() -namespace simgrid { -namespace mc { - -XBT_PRIVATE int snapshot_compare(mc_state_t state1, mc_state_t state2); - -} -} - #endif diff --git a/src/mc/mc_visited.cpp b/src/mc/mc_visited.cpp index d26d7aef7e..149a7f37fa 100644 --- a/src/mc/mc_visited.cpp +++ b/src/mc/mc_visited.cpp @@ -131,6 +131,15 @@ static void prune_visited_states() } } +static int snapshot_compare(simgrid::mc::VisitedState* state1, simgrid::mc::VisitedState* state2) +{ + simgrid::mc::Snapshot* s1 = state1->system_state; + simgrid::mc::Snapshot* s2 = state2->system_state; + int num1 = state1->num; + int num2 = state2->num; + return snapshot_compare(num1, s1, num2, s2); +} + /** * \brief Checks whether a given state has already been visited by the algorithm. */ -- 2.20.1