A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
Add copy constructor to state, so we can backtrack different ways
[simgrid.git]
/
src
/
mc
/
explo
/
DFSExplorer.cpp
diff --git
a/src/mc/explo/DFSExplorer.cpp
b/src/mc/explo/DFSExplorer.cpp
index
792383e
..
d7cbb3e
100644
(file)
--- a/
src/mc/explo/DFSExplorer.cpp
+++ b/
src/mc/explo/DFSExplorer.cpp
@@
-43,7
+43,7
@@
void DFSExplorer::check_non_termination(const State* current_state)
{
for (auto const& state : stack_) {
if (state->get_system_state()->equals_to(*current_state->get_system_state(),
- get_remote_app().get_remote_process_memory())) {
+
*
get_remote_app().get_remote_process_memory())) {
XBT_INFO("Non-progressive cycle: state %ld -> state %ld", state->get_num(), current_state->get_num());
XBT_INFO("******************************************");
XBT_INFO("*** NON-PROGRESSIVE CYCLE DETECTED ***");
@@
-162,8
+162,8
@@
void DFSExplorer::run()
state->get_transition()->to_string().c_str(), stack_.size(), state->get_num(), state->count_todo());
/* Create the new expanded state (copy the state of MCed into our MCer data) */
- std::
shared
_ptr<State> next_state;
- next_state = std::make_
shared
<State>(get_remote_app(), state);
+ std::
unique
_ptr<State> next_state;
+ next_state = std::make_
unique
<State>(get_remote_app(), state);
on_state_creation_signal(next_state.get(), get_remote_app());
/* Sleep set procedure:
@@
-180,7
+180,9
@@
void DFSExplorer::run()
* If the process is not enabled at this point, then add every enabled process to the interleave */
if (reduction_mode_ == ReductionMode::dpor) {
aid_t issuer_id = state->get_transition()->aid_;
- stack_t tmp_stack = std::list(stack_);
+ stack_t tmp_stack;
+ for (auto& state : stack_)
+ tmp_stack.push_back(std::make_shared<State>(State(*state)));
while (not tmp_stack.empty()) {
State* prev_state = tmp_stack.back().get();
if (state->get_transition()->aid_ == prev_state->get_transition()->aid_) {
@@
-284,22
+286,19
@@
void DFSExplorer::backtrack()
if (backtrack.back()->count_todo() <= 1)
opened_states.pop_back();
- XBT_VERB("%lu todo actors in last states of the next backtracking point %s (remaining %lu opened stacks)",
- backtrack.back()->count_todo(), backtrack.back()->get_transition()->to_string().c_str(),
- opened_states.size());
/* If asked to rollback on a state that has a snapshot, restore it */
State* last_state = backtrack.back().get();
if (const auto* system_state = last_state->get_system_state()) {
- system_state->restore(get_remote_app().get_remote_process_memory());
+ system_state->restore(
*
get_remote_app().get_remote_process_memory());
on_restore_system_state_signal(last_state, get_remote_app());
+ stack_ = backtrack;
return;
}
/* if no snapshot, we need to restore the initial state and replay the transitions */
get_remote_app().restore_initial_state();
on_restore_initial_state_signal(get_remote_app());
-
/* Traverse the stack from the state at position start and re-execute the transitions */
for (std::shared_ptr<State> const& state : backtrack) {
if (state == backtrack.back()) /* If we are arrived on the target state, don't replay the outgoing transition */
@@
-309,10
+308,13
@@
void DFSExplorer::backtrack()
visited_states_count_++;
}
stack_ = backtrack;
- XBT_
VERB
(">> Backtracked to %s", get_record_trace().to_string().c_str());
+ XBT_
DEBUG
(">> Backtracked to %s", get_record_trace().to_string().c_str());
}
-DFSExplorer::DFSExplorer(const std::vector<char*>& args, bool with_dpor) : Exploration(args)
+// DFSExplorer::DFSExplorer(const std::vector<char*>& args, bool with_dpor) : Exploration(args, _sg_mc_termination) //
+// UNCOMMENT TO ACTIVATE REFORKS
+DFSExplorer::DFSExplorer(const std::vector<char*>& args, bool with_dpor)
+ : Exploration(args, true) // This version does not use reforks as it breaks
{
if (with_dpor)
reduction_mode_ = ReductionMode::dpor;