From c8569dd7e088edae716fdc00b7005a0fdc393073 Mon Sep 17 00:00:00 2001 From: amiraj Date: Thu, 14 Nov 2019 11:21:53 -0800 Subject: [PATCH] Fix a bug in ConflictTracker.java --- .../gov/nasa/jpf/listener/ConflictTracker.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/gov/nasa/jpf/listener/ConflictTracker.java b/src/main/gov/nasa/jpf/listener/ConflictTracker.java index 435a29a..fa94001 100644 --- a/src/main/gov/nasa/jpf/listener/ConflictTracker.java +++ b/src/main/gov/nasa/jpf/listener/ConflictTracker.java @@ -128,6 +128,7 @@ public class ConflictTracker extends ListenerAdapter { HashMap valueMap = new HashMap(); // HashMap from varName to value HashMap writerMap = new HashMap(); // HashMap from varName to appNum + // Update the valueMap for (int i = 0;i < nodeToProcess.getSetSet().size();i++) { NameValuePair nameValuePair = nodeToProcess.getSetSet().get(i); @@ -174,12 +175,10 @@ public class ConflictTracker extends ListenerAdapter { boolean updateEdge(Node parentNode, Node currentNode) { ArrayList setSet = currentNode.getSetSetMap().get(parentNode); HashSet updatedVarNames = new HashSet(); - HashMap lastWriter = new HashMap(); // Store the last writer of each variable boolean isChanged = false; for (int i = 0;i < setSet.size();i++) { updatedVarNames.add(setSet.get(i).getVarName()); - lastWriter.put(setSet.get(i).getVarName(), setSet.get(i).getAppNum()); } for (NameValuePair i : parentNode.getOutSet()) { @@ -188,8 +187,7 @@ public class ConflictTracker extends ListenerAdapter { } for (int i = 0;i < setSet.size();i++) { - if (setSet.get(i).getAppNum().equals(lastWriter.get(setSet.get(i).getVarName()))) // Add the last writer of each variable to outSet - isChanged |= currentNode.getOutSet().add(setSet.get(i)); + isChanged |= currentNode.getOutSet().add(setSet.get(i)); } return isChanged; @@ -342,11 +340,10 @@ public class ConflictTracker extends ListenerAdapter { depth = search.getDepth(); operation = "forward"; - // Check for the conflict in this new transition - conflictFound = checkForConflict(parentNode); + // Add the node to the list of nodes + if (nodes.get(id) == null) + nodes.put(id, new Node(id)); - // Add the node to the list of nodes - nodes.put(id, new Node(id)); Node currentNode = nodes.get(id); // Update the setSet for this new node @@ -386,6 +383,9 @@ public class ConflictTracker extends ListenerAdapter { // Update the edge and check if the outset of the current node is changed or not to propagate the change boolean isChanged = updateEdge(parentNode, currentNode); + // Check for the conflict in this edge + conflictFound = checkForConflict(currentNode); + // Check if the outSet of this state has changed, update all of its successors' sets if any if (isChanged) conflictFound = conflictFound || propagateTheChange(currentNode); -- 2.34.1