import java.util.Map.Entry;
import Analysis.OwnershipAnalysis.HeapRegionNode;
-import Analysis.OwnershipAnalysis.TokenTuple;
import IR.Flat.FlatMethod;
import IR.Flat.FlatSESEEnterNode;
import IR.Flat.TempDescriptor;
}
public void analyzeConflicts() {
+
Set<String> keySet = id2cn.keySet();
+ Set<String> analyzedIDSet = new HashSet<String>();
+
for (Iterator iterator = keySet.iterator(); iterator.hasNext();) {
String nodeID = (String) iterator.next();
ConflictNode node = id2cn.get(nodeID);
- analyzePossibleConflicts(node);
+ analyzePossibleConflicts(analyzedIDSet, node);
}
}
- public void analyzePossibleConflicts(ConflictNode node) {
+ private boolean isWriteConflicts(StallSiteNode nodeA, LiveInNode nodeB) {
- // compare with all nodes
+ boolean result = false;
+ StallSite stallSite = nodeA.getStallSite();
- Set<Set> nodeReachabilitySet = node.getReachabilitySet();
+ Set<SESEEffectsKey> writeEffectsSet = nodeB.getWriteEffectsSet();
+ Set<SESEEffectsKey> readEffectsSet = nodeB.getReadEffectsSet();
- Set<Entry<String, ConflictNode>> set = id2cn.entrySet();
- for (Iterator iterator = set.iterator(); iterator.hasNext();) {
- Entry<String, ConflictNode> entry = (Entry<String, ConflictNode>) iterator
- .next();
+ if (writeEffectsSet != null) {
+ Iterator<SESEEffectsKey> writeIter = writeEffectsSet.iterator();
+ while (writeIter.hasNext()) {
+ SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIter
+ .next();
+ String writeHeapRegionID = seseEffectsKey.getHRNUniqueId();
+ String writeFieldName = seseEffectsKey.getFieldDescriptor();
+
+ HashSet<HeapRegionNode> stallSiteHRNSet = nodeA.getHRNSet();
+ for (Iterator iterator = stallSiteHRNSet.iterator(); iterator
+ .hasNext();) {
+ HeapRegionNode stallHRN = (HeapRegionNode) iterator.next();
+ if (stallHRN.getGloballyUniqueIdentifier().equals(
+ writeHeapRegionID)) {
+
+ // check whether there are read or write effects of
+ // stall sites
+
+ HashSet<Effect> effectSet = stallSite.getEffectSet();
+ for (Iterator iterator2 = effectSet.iterator(); iterator2
+ .hasNext();) {
+ Effect effect = (Effect) iterator2.next();
+ String stallEffectfieldName = effect.getField();
+
+ if (stallEffectfieldName.equals(writeFieldName)) {
+ result = result | true;
+ }
+ }
- String currentNodeID = entry.getKey();
- ConflictNode currentNode = entry.getValue();
+ }
+ }
- if ((node instanceof StallSiteNode)
- && (currentNode instanceof StallSiteNode)) {
- continue;
}
+ }
- if (currentNodeID.equals(node.getID())) {
- continue;
- }
+ if (readEffectsSet != null) {
+ Iterator<SESEEffectsKey> readIter = readEffectsSet.iterator();
+ while (readIter.hasNext()) {
+
+ SESEEffectsKey seseEffectsKey = (SESEEffectsKey) readIter
+ .next();
+ String readHeapRegionID = seseEffectsKey.getHRNUniqueId();
+ String readFieldName = seseEffectsKey.getFieldDescriptor();
+
+ HashSet<HeapRegionNode> stallSiteHRNSet = nodeA.getHRNSet();
+ for (Iterator iterator = stallSiteHRNSet.iterator(); iterator
+ .hasNext();) {
+ HeapRegionNode stallHRN = (HeapRegionNode) iterator.next();
+ if (stallHRN.getGloballyUniqueIdentifier().equals(
+ readHeapRegionID)) {
+
+ HashSet<Effect> effectSet = stallSite.getEffectSet();
+ for (Iterator iterator2 = effectSet.iterator(); iterator2
+ .hasNext();) {
+ Effect effect = (Effect) iterator2.next();
+ String stallEffectfieldName = effect.getField();
+
+ if (effect.getEffectType().equals(
+ StallSite.WRITE_EFFECT)) {
+ if (stallEffectfieldName.equals(readFieldName)) {
+ result = result | true;
+ }
+ }
+
+ }
+
+ }
- Set<Set> currentNodeReachabilitySet = currentNode
- .getReachabilitySet();
-
- Set<GloballyUniqueTokenTuple> overlapSet = calculateOverlappedReachableRegion(
- nodeReachabilitySet, currentNodeReachabilitySet);
- if (overlapSet.size() > 0) {
-
- // System.out.println("OVERLAPPED=" + overlapSet);
-
- if (node instanceof StallSiteNode
- && currentNode instanceof LiveInNode) {
- int edgeType = decideConflictEdgeType(overlapSet,
- (StallSiteNode) node, (LiveInNode) currentNode);
- addConflictEdge(edgeType, node, currentNode);
- } else if (node instanceof LiveInNode
- && currentNode instanceof LiveInNode) {
- int edgeType = decideConflictEdgeType(overlapSet,
- (LiveInNode) node, (LiveInNode) currentNode);
- addConflictEdge(edgeType, node, currentNode);
}
- } else {
- // System.out.println("DOSE NOT OVERLAPPED " + node + " <-> "
- // + currentNode);
}
}
+
+ return result;
}
- public boolean containsTokenTuple(Set<GloballyUniqueTokenTuple> overlapSet,
- String uniqueID) {
+ private int determineWriteConflictsType(LiveInNode liveInNodeA,
+ LiveInNode liveInNodeB) {
- for (Iterator iterator = overlapSet.iterator(); iterator.hasNext();) {
- GloballyUniqueTokenTuple globallyUniqueTokenTuple = (GloballyUniqueTokenTuple) iterator
- .next();
- if (globallyUniqueTokenTuple.getID().equals(uniqueID)) {
- return true;
+ Set<HeapRegionNode> liveInHrnSetA = liveInNodeA.getHRNSet();
+ Set<HeapRegionNode> liveInHrnSetB = liveInNodeB.getHRNSet();
+
+ boolean isPointingToSameRegion = compareHRNSet(liveInHrnSetA,
+ liveInHrnSetB);
+
+ boolean isSharingReachability = false;
+
+ Set<Set> liveInNodeReachabilitySetA = liveInNodeA.getReachabilitySet();
+ Set<Set> liveInNodeReachabilitySetB = liveInNodeB.getReachabilitySet();
+
+ Set<GloballyUniqueTokenTuple> overlappedReachableRegionSet = calculateOverlappedReachableRegion(
+ liveInNodeReachabilitySetA, liveInNodeReachabilitySetB);
+ if (overlappedReachableRegionSet.size() > 0) {
+ isSharingReachability = true;
+ }
+
+ if (isPointingToSameRegion && isSharingReachability) {
+ // two node share same reachability and points to same region, then
+ // it is fine grain conflicts
+ return ConflictEdge.FINE_GRAIN_EDGE;
+ } else if (isSharingReachability) {
+ // two node share same reachability but points to different region,
+ // then it is coarse grain conflicts
+ return ConflictEdge.COARSE_GRAIN_EDGE;
+ } else {
+ // otherwise, it is not write conflicts
+ return ConflictEdge.NON_WRITE_CONFLICT;
+ }
+
+ }
+
+ private boolean compareHRNSet(Set<HeapRegionNode> setA,
+ Set<HeapRegionNode> setB) {
+
+ for (Iterator iterator = setA.iterator(); iterator.hasNext();) {
+ HeapRegionNode heapRegionNode = (HeapRegionNode) iterator.next();
+ String gID = heapRegionNode.getGloballyUniqueIdentifier();
+ boolean found = false;
+ for (Iterator iterator2 = setB.iterator(); iterator2.hasNext();) {
+ HeapRegionNode heapRegionNode2 = (HeapRegionNode) iterator2
+ .next();
+ if (heapRegionNode2.getGloballyUniqueIdentifier().equals(gID)) {
+ found = true;
+ }
+ }
+ if (!found) {
+ return false;
}
}
+ return true;
+ }
- return false;
+ private int determineWriteConflictsType(StallSiteNode stallNode,
+ LiveInNode liveInNode) {
+
+ System.out.println("determine write ocnflict type between " + stallNode
+ + "<->" + liveInNode);
+
+ Set<HeapRegionNode> stallHrnSet = stallNode.getHRNSet();
+ Set<HeapRegionNode> liveInHrnSet = liveInNode.getHRNSet();
+
+ System.out.println("stallHrnSet=" + stallHrnSet);
+ System.out.println("liveInHrnSet=" + liveInHrnSet);
+
+ boolean isPointingToSameRegion = compareHRNSet(stallHrnSet,
+ liveInHrnSet);
+ System.out.println("isporintTosameRegion=" + isPointingToSameRegion);
+
+ boolean isSharingReachability = false;
+
+ Set<Set> stallNodeReachabilitySet = stallNode.getReachabilitySet();
+ Set<Set> liveInNodeReachabilitySet = liveInNode.getReachabilitySet();
+
+ Set<GloballyUniqueTokenTuple> overlappedReachableRegionSet = calculateOverlappedReachableRegion(
+ stallNodeReachabilitySet, liveInNodeReachabilitySet);
+ if (overlappedReachableRegionSet.size() > 0) {
+ isSharingReachability = true;
+ }
+ System.out.println("isSharingReachability=" + isSharingReachability);
+
+ if (isPointingToSameRegion && isSharingReachability) {
+ // two node share same reachability and points to same region, then
+ // it is fine grain conflicts
+ return ConflictEdge.FINE_GRAIN_EDGE;
+ } else if (isSharingReachability) {
+ // two node share same reachability but points to different region,
+ // then it is coarse grain conflicts
+ return ConflictEdge.COARSE_GRAIN_EDGE;
+ } else {
+ // otherwise, it is not write conflicts
+ return ConflictEdge.NON_WRITE_CONFLICT;
+ }
}
- private int decideConflictEdgeType(
- Set<GloballyUniqueTokenTuple> overlapSet,
- StallSiteNode stallSiteNode, LiveInNode liveInNode) {
+ private boolean isWriteConflicts(LiveInNode nodeA, LiveInNode nodeB) {
- Set<SESEEffectsKey> liveInWriteEffectSet = liveInNode
- .getWriteEffectsSet();
+ Set<SESEEffectsKey> readEffectsSetA = nodeA.getReadEffectsSet();
+ Set<SESEEffectsKey> writeEffectsSetA = nodeA.getWriteEffectsSet();
+ Set<SESEEffectsKey> readEffectsSetB = nodeB.getReadEffectsSet();
+ Set<SESEEffectsKey> writeEffectsSetB = nodeB.getWriteEffectsSet();
- if (liveInWriteEffectSet != null) {
- for (Iterator iterator = liveInWriteEffectSet.iterator(); iterator
- .hasNext();) {
- SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator
+ // if node A has write effects on reading/writing regions of node B
+ if (writeEffectsSetA != null) {
+ Iterator<SESEEffectsKey> writeIterA = writeEffectsSetA.iterator();
+ while (writeIterA.hasNext()) {
+ SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIterA
.next();
- String hrnUniqueID = seseEffectsKey.getHRNUniqueId();
+ String writeHeapRegionID = seseEffectsKey.getHRNUniqueId();
+ String writeFieldName = seseEffectsKey.getFieldDescriptor();
+
+ if (readEffectsSetB != null) {
+ Iterator<SESEEffectsKey> readIterB = readEffectsSetB
+ .iterator();
+ while (readIterB.hasNext()) {
+ SESEEffectsKey readingEffect = (SESEEffectsKey) readIterB
+ .next();
+
+ if (readingEffect.getHRNUniqueId().equals(
+ writeHeapRegionID)
+ && readingEffect.getFieldDescriptor().equals(
+ writeFieldName)) {
+ return true;
+ }
+ }
+ }
+
+ if (writeEffectsSetB != null) {
+ Iterator<SESEEffectsKey> writeIterB = writeEffectsSetB
+ .iterator();
+ while (writeIterB.hasNext()) {
+ SESEEffectsKey writingEffect = (SESEEffectsKey) writeIterB
+ .next();
- if (containsTokenTuple(overlapSet, hrnUniqueID)) {
- return ConflictEdge.COARSE_GRAIN_EDGE;
+ if (writingEffect.getHRNUniqueId().equals(
+ writeHeapRegionID)
+ && writingEffect.getFieldDescriptor().equals(
+ writeFieldName)) {
+ return true;
+ }
+ }
}
+
}
}
- return ConflictEdge.FINE_GRAIN_EDGE;
+ // if node B has write effects on reading regions of node A
+ if (writeEffectsSetB != null) {
+ Iterator<SESEEffectsKey> writeIterB = writeEffectsSetB.iterator();
+ while (writeIterB.hasNext()) {
+ SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIterB
+ .next();
+ String writeHeapRegionID = seseEffectsKey.getHRNUniqueId();
+ String writeFieldName = seseEffectsKey.getFieldDescriptor();
+
+ if (readEffectsSetA != null) {
+ Iterator<SESEEffectsKey> readIterA = readEffectsSetA
+ .iterator();
+ while (readIterA.hasNext()) {
+ SESEEffectsKey readingEffect = (SESEEffectsKey) readIterA
+ .next();
+ if (readingEffect.getHRNUniqueId().equals(
+ writeHeapRegionID)
+ && readingEffect.getFieldDescriptor().equals(
+ writeFieldName)) {
+ return true;
+ }
+ }
+ }
+
+ if (writeEffectsSetA != null) {
+ Iterator<SESEEffectsKey> writeIterA = writeEffectsSetA
+ .iterator();
+ while (writeIterA.hasNext()) {
+ SESEEffectsKey writingEffect = (SESEEffectsKey) writeIterA
+ .next();
+ if (writingEffect.getHRNUniqueId().equals(
+ writeHeapRegionID)
+ && writingEffect.getFieldDescriptor().equals(
+ writeFieldName)) {
+ return true;
+ }
+ }
+ }
+
+ }
+ }
+ return false;
}
- private int decideConflictEdgeType(
- Set<GloballyUniqueTokenTuple> overlapSet, LiveInNode liveInNodeA,
- LiveInNode liveInNodeB) {
+ public void analyzePossibleConflicts(Set<String> analyzedIDSet,
+ ConflictNode currentNode) {
- Set<SESEEffectsKey> liveInWriteEffectSetA = liveInNodeA
- .getWriteEffectsSet();
+ // compare with all nodes
- if (liveInWriteEffectSetA != null) {
- for (Iterator iterator = liveInWriteEffectSetA.iterator(); iterator
- .hasNext();) {
- SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator
- .next();
- String hrnUniqueID = seseEffectsKey.getHRNUniqueId();
+ Set<Entry<String, ConflictNode>> set = id2cn.entrySet();
+ for (Iterator iterator = set.iterator(); iterator.hasNext();) {
+ Entry<String, ConflictNode> entry = (Entry<String, ConflictNode>) iterator
+ .next();
+
+ String entryNodeID = entry.getKey();
+ ConflictNode entryNode = entry.getValue();
+
+ if ((!currentNode.getID().equals(entryNodeID))
+ && !(analyzedIDSet.contains(currentNode.getID()
+ + entryNodeID) || analyzedIDSet
+ .contains(entryNodeID + currentNode.getID()))) {
+
+ if (currentNode instanceof StallSiteNode
+ && entryNode instanceof LiveInNode) {
+ if (isWriteConflicts((StallSiteNode) currentNode,
+ (LiveInNode) entryNode)) {
+ int conflictType = determineWriteConflictsType(
+ (StallSiteNode) currentNode,
+ (LiveInNode) entryNode);
+ // System.out.println("WRITE CONFLICT type="
+ // + conflictType + " BETWEEN=" + currentNode
+ // + "<->" + entryNode);
+ if (conflictType > 0) {
+ addConflictEdge(conflictType, currentNode,
+ entryNode);
+ }
+ }
+ analyzedIDSet.add(currentNode.getID() + entryNodeID);
+
+ } else if (currentNode instanceof LiveInNode
+ && entryNode instanceof LiveInNode) {
+ if (isWriteConflicts((LiveInNode) currentNode,
+ (LiveInNode) entryNode)) {
+
+ int conflictType = determineWriteConflictsType(
+ (LiveInNode) currentNode,
+ (LiveInNode) entryNode);
+// System.out.println("WRITE CONFLICT type="
+// + conflictType + " BETWEEN=" + currentNode
+// + "<->" + entryNode);
+ if (conflictType > 0) {
+ addConflictEdge(conflictType, currentNode,
+ entryNode);
+ }
- if (containsTokenTuple(overlapSet, hrnUniqueID)) {
- return ConflictEdge.COARSE_GRAIN_EDGE;
+ }
+ analyzedIDSet.add(currentNode.getID() + entryNodeID);
}
+
}
+
}
- Set<SESEEffectsKey> liveInWriteEffectSetB = liveInNodeB
- .getWriteEffectsSet();
+ }
- if (liveInWriteEffectSetB != null) {
- for (Iterator iterator = liveInWriteEffectSetB.iterator(); iterator
- .hasNext();) {
- SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator
- .next();
- String hrnUniqueID = seseEffectsKey.getHRNUniqueId();
+ public boolean containsTokenTuple(Set<GloballyUniqueTokenTuple> overlapSet,
+ String uniqueID) {
- if (containsTokenTuple(overlapSet, hrnUniqueID)) {
- return ConflictEdge.COARSE_GRAIN_EDGE;
- }
+ for (Iterator iterator = overlapSet.iterator(); iterator.hasNext();) {
+ GloballyUniqueTokenTuple globallyUniqueTokenTuple = (GloballyUniqueTokenTuple) iterator
+ .next();
+ if (globallyUniqueTokenTuple.getID().equals(uniqueID)) {
+ return true;
}
}
- return 0;
+ return false;
+
}
private Set<GloballyUniqueTokenTuple> calculateOverlappedReachableRegion(
}
}
- public void addLiveInNode(TempDescriptor td, FlatSESEEnterNode fsen,
- Set<SESEEffectsKey> readEffectsSet,
+ public void addLiveInNode(TempDescriptor td, Set<HeapRegionNode> hrnSet,
+ FlatSESEEnterNode fsen, Set<SESEEffectsKey> readEffectsSet,
Set<SESEEffectsKey> writeEffectsSet, Set<Set> reachabilitySet) {
String liveinNodeID = td + "_" + fsen.getIdentifier();
- LiveInNode liveInNode = (LiveInNode) id2cn.get(liveinNodeID);
- if (liveInNode != null) {
- liveInNode.addReadEffectsSet(readEffectsSet);
- liveInNode.addWriteEffectsSet(writeEffectsSet);
- liveInNode.addReachabilitySet(reachabilitySet);
- id2cn.put(liveinNodeID, liveInNode);
- } else {
- LiveInNode newNode = new LiveInNode(liveinNodeID, td,
- readEffectsSet, writeEffectsSet, reachabilitySet);
- id2cn.put(liveinNodeID, newNode);
- }
+ LiveInNode newNode = new LiveInNode(liveinNodeID, td, hrnSet,
+ readEffectsSet, writeEffectsSet, reachabilitySet);
+ id2cn.put(liveinNodeID, newNode);
}
public void addConflictEdge(int type, ConflictNode nodeU, ConflictNode nodeV) {
- if (!nodeU.isConflictConnectedTo(nodeV)) {
- ConflictEdge newEdge = new ConflictEdge(nodeU, nodeV, type);
- nodeU.addEdge(newEdge);
- nodeV.addEdge(newEdge);
- }
-
- }
+ ConflictEdge newEdge = new ConflictEdge(nodeU, nodeV, type);
+ nodeU.addEdge(newEdge);
+ nodeV.addEdge(newEdge);
- public void addWriteConflictEdge(StallSiteNode stallNode,
- LiveInNode liveInNode) {
- ConflictEdge newEdge = new ConflictEdge(stallNode, liveInNode,
- ConflictEdge.WRITE_CONFLICT);
- stallNode.addEdge(newEdge);
- liveInNode.addEdge(newEdge);
}
public HashSet<LiveInNode> getLiveInNodeSet() {
Entry<String, ConflictNode> entry = i.next();
ConflictNode node = entry.getValue();
- // if (node.getID().startsWith("___dst")
- // || node.getID().startsWith("___srctmp")
- // || node.getID().startsWith("___neverused")
- // || node.getID().startsWith("___temp")) {
- //
- // continue;
- // }
+ if (node.getID().startsWith("___dst")
+ || node.getID().startsWith("___srctmp")
+ || node.getID().startsWith("___neverused")
+ || node.getID().startsWith("___temp")) {
+
+ continue;
+ }
String attributes = "[";
ConflictNode u = conflictEdge.getVertexU();
ConflictNode v = conflictEdge.getVertexV();
- // String uID=u.getID();
- // String vID=v.getID();
- // if (uID.startsWith("___dst")
- // || uID.startsWith("___srctmp")
- // || uID.startsWith("___neverused")
- // || uID.startsWith("___temp")
- // || vID.startsWith("___dst")
- // || vID.startsWith("___srctmp")
- // || vID.startsWith("___neverused")
- // || vID.startsWith("___temp")) {
- // continue;
- // }
-
- if (conflictEdge.getType() == ConflictEdge.WRITE_CONFLICT) {
- if (!addedSet.contains(conflictEdge)) {
- bw.write(" " + u.getID() + "--" + v.getID()
- + "[label=\""
- + conflictEdge.toGraphEdgeString()
- + "\",decorate];\n");
- addedSet.add(conflictEdge);
- }
+ String uID=u.getID();
+ String vID=v.getID();
+ if (uID.startsWith("___dst")
+ || uID.startsWith("___srctmp")
+ || uID.startsWith("___neverused")
+ || uID.startsWith("___temp")
+ || vID.startsWith("___dst")
+ || vID.startsWith("___srctmp")
+ || vID.startsWith("___neverused")
+ || vID.startsWith("___temp")) {
+ continue;
+ }
+
+ if (!addedSet.contains(conflictEdge)) {
+ bw.write(" " + u.getID() + "--" + v.getID() + "[label=\""
+ + conflictEdge.toGraphEdgeString()
+ + "\",decorate];\n");
+ addedSet.add(conflictEdge);
}
+
}
}
private ConflictNode v;
private int type;
- public static final int WRITE_CONFLICT = 0;
+ 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 String toGraphEdgeString() {
- if (type == WRITE_CONFLICT) {
- return "W_CONFLICT";
- } else if (type == FINE_GRAIN_EDGE) {
+ if (type == FINE_GRAIN_EDGE) {
return "F_CONFLICT";
} else {
return "C_CONFLICT";
Set<Entry<TempDescriptor, StallSite>> entrySet = stallMap
.entrySet();
- HashSet<String> newStallNodeSet = new HashSet<String>();
+// HashSet<String> newStallNodeSet = new HashSet<String>();
for (Iterator<Entry<TempDescriptor, StallSite>> iterator2 = entrySet
.iterator(); iterator2.hasNext();) {
.getOwnvershipGraphByMethodContext(mc);
Set<Set> reachabilitySet = calculateReachabilitySet(og, td);
- if ((stallNodeID = conflictGraph.addStallNode(td, fm,
- stallSite, reachabilitySet)) != null) {
- // it added new stall node
- newStallNodeSet.add(stallNodeID);
- }
- }
-
- // Analyzing write conflicts between stall site and live-in
- // variables
- for (Iterator iterator = newStallNodeSet.iterator(); iterator
- .hasNext();) {
- String stallNodeID = (String) iterator.next();
+ conflictGraph.addStallNode(td, fm, stallSite,
+ reachabilitySet);
- StallSiteNode stallNode = conflictGraph
- .getStallNode(stallNodeID);
-
- if (stallNode != null) {
- // if prior sese blocks have write effects on this stall
- // node, it should be connected between them.
- HashSet<LiveInNode> liveInNodeSet = conflictGraph
- .getLiveInNodeSet();
- for (Iterator iterator2 = liveInNodeSet.iterator(); iterator2
- .hasNext();) {
- LiveInNode liveInNode = (LiveInNode) iterator2
- .next();
- if (liveInNode.isWriteConflictWith(stallNode)) {
- // create conflict edge
- conflictGraph.addWriteConflictEdge(stallNode,
- liveInNode);
- }
- }
- }
}
- // ///////////////////////////////////////////////////////////////////////
-
conflictGraph_nodeAction(mc, fm, fn, conflictGraph,
currentConflictsMap);
} // end of while(mcIter)
- // decide fine-grain edge or coarse-grain edge among all vertexes
+ // decide fine-grain edge or coarse-grain edge among all vertexes by pair-wise comparison
conflictGraph.analyzeConflicts();
conflictGraphResults.put(fm, conflictGraph);
}
- private Set<Set> calculateReachabilitySet(OwnershipGraph og, TempDescriptor tempDescriptor){
+ private Set<Set> calculateReachabilitySet(OwnershipGraph og,
+ TempDescriptor tempDescriptor) {
// reachability set
Set<Set> reachabilitySet = new HashSet();
LabelNode ln = og.td2ln.get(tempDescriptor);
- Iterator<ReferenceEdge> refEdgeIter = ln
- .iteratorToReferencees();
+ Iterator<ReferenceEdge> refEdgeIter = ln.iteratorToReferencees();
while (refEdgeIter.hasNext()) {
- ReferenceEdge referenceEdge = (ReferenceEdge) refEdgeIter
- .next();
+ ReferenceEdge referenceEdge = (ReferenceEdge) refEdgeIter.next();
+
ReachabilitySet set = referenceEdge.getBeta();
Iterator<TokenTupleSet> ttsIter = set.iterator();
while (ttsIter.hasNext()) {
- TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter
- .next();
+ TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter.next();
HashSet<GloballyUniqueTokenTuple> newTokenTupleSet = new HashSet<GloballyUniqueTokenTuple>();
// reachabilitySet.add(tokenTupleSet);
while (iter.hasNext()) {
TokenTuple tt = (TokenTuple) iter.next();
int token = tt.getToken();
- String uniqueID = og.id2hrn.get(
- new Integer(token))
+ String uniqueID = og.id2hrn.get(new Integer(token))
.getGloballyUniqueIdentifier();
GloballyUniqueTokenTuple gtt = new GloballyUniqueTokenTuple(
uniqueID, tt);
return reachabilitySet;
}
- private void conflictGraph_nodeAction(MethodContext mc, FlatMethod fm, FlatNode fn,
- ConflictGraph graph,
+ private void conflictGraph_nodeAction(MethodContext mc, FlatMethod fm,
+ FlatNode fn, ConflictGraph graph,
ParentChildConflictsMap currentConflictsMap) {
switch (fn.kind()) {
Set<SESEEffectsKey> writeEffectsSet = seseEffectsSet
.getWritingSet(tempDescriptor);
- Set<Set> reachabilitySet=calculateReachabilitySet(og,tempDescriptor);
+ Set<Set> reachabilitySet = calculateReachabilitySet(og,
+ tempDescriptor);
// add new live-in node
- graph.addLiveInNode(tempDescriptor, fsen, readEffectsSet,
- writeEffectsSet, reachabilitySet);
+ LabelNode ln = og.td2ln.get(tempDescriptor);
+ Set<HeapRegionNode> hrnSet = new HashSet<HeapRegionNode>();
+ Iterator<ReferenceEdge> refIter = ln
+ .iteratorToReferencees();
+ while (refIter.hasNext()) {
+ ReferenceEdge referenceEdge = (ReferenceEdge) refIter
+ .next();
+ hrnSet.add(referenceEdge.getDst());
+ }
+ graph.addLiveInNode(tempDescriptor, hrnSet, fsen,
+ readEffectsSet, writeEffectsSet, reachabilitySet);
}
}
-
-
-
- /*
- // collects related allocation sites
- Iterator<ReferenceEdge> referenceeIter = ln
- .iteratorToReferencees();
- while (referenceeIter.hasNext()) {
- ReferenceEdge referenceEdge = (ReferenceEdge) referenceeIter
- .next();
- HeapRegionNode dstHRN = referenceEdge.getDst();
- if (dstHRN.isParameter()) {
-
- HashSet<HeapRegionNode> visitedHRN = new HashSet<HeapRegionNode>();
- visitedHRN.add(dstHRN);
- setupRelatedAllocSiteAnalysis(og, mc, dstHRN,
- visitedHRN);
-
- } else {
- addLiveInAllocationSite(mc, dstHRN
- .getAllocationSite());
- }
- }
- */
-
-
- // if(currentConflictsMap.isAfterChildSESE()){
- //
- // }
-
}
private void conflicts_nodeAction(MethodContext mc, FlatNode fn,