boolean isChanged = updateEdge(currentNode, nodeToProcess);
// Check for a conflict in this transition(currentNode -> nodeToProcess)
- if (checkForConflict(currentNode))
+ if (checkForConflict(nodeToProcess))
return true;
// Checking if the out set has changed or not(Add its successors to the change list!)
if (isChanged) {
- for (Node i : nodeToProcess.getSuccessors()) {
- if (!changed.contains(i))
- changed.add(i);
- }
+ propagateTheChange(nodeToProcess);
}
}
" to the variable: "+pair.getVarName()+" while App"+
writerMap.get(pair.getVarName())+" is overwriting the value: "
+valueMap.get(pair.getVarName())+" to the same variable!";
+ System.out.println(message);
return message;
}
boolean updateEdge(Node parentNode, Node currentNode) {
ArrayList<NameValuePair> setSet = currentNode.getSetSetMap().get(parentNode);
HashSet<String> updatedVarNames = new HashSet<String>();
- HashMap<String, Integer> lastWriter = new HashMap<String, Integer>(); // 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());
+
+ if (setSet != null) {
+ for (int i = 0;i < setSet.size();i++) {
+ updatedVarNames.add(setSet.get(i).getVarName());
+ }
}
for (NameValuePair i : parentNode.getOutSet()) {
isChanged |= currentNode.getOutSet().add(i);
}
- 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
+ if (setSet != null) {
+ for (int i = 0;i < setSet.size();i++) {
+ if (currentNode.getOutSet().contains(setSet.get(i)))
+ currentNode.getOutSet().remove(setSet.get(i));
isChanged |= currentNode.getOutSet().add(setSet.get(i));
+ }
}
return isChanged;
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
// 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);
@Override
public void instructionExecuted(VM vm, ThreadInfo ti, Instruction nextInsn, Instruction executedInsn) {
- // Instantiate timeoutTimer
if (timeout > 0) {
if (System.currentTimeMillis() - startTime > timeout) {
StringBuilder sbTimeOut = new StringBuilder();
} else {
if (executedInsn instanceof WriteInstruction) {
String varId = ((WriteInstruction) executedInsn).getFieldInfo().getFullName();
+
for (String var : conflictSet) {
if (varId.contains(var)) {
// Get variable info