X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=src%2Fmain%2Fgov%2Fnasa%2Fjpf%2Flistener%2FDPORStateReducerEfficient.java;fp=src%2Fmain%2Fgov%2Fnasa%2Fjpf%2Flistener%2FDPORStateReducerEfficient.java;h=aa54e5ee1e85c2203b5262276bcb2bb7fc2ec1e1;hb=b641fa6049e4a531777c2b7a21e3160e12a2d629;hp=594829080a3ef30b4f04fe746f2ab4a38d4fb01e;hpb=ec609ae000b3f7bba0e2d6d4c12c0b4e86bd2bfe;p=jpf-core.git diff --git a/src/main/gov/nasa/jpf/listener/DPORStateReducerEfficient.java b/src/main/gov/nasa/jpf/listener/DPORStateReducerEfficient.java index 5948290..aa54e5e 100644 --- a/src/main/gov/nasa/jpf/listener/DPORStateReducerEfficient.java +++ b/src/main/gov/nasa/jpf/listener/DPORStateReducerEfficient.java @@ -618,6 +618,8 @@ public class DPORStateReducerEfficient extends ListenerAdapter { private int choiceCounter; // Choice counter at this transition private Execution execution; // The execution where this transition belongs private HashSet predecessors; // Maps incoming events/transitions (execution and choice) + private HashMap> recordedPredecessors; + // Memorize event and choice number to not record them twice private int stateId; // State at this transition private IntChoiceFromSet transitionCG; // CG at this transition @@ -626,6 +628,7 @@ public class DPORStateReducerEfficient extends ListenerAdapter { choiceCounter = 0; execution = null; predecessors = new HashSet<>(); + recordedPredecessors = new HashMap<>(); stateId = 0; transitionCG = null; } @@ -652,8 +655,28 @@ public class DPORStateReducerEfficient extends ListenerAdapter { public IntChoiceFromSet getTransitionCG() { return transitionCG; } + private boolean isRecordedPredecessor(Execution execution, int choice) { + // See if we have recorded this predecessor earlier + HashSet recordedChoices; + if (recordedPredecessors.containsKey(execution)) { + recordedChoices = recordedPredecessors.get(execution); + if (recordedChoices.contains(choice)) { + return true; + } + } else { + recordedChoices = new HashSet<>(); + recordedPredecessors.put(execution, recordedChoices); + } + // Record the choice if we haven't seen it + recordedChoices.add(choice); + + return false; + } + public void recordPredecessor(Execution execution, int choice) { - predecessors.add(new Predecessor(choice, execution)); + if (!isRecordedPredecessor(execution, choice)) { + predecessors.add(new Predecessor(choice, execution)); + } } public void setChoice(int cho) {