From f5ce0dc8b32aad58a543397deada4febfccf9c87 Mon Sep 17 00:00:00 2001 From: amiraj Date: Wed, 11 Dec 2019 13:21:41 -0800 Subject: [PATCH] Make a change in ConflictTracker analysis --- .../nasa/jpf/listener/ConflictTracker.java | 75 +++++++++---------- 1 file changed, 36 insertions(+), 39 deletions(-) diff --git a/src/main/gov/nasa/jpf/listener/ConflictTracker.java b/src/main/gov/nasa/jpf/listener/ConflictTracker.java index 82a7114..8b4e284 100644 --- a/src/main/gov/nasa/jpf/listener/ConflictTracker.java +++ b/src/main/gov/nasa/jpf/listener/ConflictTracker.java @@ -89,12 +89,13 @@ public class ConflictTracker extends ListenerAdapter { boolean propagateTheChange(Node currentNode) { HashSet changed = new HashSet(currentNode.getSuccessors()); - HashMap> parentQueueMap = new HashMap>(); - HashSet parents = new HashSet(); - parents.add(currentNode); + boolean isChanged = false; for (Node node : currentNode.getSuccessors()) { - parentQueueMap.put(node, parents); + isChanged = false; + isChanged = updateTheOutSet(currentNode, node); + if (isChanged) + changed.add(node); } while(!changed.isEmpty()) { @@ -102,40 +103,15 @@ public class ConflictTracker extends ListenerAdapter { Node nodeToProcess = changed.iterator().next(); changed.remove(nodeToProcess); - // Update the changed parents - parents.clear(); - parents = parentQueueMap.get(nodeToProcess); - boolean isChanged = false; - - for (Node node : parents) { - // Update the edge - isChanged |= updateTheOutSet(node, nodeToProcess); - } - - // All the changes in current parents are propagated - parentQueueMap.get(nodeToProcess).clear(); - - // Check if the node has changed or not - if (isChanged) { - // Check for a conflict in all the transition out of this node - if (checkAllSuccForConflict(nodeToProcess)) - return true; - - // Update the parents list for the successors of the current node - parents.clear(); - parents.add(nodeToProcess); - - // For all the successors of the current node - for (Node i : nodeToProcess.getSuccessors()) { - if (!changed.contains(i)) - changed.add(i); - - // Update the list of updated parents for the current node - if (parentQueueMap.containsKey(i)) - parentQueueMap.get(i).add(nodeToProcess); - else - parentQueueMap.put(i, parents); - } + // Update all the successors of the node + for (Node node : nodeToProcess.getSuccessors()) { + isChanged = false; + isChanged = updateTheOutSet(nodeToProcess, node); + if (isChanged) { + changed.add(node); + if (checkAllSuccForConflict(node)) + return true; + } } } return false; @@ -425,6 +401,11 @@ public class ConflictTracker extends ListenerAdapter { out.println("The state is restored to state with id: "+id+", depth: "+depth); + if (id == 24 && depth == 5) { + System.out.println("*****************************************"); + System.out.println("*****************************************"); + System.out.println("*****************************************"); + } // Update the parent node if (nodes.containsKey(id)) { parentNode = nodes.get(id); @@ -489,6 +470,13 @@ public class ConflictTracker extends ListenerAdapter { // Update the outset of the current node and check if it is changed or not to propagate the change boolean isChanged = updateTheOutSet(parentNode, currentNode); + + System.out.println("######################### The outset is:"); + for (NameValuePair nvp : currentNode.getOutSet()) { + System.out.println("writer: "+nvp.getAppNum()); + System.out.println("value: "+nvp.getValue()); + System.out.println("var : "+nvp.getVarName()); + } // Check if the outSet of this state has changed, update all of its successors' sets if any if (isChanged) conflictFound = conflictFound || checkAllSuccForConflict(currentNode) || propagateTheChange(currentNode); @@ -510,6 +498,12 @@ public class ConflictTracker extends ListenerAdapter { out.println("The state is backtracked to state with id: "+id+", depth: "+depth); + if (id == 24 && depth == 5) { + System.out.println("*****************************************"); + System.out.println("*****************************************"); + System.out.println("*****************************************"); + } + // Update the parent node if (nodes.containsKey(id)) { parentNode = nodes.get(id); @@ -714,7 +708,10 @@ public class ConflictTracker extends ListenerAdapter { if (getWriter(ti.getStack(), manualSet) != null) manual = true; - + + System.out.println("############################## writer: "+writer); + System.out.println("############################## value: "+value); + System.out.println("############################## var: "+var); // Update the temporary Set set. writeWriterAndValue(writer, value, var); } -- 2.34.1