From f3ff3b06318cae93db4d682e6451ddbca4760328 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Tue, 22 Mar 2016 16:39:28 +0100 Subject: Use vector instead of set to add/remove states Deterministic adding/removing of states. --- lib/Core/Executor.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'lib/Core/Executor.cpp') diff --git a/lib/Core/Executor.cpp b/lib/Core/Executor.cpp index 2c4e5202..49cba67f 100644 --- a/lib/Core/Executor.cpp +++ b/lib/Core/Executor.cpp @@ -665,7 +665,7 @@ void Executor::branch(ExecutionState &state, for (unsigned i=1; ibranch(); - addedStates.insert(ns); + addedStates.push_back(ns); result.push_back(ns); es->ptreeNode->data = 0; std::pair res = @@ -883,7 +883,7 @@ Executor::fork(ExecutionState ¤t, ref condition, bool isInternal) { ++stats::forks; falseState = trueState->branch(); - addedStates.insert(falseState); + addedStates.push_back(falseState); if (RandomizeFork && theRNG.getBool()) std::swap(trueState, falseState); @@ -2467,9 +2467,9 @@ void Executor::updateStates(ExecutionState *current) { states.insert(addedStates.begin(), addedStates.end()); addedStates.clear(); - - for (std::set::iterator - it = removedStates.begin(), ie = removedStates.end(); + + for (std::vector::iterator it = removedStates.begin(), + ie = removedStates.end(); it != ie; ++it) { ExecutionState *es = *it; std::set::iterator it2 = states.find(es); @@ -2674,7 +2674,8 @@ void Executor::run(ExecutionState &initialState) { searcher = constructUserSearcher(*this); - searcher->update(0, states, std::set()); + std::vector newStates(states.begin(), states.end()); + searcher->update(0, newStates, std::vector()); while (!states.empty() && !haltExecution) { ExecutionState &state = searcher->selectState(); @@ -2753,11 +2754,12 @@ void Executor::terminateState(ExecutionState &state) { interpreterHandler->incPathsExplored(); - std::set::iterator it = addedStates.find(&state); + std::vector::iterator it = + std::find(addedStates.begin(), addedStates.end(), &state); if (it==addedStates.end()) { state.pc = state.prevPC; - removedStates.insert(&state); + removedStates.push_back(&state); } else { // never reached searcher, just delete immediately std::map< ExecutionState*, std::vector >::iterator it3 = -- cgit 1.4.1