From: yeom Date: Wed, 3 Feb 2010 02:30:08 +0000 (+0000) Subject: new implementation for compiling conflict queues. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9fca07982512d45fde6d28a11732bd81e8489829;p=IRC.git new implementation for compiling conflict queues. --- diff --git a/Robust/src/Analysis/MLP/ConflictGraph.java b/Robust/src/Analysis/MLP/ConflictGraph.java index 04288209..f9e06beb 100644 --- a/Robust/src/Analysis/MLP/ConflictGraph.java +++ b/Robust/src/Analysis/MLP/ConflictGraph.java @@ -24,162 +24,6 @@ public class ConflictGraph { id2cn = new Hashtable(); } - public void addPseudoEdgeBetweenReadOnlyNode() { - - Collection conflictNodes = id2cn.values(); - Set analyzedIDSet = new HashSet(); - - for (Iterator iterator = conflictNodes.iterator(); iterator.hasNext();) { - ConflictNode conflictNode = (ConflictNode) iterator.next(); - if (isReadOnly(conflictNode) - && conflictNode.getEdgeSet().size() > 0) { - - for (Iterator iter = id2cn.values().iterator(); iter - .hasNext();) { - ConflictNode nextNode = iter.next(); - - if (!conflictNode.equals(nextNode) - && nextNode.getEdgeSet().size() > 0 - && !analyzedIDSet.contains(conflictNode.getID() - + nextNode.getID()) - && !analyzedIDSet.contains(nextNode.getID() - + conflictNode.getID()) - && isReadOnly(nextNode)) { - if (hasSameReadEffects(conflictNode, nextNode)) { - addConflictEdge(ConflictEdge.PSEUDO_EDGE, - conflictNode, nextNode); - } - } - analyzedIDSet.add(conflictNode.getID() + nextNode.getID()); - } - } - } - } - - private boolean hasSameReadEffects(ConflictNode nodeA, ConflictNode nodeB) { - - StallSiteNode stallSiteNode = null; - LiveInNode liveInNode = null; - - if (nodeA instanceof StallSiteNode && nodeB instanceof StallSiteNode) { - return hasSameReadEffects((StallSiteNode) nodeA, - (StallSiteNode) nodeB); - } - - if (nodeA instanceof StallSiteNode) { - stallSiteNode = (StallSiteNode) nodeA; - } else { - liveInNode = (LiveInNode) nodeA; - } - - if (nodeB instanceof StallSiteNode) { - stallSiteNode = (StallSiteNode) nodeB; - } else { - liveInNode = (LiveInNode) nodeB; - } - - if (stallSiteNode != null) { - return hasSameReadEffects(stallSiteNode, liveInNode); - } else { - return hasSameReadEffects((LiveInNode) nodeA, (LiveInNode) nodeB); - } - - } - - private boolean hasSameReadEffects(LiveInNode linA, LiveInNode linB) { - - Set readSetA = linA.getReadEffectsSet(); - Set readSetB = linB.getReadEffectsSet(); - - boolean returnValue = true; - for (Iterator iterator = readSetA.iterator(); iterator.hasNext();) { - SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator.next(); - - for (Iterator iterator2 = readSetB.iterator(); iterator2.hasNext();) { - SESEEffectsKey opr = (SESEEffectsKey) iterator2.next(); - if (!(seseEffectsKey.getHRNUniqueId().equals( - opr.getHRNUniqueId()) && seseEffectsKey - .getFieldDescriptor().equals(opr.getFieldDescriptor()))) { - returnValue = false; - } - } - } - return returnValue; - } - - private boolean hasSameReadEffects(StallSiteNode ssnA, StallSiteNode ssnB) { - - HashSet effectSetA = ssnA.getStallSite().getEffectSet(); - HashSet nodeSetA = ssnA.getStallSite().getHRNSet(); - HashSet effectSetB = ssnB.getStallSite().getEffectSet(); - HashSet nodeSetB = ssnA.getStallSite().getHRNSet(); - boolean returnValue = true; - - for (Iterator iteratorA = effectSetA.iterator(); iteratorA.hasNext();) { - Effect effectKeyA = (Effect) iteratorA.next(); - for (Iterator iterator2A = nodeSetA.iterator(); iterator2A - .hasNext();) { - HeapRegionNode hrnA = (HeapRegionNode) iterator2A.next(); - - for (Iterator iteratorB = effectSetB.iterator(); iteratorB - .hasNext();) { - Effect effectKeyB = (Effect) iteratorB.next(); - for (Iterator iterator2B = nodeSetB.iterator(); iterator2B - .hasNext();) { - HeapRegionNode hrnB = (HeapRegionNode) iterator2B - .next(); - - if (!(hrnA.getGloballyUniqueIdentifier().equals( - hrnB.getGloballyUniqueIdentifier()) && effectKeyA - .getField().equals(effectKeyB.getField()))) { - returnValue = false; - } - } - } - - } - - } - - return returnValue; - } - - private boolean hasSameReadEffects(StallSiteNode ssnA, LiveInNode linB) { - - HashSet effectSetA = ssnA.getStallSite().getEffectSet(); - HashSet nodeSetA = ssnA.getStallSite().getHRNSet(); - - Set readSetB = linB.getReadEffectsSet(); - if (readSetB == null) { - return false; - } - - boolean returnValue = true; - - for (Iterator iterator = effectSetA.iterator(); iterator.hasNext();) { - Effect effectKey = (Effect) iterator.next(); - for (Iterator iterator2 = nodeSetA.iterator(); iterator2.hasNext();) { - HeapRegionNode hrn = (HeapRegionNode) iterator2.next(); - - for (Iterator iterator3 = readSetB.iterator(); iterator3 - .hasNext();) { - SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator3 - .next(); - - if (!(seseEffectsKey.getHRNUniqueId().equals( - hrn.getGloballyUniqueIdentifier()) && seseEffectsKey - .getFieldDescriptor().equals(effectKey.getField()))) { - returnValue = false; - } - - } - - } - } - - return returnValue; - } - private boolean isReadOnly(ConflictNode node) { if (node instanceof StallSiteNode) { @@ -645,6 +489,26 @@ public class ConflictGraph { return false; } + + private boolean isSCC(LiveInNode liveInNode){ + + Set liveInHrnSet = liveInNode.getHRNSet(); +// for (Iterator iterator = liveInHrnSet.iterator(); iterator.hasNext();) { +// HeapRegionNode heapRegionNode = (HeapRegionNode) iterator.next(); +// System.out.println("hrn="+heapRegionNode.getGloballyUniqueIdentifier()); +// } + + Set liveInNodeReachabilitySet = liveInNode.getReachabilitySet(); + Set overlappedReachableRegionSet = calculateOverlappedReachableRegion(liveInNodeReachabilitySet,liveInNodeReachabilitySet); + + if(liveInHrnSet.size()>1){ + if(overlappedReachableRegionSet.size()>0){ + return true; + } + } + + return false; + } public void analyzePossibleConflicts(Set analyzedIDSet, ConflictNode currentNode) { @@ -659,7 +523,10 @@ public class ConflictGraph { // addConflictEdge(ConflictEdge.FINE_GRAIN_EDGE, currentNode, // currentNode); // } - if(isSelfConflicted(liveInNode)){ + if(isSCC(liveInNode)){ + addConflictEdge(ConflictEdge.COARSE_GRAIN_EDGE, currentNode, + currentNode); + }else if(isSelfConflicted(liveInNode)){ addConflictEdge(ConflictEdge.FINE_GRAIN_EDGE, currentNode, currentNode); } @@ -798,6 +665,31 @@ public class ConflictGraph { public void addConflictEdge(int type, ConflictNode nodeU, ConflictNode nodeV) { + // if there are two edges between the same node pair, coarse has a priority + HashSet set=nodeU.getEdgeSet(); + ConflictEdge toBeRemoved=null; + for (Iterator iterator = set.iterator(); iterator.hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator.next(); + + if((conflictEdge.getVertexU().equals(nodeU) && conflictEdge.getVertexV().equals(nodeV)) || + (conflictEdge.getVertexU().equals(nodeV) && conflictEdge.getVertexV().equals(nodeU)) + ){ + if(conflictEdge.getType()==ConflictEdge.FINE_GRAIN_EDGE && type==ConflictEdge.COARSE_GRAIN_EDGE){ + toBeRemoved=conflictEdge; + break; + }else if(conflictEdge.getType()==ConflictEdge.COARSE_GRAIN_EDGE && type==ConflictEdge.FINE_GRAIN_EDGE){ + //ignore + return; + } + } + } + + if(toBeRemoved!=null){ + nodeU.getEdgeSet().remove(toBeRemoved); + nodeV.getEdgeSet().remove(toBeRemoved); + } + + ConflictEdge newEdge = new ConflictEdge(nodeU, nodeV, type); nodeU.addEdge(newEdge); nodeV.addEdge(newEdge); @@ -1389,7 +1281,6 @@ class ConflictEdge { public static final int NON_WRITE_CONFLICT = 0; public static final int FINE_GRAIN_EDGE = 1; public static final int COARSE_GRAIN_EDGE = 2; - public static final int PSEUDO_EDGE = 3; public ConflictEdge(ConflictNode u, ConflictNode v, int type) { this.u = u; @@ -1402,8 +1293,6 @@ class ConflictEdge { return "\"F_CONFLICT\""; } else if (type == COARSE_GRAIN_EDGE) { return "\"C_CONFLICT\""; - } else if (type == PSEUDO_EDGE) { - return "\"P_CONFLICT\", style=dotted"; } else { return "CONFLICT\""; } @@ -1420,5 +1309,9 @@ class ConflictEdge { public int getType() { return type; } + + public String toString(){ + return getVertexU()+"-"+getVertexV(); + } } \ No newline at end of file diff --git a/Robust/src/Analysis/MLP/ConflictNode.java b/Robust/src/Analysis/MLP/ConflictNode.java index ed226a0d..2ea41c02 100644 --- a/Robust/src/Analysis/MLP/ConflictNode.java +++ b/Robust/src/Analysis/MLP/ConflictNode.java @@ -12,7 +12,17 @@ public abstract class ConflictNode { protected HashSet edgeSet; protected Set reachabilitySet; protected TempDescriptor alias; + protected int type; + + public static final int FINE_READ = 0; + public static final int FINE_WRITE = 1; + public static final int PARENT_READ = 2; + public static final int PARENT_WRITE = 3; + public static final int COARSE = 4; + public static final int SCC = 5; + public static final int PARENT_COARSE = 6; + public ConflictNode() { edgeSet = new HashSet(); } @@ -24,7 +34,14 @@ public abstract class ConflictNode { public String getID() { return id; } + + public int getType(){ + return type; + } + public void setType(int type){ + this.type=type; + } public void addEdge(ConflictEdge edge) { edgeSet.add(edge); } diff --git a/Robust/src/Analysis/MLP/LiveInNode.java b/Robust/src/Analysis/MLP/LiveInNode.java index fc556c53..aaa4ec6c 100644 --- a/Robust/src/Analysis/MLP/LiveInNode.java +++ b/Robust/src/Analysis/MLP/LiveInNode.java @@ -171,7 +171,7 @@ public class LiveInNode extends ConflictNode { } public String toString() { - String str = "LiveInNode " + id; + String str = "LiveInNode " + id +" type="+type; return str; } diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 397161ec..b1765e66 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -2048,82 +2048,255 @@ public class MLPAnalysis { return sorted; } - private void calculateCliqueCovering(ConflictGraph conflictGraph) { - - HashSet tocover = conflictGraph.getEdgeSet(); + private void calculateCovering(ConflictGraph conflictGraph){ + + HashSet fineToCover = new HashSet(); + HashSet coarseToCover = new HashSet(); HashSet lockSet=new HashSet(); - - while (!tocover.isEmpty()) { - ConflictEdge edge = (ConflictEdge) tocover.iterator().next(); - tocover.remove(edge); - + + HashSet tempCover = conflictGraph.getEdgeSet(); + for (Iterator iterator = tempCover.iterator(); iterator.hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator.next(); + if(conflictEdge.getType()==ConflictEdge.FINE_GRAIN_EDGE){ + fineToCover.add(conflictEdge); + }else if(conflictEdge.getType()==ConflictEdge.COARSE_GRAIN_EDGE){ + coarseToCover.add(conflictEdge); + } + } + + HashSet toCover=new HashSet(); + toCover.addAll(fineToCover); + toCover.addAll(coarseToCover); + + while (!toCover.isEmpty()) { + SESELock seseLock = new SESELock(); - seseLock.addEdge(edge); - - boolean changed = false; - do { - changed = false; - for (Iterator edgeit = tocover.iterator(); edgeit.hasNext();) { - ConflictEdge newEdge = (ConflictEdge) edgeit.next(); - if (newEdge.getVertexU() == newEdge.getVertexV() - && seseLock.containsConflictNode(newEdge - .getVertexU())) { - // for self-edge case - tocover.remove(newEdge); - changed = true; + + boolean changed; + + do{ // fine-grained edge + + changed=false; + + for (Iterator iterator = fineToCover.iterator(); iterator + .hasNext();) { + + ConflictEdge edge = (ConflictEdge) iterator.next(); + if(seseLock.getConflictNodeSet().size()==0){ + //initial setup + if(seseLock.hasSelfEdge(edge.getVertexU())){ + // mark as fine_write + if(edge.getVertexU() instanceof StallSiteNode){ + edge.getVertexU().setType(ConflictNode.PARENT_WRITE); + }else{ + edge.getVertexU().setType(ConflictNode.FINE_WRITE); + } + seseLock.getConflictNodeSet().add(edge.getVertexU()); + }else{ + // mark as fine_read + if(edge.getVertexU() instanceof StallSiteNode){ + edge.getVertexU().setType(ConflictNode.PARENT_READ); + }else{ + edge.getVertexU().setType(ConflictNode.FINE_READ); + } + seseLock.getConflictNodeSet().add(edge.getVertexU()); + } + if(edge.getVertexV()!=edge.getVertexU()){ + if(seseLock.hasSelfEdge(edge.getVertexV())){ + // mark as fine_write + if(edge.getVertexV() instanceof StallSiteNode){ + edge.getVertexV().setType(ConflictNode.PARENT_WRITE); + }else{ + edge.getVertexV().setType(ConflictNode.FINE_WRITE); + } + seseLock.getConflictNodeSet().add(edge.getVertexV()); + }else{ + // mark as fine_read + if(edge.getVertexV() instanceof StallSiteNode){ + edge.getVertexV().setType(ConflictNode.PARENT_WRITE); + }else{ + edge.getVertexV().setType(ConflictNode.FINE_READ); + } + seseLock.getConflictNodeSet().add(edge.getVertexV()); + } + } + changed=true; + fineToCover.remove(edge); break;// exit iterator loop - } else if (seseLock.testEdge(newEdge)) { - - ConflictNode nodeToAdd = seseLock - .containsConflictNode(newEdge.getVertexU()) ? newEdge - .getVertexV() - : newEdge.getVertexU(); - - for (Iterator newEdgeIter = nodeToAdd.getEdgeSet() - .iterator(); newEdgeIter.hasNext();) { - ConflictEdge ne = (ConflictEdge) newEdgeIter.next(); - if (seseLock.containsConflictNode(ne.getVertexU())) { - tocover.remove(ne); - } else if (seseLock.containsConflictNode(ne - .getVertexV())) { - tocover.remove(ne); + }// end of initial setup + + ConflictNode newNode; + if((newNode=seseLock.getNewNodeConnectedWithGroup(edge))!=null){ + // new node has a fine-grained edge to all current node + // If there is a coarse grained edge where need a fine edge, it's okay to add the node + // but the edge must remain uncovered. + + changed=true; + + if(seseLock.hasSelfEdge(newNode)){ + if(newNode instanceof StallSiteNode){ + newNode.setType(ConflictNode.PARENT_WRITE); + }else{ + newNode.setType(ConflictNode.FINE_WRITE); + } + }else{ + if(newNode instanceof StallSiteNode){ + newNode.setType(ConflictNode.PARENT_READ); + }else{ + newNode.setType(ConflictNode.FINE_READ); + } + } + + seseLock.addEdge(edge); + HashSet edgeSet=newNode.getEdgeSet(); + for (Iterator iterator2 = edgeSet.iterator(); iterator2 + .hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator2 + .next(); + + + // mark all fine edges between new node and nodes in the group as covered + if(!conflictEdge.getVertexU().equals(newNode)){ + if(seseLock.containsConflictNode(conflictEdge.getVertexU())){ + changed=true; + fineToCover.remove(conflictEdge); + } + }else if(!conflictEdge.getVertexV().equals(newNode)){ + if(seseLock.containsConflictNode(conflictEdge.getVertexV())){ + changed=true; + fineToCover.remove(conflictEdge); + } } + } - // Add in new node to lockset - seseLock.addEdge(newEdge); - changed = true; - break; // exit iterator loop + + break;// exit iterator loop } + } + + }while(changed); + + do{ // coarse + + changed=false; + + for (Iterator iterator = coarseToCover.iterator(); iterator + .hasNext();) { + + ConflictEdge edge = (ConflictEdge) iterator.next(); + + if(seseLock.getConflictNodeSet().size()==0){ + //initial setup + if(seseLock.hasSelfEdge(edge.getVertexU())){ + // node has a coarse-grained edge with itself + if(!(edge.getVertexU() instanceof StallSiteNode)){ + // and it is not parent + edge.getVertexU().setType(ConflictNode.SCC); + }else{ + edge.getVertexU().setType(ConflictNode.PARENT_COARSE); + } + seseLock.getConflictNodeSet().add(edge.getVertexU()); + }else{ + if(edge.getVertexU() instanceof StallSiteNode){ + edge.getVertexU().setType(ConflictNode.PARENT_COARSE); + }else{ + edge.getVertexU().setType(ConflictNode.COARSE); + } + seseLock.getConflictNodeSet().add(edge.getVertexU()); + } + if(seseLock.hasSelfEdge(edge.getVertexV())){ + // node has a coarse-grained edge with itself + if(!(edge.getVertexV() instanceof StallSiteNode)){ + // and it is not parent + edge.getVertexV().setType(ConflictNode.SCC); + }else{ + edge.getVertexV().setType(ConflictNode.PARENT_COARSE); + } + seseLock.getConflictNodeSet().add(edge.getVertexV()); + }else{ + if(edge.getVertexV() instanceof StallSiteNode){ + edge.getVertexV().setType(ConflictNode.PARENT_COARSE); + }else{ + edge.getVertexV().setType(ConflictNode.COARSE); + } + seseLock.getConflictNodeSet().add(edge.getVertexV()); + } + changed=true; + break;// exit iterator loop + }// end of initial setup + + + ConflictNode newNode; + if((newNode=seseLock.getNewNodeConnectedWithGroup(edge))!=null){ + // new node has a coarse-grained edge to all fine-read, fine-write, parent + changed=true; + + if(seseLock.hasSelfEdge(newNode)){ + //SCC + if(newNode instanceof StallSiteNode){ + newNode.setType(ConflictNode.PARENT_COARSE); + }else{ + newNode.setType(ConflictNode.SCC); + } + }else{ + if(newNode instanceof StallSiteNode){ + newNode.setType(ConflictNode.PARENT_COARSE); + }else{ + newNode.setType(ConflictNode.COARSE); + } + } + seseLock.addEdge(edge); + HashSet edgeSet=newNode.getEdgeSet(); + for (Iterator iterator2 = edgeSet.iterator(); iterator2 + .hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator2 + .next(); + // mark all coarse edges between new node and nodes in the group as covered + if(!conflictEdge.getVertexU().equals(newNode)){ + if(seseLock.containsConflictNode(conflictEdge.getVertexU())){ + changed=true; + coarseToCover.remove(conflictEdge); + } + }else if(!conflictEdge.getVertexV().equals(newNode)){ + if(seseLock.containsConflictNode(conflictEdge.getVertexV())){ + changed=true; + coarseToCover.remove(conflictEdge); + } + } + + } + break;// exit iterator loop + } + + } - } while (changed); - seseLock.setID(ConflictGraph.generateUniqueCliqueID()); + + }while(changed); + +// System.out.println("lock="+seseLock); lockSet.add(seseLock); - - }// end of while + + toCover.clear(); + toCover.addAll(fineToCover); + toCover.addAll(coarseToCover); + + } - //build map from synthsized locks to conflict graph conflictGraphLockMap.put(conflictGraph, lockSet); - } - private void synthesizeLocks(){ - -// conflictGraphResults.put(seseSummary.getCurrentSESE(), -// conflictGraph); - Set> graphEntrySet=conflictGraphResults.entrySet(); for (Iterator iterator = graphEntrySet.iterator(); iterator.hasNext();) { Entry graphEntry = (Entry) iterator .next(); FlatNode sese=graphEntry.getKey(); ConflictGraph conflictGraph=graphEntry.getValue(); - calculateCliqueCovering(conflictGraph); + calculateCovering(conflictGraph); } - } - + private void makeConflictGraph() { Iterator methItr = ownAnalysis.descriptorsToAnalyze .iterator(); @@ -2216,16 +2389,6 @@ public class MLPAnalysis { FlatNode flatNode = (FlatNode) keyEnum1.nextElement(); ConflictGraph conflictGraph=conflictGraphResults.get(flatNode); conflictGraph.analyzeConflicts(); - conflictGraph.addPseudoEdgeBetweenReadOnlyNode(); - conflictGraphResults.put(flatNode, conflictGraph); - } - - // add pseudo-edge for a pair of read-only node - keyEnum1=conflictGraphResults.keys(); - while (keyEnum1.hasMoreElements()) { - FlatNode flatNode = (FlatNode) keyEnum1.nextElement(); - ConflictGraph conflictGraph=conflictGraphResults.get(flatNode); -// conflictGraph.analyzeConflicts(); conflictGraphResults.put(flatNode, conflictGraph); } diff --git a/Robust/src/Analysis/MLP/SESELock.java b/Robust/src/Analysis/MLP/SESELock.java index ce37cf0e..d4c4e5e4 100644 --- a/Robust/src/Analysis/MLP/SESELock.java +++ b/Robust/src/Analysis/MLP/SESELock.java @@ -12,6 +12,105 @@ public class SESELock { conflictNodeSet=new HashSet(); } + public HashSet getConflictNodeSet(){ + return conflictNodeSet; + } + + public boolean hasSelfEdge(ConflictNode node){ + + HashSet set=node.getEdgeSet(); + for (Iterator iterator = set.iterator(); iterator.hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator.next(); + if(conflictEdge.getVertexU()==conflictEdge.getVertexV()){ + return true; + } + } + return false; + } + + private boolean isFineNode(ConflictNode node){ + + if(node.getType()<4){ + return true; + } + + return false; + + } + + public ConflictNode getNewNodeCoarseConnectedWithGroup(ConflictEdge newEdge) { + + // check whether or not the new node has a fine-grained edges to all + // current nodes. + + ConflictNode newNode; + if (conflictNodeSet.contains(newEdge.getVertexU())) { + newNode = newEdge.getVertexV(); + } else if(conflictNodeSet.contains(newEdge.getVertexV())) { + newNode = newEdge.getVertexU(); + }else{ + return null; + } + + int count = 0; + HashSet edgeSet = newNode.getEdgeSet(); + for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator.next(); + if (!conflictEdge.getVertexU().equals(newNode) + && conflictNodeSet.contains(conflictEdge.getVertexU()) && isFineNode(conflictEdge.getVertexU()) ) { + count++; + } else if (!conflictEdge.getVertexV().equals(newNode) + && conflictNodeSet.contains(conflictEdge.getVertexV()) && isFineNode(conflictEdge.getVertexU()) ) { + count++; + } + } + + if (count == conflictNodeSet.size()) { + // connected to all current nodes in group + return newNode; + } + + return null; + + } + + + public ConflictNode getNewNodeConnectedWithGroup(ConflictEdge newEdge) { + + // check whether or not the new node has a fine-grained edges to all + // current nodes. + + ConflictNode newNode; + if (conflictNodeSet.contains(newEdge.getVertexU())) { + newNode = newEdge.getVertexV(); + } else if(conflictNodeSet.contains(newEdge.getVertexV())){ + newNode = newEdge.getVertexU(); + }else{ + return null; + } + + int count = 0; + HashSet edgeSet = newNode.getEdgeSet(); + for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator.next(); + if (!conflictEdge.getVertexU().equals(newNode) + && conflictNodeSet.contains(conflictEdge.getVertexU())) { + count++; + } else if (!conflictEdge.getVertexV().equals(newNode) + && conflictNodeSet.contains(conflictEdge.getVertexV())) { + count++; + } + } + + if (count == conflictNodeSet.size()) { + // connected to all current nodes in group + return newNode; + } + + return null; + + } + public void addEdge(ConflictEdge edge){ conflictNodeSet.add(edge.getVertexU()); conflictNodeSet.add(edge.getVertexV()); diff --git a/Robust/src/Analysis/MLP/StallSiteNode.java b/Robust/src/Analysis/MLP/StallSiteNode.java index 8c48ec6f..6afd0de3 100644 --- a/Robust/src/Analysis/MLP/StallSiteNode.java +++ b/Robust/src/Analysis/MLP/StallSiteNode.java @@ -27,7 +27,7 @@ public class StallSiteNode extends ConflictNode { } public String toString(){ - String str="StallSiteNode "+id; + String str="StallSiteNode "+id +" type="+type; return str; }