From df7cc70e62453da8c56acee029bb5e99b7527582 Mon Sep 17 00:00:00 2001 From: yeom Date: Mon, 30 Nov 2009 20:36:28 +0000 Subject: [PATCH] changes. --- Robust/src/Analysis/MLP/ConflictGraph.java | 252 ++++++++++++++++-- Robust/src/Analysis/MLP/ConflictNode.java | 22 ++ .../MLP/GloballyUniqueTokenTuple.java | 65 +++++ Robust/src/Analysis/MLP/LiveInNode.java | 49 +++- Robust/src/Analysis/MLP/MLPAnalysis.java | 226 +++++++++++----- Robust/src/Analysis/MLP/StallSiteNode.java | 14 +- 6 files changed, 527 insertions(+), 101 deletions(-) create mode 100644 Robust/src/Analysis/MLP/GloballyUniqueTokenTuple.java diff --git a/Robust/src/Analysis/MLP/ConflictGraph.java b/Robust/src/Analysis/MLP/ConflictGraph.java index 63fb010b..79a2c383 100644 --- a/Robust/src/Analysis/MLP/ConflictGraph.java +++ b/Robust/src/Analysis/MLP/ConflictGraph.java @@ -9,27 +9,190 @@ import java.util.Set; 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 class ConflictGraph { - public Hashtable td2cn; + public Hashtable id2cn; public ConflictGraph() { - td2cn = new Hashtable(); + id2cn = new Hashtable(); + } + + public void analyzeConflicts() { + Set keySet = id2cn.keySet(); + for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { + String nodeID = (String) iterator.next(); + ConflictNode node = id2cn.get(nodeID); + analyzePossibleConflicts(node); + } + } + + public void analyzePossibleConflicts(ConflictNode node) { + + // compare with all nodes + + Set nodeReachabilitySet = node.getReachabilitySet(); + + Set> set = id2cn.entrySet(); + for (Iterator iterator = set.iterator(); iterator.hasNext();) { + Entry entry = (Entry) iterator + .next(); + + String currentNodeID = entry.getKey(); + ConflictNode currentNode = entry.getValue(); + + if ((node instanceof StallSiteNode) + && (currentNode instanceof StallSiteNode)) { + continue; + } + + if (currentNodeID.equals(node.getID())) { + continue; + } + + Set currentNodeReachabilitySet = currentNode + .getReachabilitySet(); + + Set 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); + } + } + } + + public boolean containsTokenTuple(Set overlapSet, + String uniqueID) { + + for (Iterator iterator = overlapSet.iterator(); iterator.hasNext();) { + GloballyUniqueTokenTuple globallyUniqueTokenTuple = (GloballyUniqueTokenTuple) iterator + .next(); + if (globallyUniqueTokenTuple.getID().equals(uniqueID)) { + return true; + } + } + + return false; + + } + + private int decideConflictEdgeType( + Set overlapSet, + StallSiteNode stallSiteNode, LiveInNode liveInNode) { + + Set liveInWriteEffectSet = liveInNode + .getWriteEffectsSet(); + + if (liveInWriteEffectSet != null) { + for (Iterator iterator = liveInWriteEffectSet.iterator(); iterator + .hasNext();) { + SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator + .next(); + String hrnUniqueID = seseEffectsKey.getHRNUniqueId(); + + if (containsTokenTuple(overlapSet, hrnUniqueID)) { + return ConflictEdge.COARSE_GRAIN_EDGE; + } + } + } + + return ConflictEdge.FINE_GRAIN_EDGE; + } + + private int decideConflictEdgeType( + Set overlapSet, LiveInNode liveInNodeA, + LiveInNode liveInNodeB) { + + Set liveInWriteEffectSetA = liveInNodeA + .getWriteEffectsSet(); + + if (liveInWriteEffectSetA != null) { + for (Iterator iterator = liveInWriteEffectSetA.iterator(); iterator + .hasNext();) { + SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator + .next(); + String hrnUniqueID = seseEffectsKey.getHRNUniqueId(); + + if (containsTokenTuple(overlapSet, hrnUniqueID)) { + return ConflictEdge.COARSE_GRAIN_EDGE; + } + } + } + + Set liveInWriteEffectSetB = liveInNodeB + .getWriteEffectsSet(); + + if (liveInWriteEffectSetB != null) { + for (Iterator iterator = liveInWriteEffectSetB.iterator(); iterator + .hasNext();) { + SESEEffectsKey seseEffectsKey = (SESEEffectsKey) iterator + .next(); + String hrnUniqueID = seseEffectsKey.getHRNUniqueId(); + + if (containsTokenTuple(overlapSet, hrnUniqueID)) { + return ConflictEdge.COARSE_GRAIN_EDGE; + } + } + } + + return 0; + } + + private Set calculateOverlappedReachableRegion( + Set setA, Set setB) { + + Set returnSet = new HashSet(); + + for (Iterator iterator2 = setA.iterator(); iterator2.hasNext();) { + Set tokenTupleSetA = (Set) iterator2.next(); + + for (Iterator iterator3 = setB.iterator(); iterator3.hasNext();) { + Set tokenTupleSetB = (Set) iterator3.next(); + + if (tokenTupleSetA.equals(tokenTupleSetB)) { + // reachability states are overlapped + Iterator ttsIter = tokenTupleSetA.iterator(); + while (ttsIter.hasNext()) { + GloballyUniqueTokenTuple tt = (GloballyUniqueTokenTuple) ttsIter + .next(); + returnSet.add(tt); + } + } + } + } + return returnSet; } public String addStallNode(TempDescriptor td, FlatMethod fm, - StallSite stallSite) { + StallSite stallSite, Set reachabilitySet) { String stallNodeID = td + "_" + fm.getMethod().getSymbol(); - if (!td2cn.containsKey(stallNodeID)) { + if (!id2cn.containsKey(stallNodeID)) { StallSiteNode newNode = new StallSiteNode(stallNodeID, td, - stallSite); - td2cn.put(stallNodeID, newNode); + stallSite, reachabilitySet); + id2cn.put(stallNodeID, newNode); // it add new new stall node to conflict graph return stallNodeID; } @@ -39,7 +202,7 @@ public class ConflictGraph { } public StallSiteNode getStallNode(String stallNodeID) { - ConflictNode node = td2cn.get(stallNodeID); + ConflictNode node = id2cn.get(stallNodeID); if (node instanceof StallSiteNode) { return (StallSiteNode) node; } else { @@ -49,13 +212,31 @@ public class ConflictGraph { public void addLiveInNode(TempDescriptor td, FlatSESEEnterNode fsen, Set readEffectsSet, - Set writeEffectsSet) { + Set writeEffectsSet, Set reachabilitySet) { String liveinNodeID = td + "_" + fsen.getIdentifier(); - LiveInNode newNode = new LiveInNode(liveinNodeID, td, readEffectsSet, - writeEffectsSet); - td2cn.put(liveinNodeID, newNode); + 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); + } + + } + + 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); + } } @@ -70,10 +251,10 @@ public class ConflictGraph { public HashSet getLiveInNodeSet() { HashSet resultSet = new HashSet(); - Set keySet = td2cn.keySet(); + Set keySet = id2cn.keySet(); for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { String key = (String) iterator.next(); - ConflictNode node = td2cn.get(key); + ConflictNode node = id2cn.get(key); if (node instanceof LiveInNode) { resultSet.add((LiveInNode) node); @@ -93,14 +274,23 @@ public class ConflictGraph { HashSet visited = new HashSet(); // then visit every heap region node - Set> s = td2cn.entrySet(); + Set> s = id2cn.entrySet(); Iterator> i = s.iterator(); - - HashSet addedSet=new HashSet(); - + + HashSet addedSet = new HashSet(); + while (i.hasNext()) { Entry 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; + // } + String attributes = "["; attributes += "label=\"ID" + node.getID() + "\\n"; @@ -118,9 +308,22 @@ public class ConflictGraph { 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)){ + if (!addedSet.contains(conflictEdge)) { bw.write(" " + u.getID() + "--" + v.getID() + "[label=\"" + conflictEdge.toGraphEdgeString() @@ -147,7 +350,8 @@ class ConflictEdge { private int type; public static final int WRITE_CONFLICT = 0; - public static final int REACH_CONFLICT = 1; + public static final int FINE_GRAIN_EDGE = 1; + public static final int COARSE_GRAIN_EDGE = 2; public ConflictEdge(ConflictNode u, ConflictNode v, int type) { this.u = u; @@ -158,8 +362,10 @@ class ConflictEdge { public String toGraphEdgeString() { if (type == WRITE_CONFLICT) { return "W_CONFLICT"; + } else if (type == FINE_GRAIN_EDGE) { + return "F_CONFLICT"; } else { - return "R_CONFLICT"; + return "C_CONFLICT"; } } @@ -170,8 +376,8 @@ class ConflictEdge { public ConflictNode getVertexV() { return v; } - - public int getType(){ + + public int getType() { return type; } diff --git a/Robust/src/Analysis/MLP/ConflictNode.java b/Robust/src/Analysis/MLP/ConflictNode.java index 623def2f..d2ba07f0 100644 --- a/Robust/src/Analysis/MLP/ConflictNode.java +++ b/Robust/src/Analysis/MLP/ConflictNode.java @@ -1,7 +1,10 @@ package Analysis.MLP; import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import Analysis.OwnershipAnalysis.TokenTupleSet; import IR.Flat.TempDescriptor; public abstract class ConflictNode { @@ -9,6 +12,7 @@ public abstract class ConflictNode { protected TempDescriptor td; protected String id; protected HashSet edgeSet; + protected Set reachabilitySet; public ConflictNode() { edgeSet = new HashSet(); @@ -22,6 +26,20 @@ public abstract class ConflictNode { return id; } + public boolean isConflictConnectedTo(ConflictNode node) { + + for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) { + ConflictEdge edge = (ConflictEdge) iterator.next(); + if (edge.getType() != ConflictEdge.WRITE_CONFLICT) { + if (edge.getVertexU().equals(node) + || edge.getVertexV().equals(node)) { + return true; + } + } + } + return false; + } + public void addEdge(ConflictEdge edge) { edgeSet.add(edge); } @@ -30,4 +48,8 @@ public abstract class ConflictNode { return edgeSet; } + public Set getReachabilitySet() { + return reachabilitySet; + } + } diff --git a/Robust/src/Analysis/MLP/GloballyUniqueTokenTuple.java b/Robust/src/Analysis/MLP/GloballyUniqueTokenTuple.java new file mode 100644 index 00000000..adb270a7 --- /dev/null +++ b/Robust/src/Analysis/MLP/GloballyUniqueTokenTuple.java @@ -0,0 +1,65 @@ +package Analysis.MLP; + +import Analysis.OwnershipAnalysis.TokenTuple; + +public class GloballyUniqueTokenTuple { + + private Integer token; + private boolean isMultiObject; + private int arity; + private String id; + + public GloballyUniqueTokenTuple(String uniqueID, TokenTuple tt) { + this.id = uniqueID; + this.arity = tt.getArity(); + this.token = tt.getToken(); + this.isMultiObject = tt.isMultiObject(); + } + + public boolean isMultiObject() { + return isMultiObject; + } + + public int getArity() { + return arity; + } + + public int hashCode() { + return id.hashCode() + arity; + } + + public String getID() { + return id; + } + + public boolean equals(Object o) { + if (o == null) { + return false; + } + + if (!(o instanceof GloballyUniqueTokenTuple)) { + return false; + } + + GloballyUniqueTokenTuple tt = (GloballyUniqueTokenTuple) o; + + return id.equals(tt.getID()) && arity == tt.getArity(); + } + + public String toString() { + String s = id; + + if (isMultiObject) { + s += "M"; + } + + if (arity == TokenTuple.ARITY_ZEROORMORE) { + s += "*"; + } else if (arity == TokenTuple.ARITY_ONEORMORE) { + s += "+"; + } + + return s; + } + +} diff --git a/Robust/src/Analysis/MLP/LiveInNode.java b/Robust/src/Analysis/MLP/LiveInNode.java index f2898219..9d2b7abc 100644 --- a/Robust/src/Analysis/MLP/LiveInNode.java +++ b/Robust/src/Analysis/MLP/LiveInNode.java @@ -14,11 +14,38 @@ public class LiveInNode extends ConflictNode { public LiveInNode(String id, TempDescriptor td, Set readEffectsSet, - Set writeEffectsSet) { + Set writeEffectsSet, Set reachabilitySet) { this.id = id; this.td = td; this.readEffectsSet = readEffectsSet; this.writeEffectsSet = writeEffectsSet; + this.reachabilitySet = reachabilitySet; + } + + public Set getReadEffectsSet() { + return readEffectsSet; + } + + public Set getWriteEffectsSet() { + return writeEffectsSet; + } + + public void addReadEffectsSet(Set newReadEffectsSet) { + if (newReadEffectsSet != null) { + readEffectsSet.addAll(newReadEffectsSet); + } + } + + public void addWriteEffectsSet(Set newWriteEffectsSet) { + if (newWriteEffectsSet != null) { + writeEffectsSet.addAll(newWriteEffectsSet); + } + } + + public void addReachabilitySet(Set newReachabilitySet) { + if (newReachabilitySet != null) { + reachabilitySet.addAll(newReachabilitySet); + } } public boolean isWriteConflictWith(StallSiteNode stallNode) { @@ -105,4 +132,24 @@ public class LiveInNode extends ConflictNode { return result; } + public boolean equals(Object o) { + + if (o == null) { + return false; + } + + if (!(o instanceof LiveInNode)) { + return false; + } + + LiveInNode in = (LiveInNode) o; + + if (id.equals(in.id)) { + return true; + } else { + return false; + } + + } + } diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 437603cc..ed1d7aec 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -27,6 +27,7 @@ import Analysis.OwnershipAnalysis.OwnershipNode; import Analysis.OwnershipAnalysis.ParameterDecomposition; import Analysis.OwnershipAnalysis.ReachabilitySet; import Analysis.OwnershipAnalysis.ReferenceEdge; +import Analysis.OwnershipAnalysis.TokenTuple; import Analysis.OwnershipAnalysis.TokenTupleSet; import IR.Descriptor; import IR.FieldDescriptor; @@ -38,6 +39,7 @@ import IR.Flat.FKind; import IR.Flat.FlatCall; import IR.Flat.FlatEdge; import IR.Flat.FlatFieldNode; +import IR.Flat.FlatLiteralNode; import IR.Flat.FlatMethod; import IR.Flat.FlatNew; import IR.Flat.FlatNode; @@ -1884,7 +1886,7 @@ public class MLPAnalysis { return sorted; } - + /* private void postSESEConflictsForward(JavaCallGraph javaCallGraph) { // store the reachability set in stall site data structure @@ -1978,7 +1980,7 @@ public class MLPAnalysis { } } - + */ private void postConflicts_nodeAction(MethodContext mc, FlatNode fn, ParentChildConflictsMap currentConflictsMap) { @@ -2033,112 +2035,179 @@ public class MLPAnalysis { // create conflict graph for each flat method ConflictGraph conflictGraph = new ConflictGraph(); - Set flatNodesToVisit = new HashSet(); - flatNodesToVisit.add(fm); - - Set visited = new HashSet(); + HashSet mcSet = ownAnalysisForSESEConflicts + .getAllMethodContextSetByDescriptor(fm.getMethod()); + Iterator mcIter = mcSet.iterator(); - while (!flatNodesToVisit.isEmpty()) { - Iterator fnItr = flatNodesToVisit.iterator(); - FlatNode fn = fnItr.next(); + while (mcIter.hasNext()) { + MethodContext mc = mcIter.next(); - flatNodesToVisit.remove(fn); - visited.add(fn); + Set flatNodesToVisit = new HashSet(); + flatNodesToVisit.add(fm); - // /////////////////////////////////////////////////////////////////////// - // Adding Stall Node of current program statement - ParentChildConflictsMap currentConflictsMap = conflictsResults - .get(fn); + Set visited = new HashSet(); - Hashtable stallMap = currentConflictsMap - .getStallMap(); - Set> entrySet = stallMap - .entrySet(); + while (!flatNodesToVisit.isEmpty()) { + Iterator fnItr = flatNodesToVisit.iterator(); + FlatNode fn = fnItr.next(); - HashSet newStallNodeSet = new HashSet(); + flatNodesToVisit.remove(fn); + visited.add(fn); - for (Iterator> iterator2 = entrySet - .iterator(); iterator2.hasNext();) { - Entry entry = iterator2.next(); - TempDescriptor td = entry.getKey(); - StallSite stallSite = entry.getValue(); - String stallNodeID; - if ((stallNodeID = conflictGraph - .addStallNode(td, fm, stallSite)) != null) { - // it added new stall node - newStallNodeSet.add(stallNodeID); + // /////////////////////////////////////////////////////////////////////// + // Adding Stall Node of current program statement + ParentChildConflictsMap currentConflictsMap = conflictsResults + .get(fn); + + Hashtable stallMap = currentConflictsMap + .getStallMap(); + Set> entrySet = stallMap + .entrySet(); + + HashSet newStallNodeSet = new HashSet(); + + for (Iterator> iterator2 = entrySet + .iterator(); iterator2.hasNext();) { + Entry entry = iterator2.next(); + TempDescriptor td = entry.getKey(); + StallSite stallSite = entry.getValue(); + String stallNodeID; + + // reachability set + OwnershipGraph og = ownAnalysisForSESEConflicts + .getOwnvershipGraphByMethodContext(mc); + 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(); - - 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 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); + // Analyzing write conflicts between stall site and live-in + // variables + for (Iterator iterator = newStallNodeSet.iterator(); iterator + .hasNext();) { + String stallNodeID = (String) iterator.next(); + + 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 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(fm, fn, conflictGraph, currentConflictsMap); + conflictGraph_nodeAction(mc, fm, fn, conflictGraph, + currentConflictsMap); - for (int i = 0; i < fn.numNext(); i++) { - FlatNode nn = fn.getNext(i); - if (!visited.contains(nn)) { - flatNodesToVisit.add(nn); + for (int i = 0; i < fn.numNext(); i++) { + FlatNode nn = fn.getNext(i); + if (!visited.contains(nn)) { + flatNodesToVisit.add(nn); + } } - } - } + + } // end of while(flatNodesToVisit) + + } // end of while(mcIter) + + // decide fine-grain edge or coarse-grain edge among all vertexes + conflictGraph.analyzeConflicts(); conflictGraphResults.put(fm, conflictGraph); } - private void conflictGraph_nodeAction(FlatMethod fm, FlatNode fn, - ConflictGraph graph, ParentChildConflictsMap currentConflictsMap) { + private Set calculateReachabilitySet(OwnershipGraph og, TempDescriptor tempDescriptor){ + // reachability set + Set reachabilitySet = new HashSet(); + LabelNode ln = og.td2ln.get(tempDescriptor); + Iterator refEdgeIter = ln + .iteratorToReferencees(); + while (refEdgeIter.hasNext()) { + ReferenceEdge referenceEdge = (ReferenceEdge) refEdgeIter + .next(); + ReachabilitySet set = referenceEdge.getBeta(); + Iterator ttsIter = set.iterator(); + while (ttsIter.hasNext()) { + TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter + .next(); + + HashSet newTokenTupleSet = new HashSet(); + // reachabilitySet.add(tokenTupleSet); + + Iterator iter = tokenTupleSet.iterator(); + while (iter.hasNext()) { + TokenTuple tt = (TokenTuple) iter.next(); + int token = tt.getToken(); + String uniqueID = og.id2hrn.get( + new Integer(token)) + .getGloballyUniqueIdentifier(); + GloballyUniqueTokenTuple gtt = new GloballyUniqueTokenTuple( + uniqueID, tt); + newTokenTupleSet.add(gtt); + } + + reachabilitySet.add(newTokenTupleSet); + } + } + return reachabilitySet; + } + + private void conflictGraph_nodeAction(MethodContext mc, FlatMethod fm, FlatNode fn, + ConflictGraph graph, + ParentChildConflictsMap currentConflictsMap) { switch (fn.kind()) { case FKind.FlatSESEEnterNode: { FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn; + OwnershipGraph og = ownAnalysisForSESEConflicts + .getOwnvershipGraphByMethodContext(mc); if (!fsen.getIsCallerSESEplaceholder()) { Set invar_set = fsen.getInVarSet(); - String liveinStr = ""; - for (Iterator iterator = invar_set.iterator(); iterator .hasNext();) { TempDescriptor tempDescriptor = (TempDescriptor) iterator .next(); - + + // effects set SESEEffectsSet seseEffectsSet = fsen.getSeseEffectsSet(); - Set readEffectsSet=seseEffectsSet.getReadingSet(tempDescriptor); - Set writeEffectsSet=seseEffectsSet.getWritingSet(tempDescriptor); - - graph.addLiveInNode(tempDescriptor,fsen,readEffectsSet,writeEffectsSet); + Set readEffectsSet = seseEffectsSet + .getReadingSet(tempDescriptor); + Set writeEffectsSet = seseEffectsSet + .getWritingSet(tempDescriptor); + + Set reachabilitySet=calculateReachabilitySet(og,tempDescriptor); + + // add new live-in node + graph.addLiveInNode(tempDescriptor, fsen, readEffectsSet, + writeEffectsSet, reachabilitySet); + } } - + } break; @@ -2358,9 +2427,10 @@ public class MLPAnalysis { } } - }else{ - System.out.println("src is accessible="+possibleSrc); } +// else{ +// System.out.println("src is accessible="+possibleSrc); +// } currentConflictsMap.addAccessibleVar(possibleSrc); @@ -2665,6 +2735,18 @@ public class MLPAnalysis { } break; + /* do we need this case? + case FKind.FlatLiteralNode: { + + if (currentConflictsMap.isAfterChildSESE()) { + FlatLiteralNode fln = (FlatLiteralNode) fn; + TempDescriptor dst = fln.getDst(); + currentConflictsMap.addAccessibleVar(dst); + } + + } break; + */ + case FKind.FlatReturnNode: { FlatReturnNode frn = (FlatReturnNode) fn; diff --git a/Robust/src/Analysis/MLP/StallSiteNode.java b/Robust/src/Analysis/MLP/StallSiteNode.java index e5d57421..5797028a 100644 --- a/Robust/src/Analysis/MLP/StallSiteNode.java +++ b/Robust/src/Analysis/MLP/StallSiteNode.java @@ -1,25 +1,29 @@ package Analysis.MLP; import java.util.HashSet; +import java.util.Set; import Analysis.OwnershipAnalysis.HeapRegionNode; +import Analysis.OwnershipAnalysis.TokenTupleSet; import IR.Flat.TempDescriptor; public class StallSiteNode extends ConflictNode { protected StallSite stallSite; - public StallSiteNode(String id, TempDescriptor td, StallSite stallSite) { + public StallSiteNode(String id, TempDescriptor td, StallSite stallSite, + Set reachabilitySet) { this.id = id; this.td = td; this.stallSite = stallSite; + this.reachabilitySet = reachabilitySet; } - - public HashSet getHRNSet(){ + + public HashSet getHRNSet() { return stallSite.getHRNSet(); } - - public StallSite getStallSite(){ + + public StallSite getStallSite() { return stallSite; } -- 2.34.1