visitedStateSet = new HashSet<>();
stateId = -1;
prevChoiceValue = -1;
+ cgMap = new HashMap<>();
+ readWriteFieldsMap = new HashMap<>();
+ backtrackMap = new HashMap<>();
+ backtrackSet = new HashSet<>();
+ conflictPairMap = new HashMap<>();
initializeStateReduction();
}
maxUpperBound = 0;
isInitialized = false;
isResetAfterAnalysis = false;
- cgMap = new HashMap<>();
- readWriteFieldsMap = new HashMap<>();
- backtrackMap = new HashMap<>();
- backtrackSet = new HashSet<>();
- conflictPairMap = new HashMap<>();
+ cgMap.clear();
+ readWriteFieldsMap.clear();
+ backtrackMap.clear();
+ backtrackSet.clear();
+ conflictPairMap.clear();
}
}
choiceCounter++;
// Do this for every CG after finishing each backtrack list
if (icsCG.getNextChoice() == -1 || visitedStateSet.contains(stateId)) {
- int event = cgMap.get(icsCG);
- LinkedList<Integer[]> choiceLists = backtrackMap.get(event);
- if (choiceLists != null && choiceLists.peekFirst() != null) {
- Integer[] choiceList = choiceLists.removeFirst();
- // Deploy the new choice list for this CG
- icsCG.setNewValues(choiceList);
- icsCG.reset();
- } else {
- // Set done if this was the last backtrack list
- icsCG.setDone();
+ if (cgMap.containsKey(icsCG)) {
+ int event = cgMap.get(icsCG);
+ LinkedList<Integer[]> choiceLists = backtrackMap.get(event);
+ if (choiceLists != null && choiceLists.peekFirst() != null) {
+ Integer[] choiceList = choiceLists.removeFirst();
+ // Deploy the new choice list for this CG
+ icsCG.setNewValues(choiceList);
+ icsCG.reset();
+ } else {
+ // Set done if this was the last backtrack list
+ icsCG.setDone();
+ }
}
}
}
// The start index for the recursion is always 1 (from the main branch)
} else { // This is a sub-graph
// There is a case/bug that after a re-initialization, currCG is not yet initialized
- if (currCG != null) {
+ if (currCG != null && cgMap.containsKey(currCG)) {
int backtrackListIndex = cgMap.get(currCG);
backtrackChoiceLists = backtrackMap.get(backtrackListIndex);
int listLength = choices.length;