X-Git-Url: http://plrg.eecs.uci.edu/git/?p=jpf-core.git;a=blobdiff_plain;f=src%2Fmain%2Fgov%2Fnasa%2Fjpf%2Flistener%2FDPORStateReducer.java;h=ef0994cbdeba690d46c526b1016c54a488bc09dc;hp=fe4132f5386075d7cebb42ec467677a047bdfecb;hb=42c68a0ac3563a679987c53ce282d6807cd3d9d6;hpb=f7a9bf3cb6809b252d08b4b02a750e2251cec942 diff --git a/src/main/gov/nasa/jpf/listener/DPORStateReducer.java b/src/main/gov/nasa/jpf/listener/DPORStateReducer.java index fe4132f..ef0994c 100644 --- a/src/main/gov/nasa/jpf/listener/DPORStateReducer.java +++ b/src/main/gov/nasa/jpf/listener/DPORStateReducer.java @@ -324,14 +324,12 @@ public class DPORStateReducer extends ListenerAdapter { private ArrayList executionTrace; // The BacktrackPoint objects of this execution private boolean isNew; // Track if this is the first time it is accessed private HashMap readWriteFieldsMap; // Record fields that are accessed - private HashMap stateToTransitionMap; // For O(1) access to backtrack point public Execution() { cgToChoiceMap = new HashMap<>(); executionTrace = new ArrayList<>(); isNew = true; readWriteFieldsMap = new HashMap<>(); - stateToTransitionMap = new HashMap<>(); } public void addTransition(TransitionEvent newBacktrackPoint) { @@ -358,14 +356,6 @@ public class DPORStateReducer extends ListenerAdapter { return readWriteFieldsMap; } - public TransitionEvent getTransitionFromState(int stateId) { - if (stateToTransitionMap.containsKey(stateId)) { - return stateToTransitionMap.get(stateId); - } - // Return the latest transition for unseen states (that have just been encountered in this transition) - return executionTrace.get(executionTrace.size() - 1); - } - public boolean isNew() { if (isNew) { // Right after this is accessed, it is no longer new @@ -378,10 +368,6 @@ public class DPORStateReducer extends ListenerAdapter { public void mapCGToChoice(IntChoiceFromSet icsCG, int choice) { cgToChoiceMap.put(icsCG, choice); } - - public void mapStateToTransition(int stateId, TransitionEvent transition) { - stateToTransitionMap.put(stateId, transition); - } } // This class compactly stores a predecessor @@ -647,7 +633,6 @@ public class DPORStateReducer extends ListenerAdapter { // Add new transition to the current execution and map it in R-Graph for (Integer stId : justVisitedStates) { // Map this transition to all the previously passed states rGraph.addReachableTransition(stId, transition); - currentExecution.mapStateToTransition(stId, transition); } currentExecution.mapCGToChoice(icsCG, choiceCounter); // Store restorable state object for this state (always store the latest) @@ -1169,6 +1154,8 @@ public class DPORStateReducer extends ListenerAdapter { updateBacktrackSetRecursive(execution, currentChoice, conflictExecution, conflictChoice, pushedExecution, pushedChoice, currRWSet, visited); } + // Remove the transition after being explored + visited.remove(confTrans); } // --- Functions related to the reachability analysis when there is a state match @@ -1179,13 +1166,8 @@ public class DPORStateReducer extends ListenerAdapter { // 2) at least 2 choices/events have been explored (choiceCounter > 1), // 3) state > 0 (state 0 is for boolean CG) if (!isEndOfExecution && choiceCounter > 1 && stateId > 0) { - if (currVisitedStates.contains(stateId)) { - // Get the backtrack point from the current execution - TransitionEvent transition = currentExecution.getTransitionFromState(stateId); - transition.recordPredecessor(currentExecution, choiceCounter - 1); - updateBacktrackSetsFromPreviousExecution(stateId); - } else if (prevVisitedStates.contains(stateId)) { // We visit a state in a previous execution - // Update past executions with a predecessor + if (currVisitedStates.contains(stateId) || prevVisitedStates.contains(stateId)) { + // Update reachable transitions in the graph with a predecessor HashSet reachableTransitions = rGraph.getReachableTransitionsAtState(stateId); for(TransitionEvent transition : reachableTransitions) { transition.recordPredecessor(currentExecution, choiceCounter - 1);