From a3d18a106aa8471f0a36ea1ea4e66b99764f9648 Mon Sep 17 00:00:00 2001 From: yeom Date: Tue, 24 Nov 2009 20:27:29 +0000 Subject: [PATCH] working on building the conflict graph. --- Robust/src/Analysis/MLP/ConflictGraph.java | 178 +++++++++++ Robust/src/Analysis/MLP/ConflictNode.java | 33 ++ Robust/src/Analysis/MLP/LiveInNode.java | 108 +++++++ Robust/src/Analysis/MLP/MLPAnalysis.java | 288 ++++++++++++++++-- .../Analysis/MLP/ParentChildConflictsMap.java | 17 +- Robust/src/Analysis/MLP/SESEEffectsKey.java | 2 +- Robust/src/Analysis/MLP/StallSite.java | 13 +- Robust/src/Analysis/MLP/StallSiteNode.java | 26 ++ .../OwnershipAnalysis/OwnershipGraph.java | 17 +- 9 files changed, 644 insertions(+), 38 deletions(-) create mode 100644 Robust/src/Analysis/MLP/ConflictGraph.java create mode 100644 Robust/src/Analysis/MLP/ConflictNode.java create mode 100644 Robust/src/Analysis/MLP/LiveInNode.java create mode 100644 Robust/src/Analysis/MLP/StallSiteNode.java diff --git a/Robust/src/Analysis/MLP/ConflictGraph.java b/Robust/src/Analysis/MLP/ConflictGraph.java new file mode 100644 index 00000000..63fb010b --- /dev/null +++ b/Robust/src/Analysis/MLP/ConflictGraph.java @@ -0,0 +1,178 @@ +package Analysis.MLP; + +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.Set; +import java.util.Map.Entry; + +import Analysis.OwnershipAnalysis.HeapRegionNode; +import IR.Flat.FlatMethod; +import IR.Flat.FlatSESEEnterNode; +import IR.Flat.TempDescriptor; + +public class ConflictGraph { + + public Hashtable td2cn; + + public ConflictGraph() { + td2cn = new Hashtable(); + } + + public String addStallNode(TempDescriptor td, FlatMethod fm, + StallSite stallSite) { + + String stallNodeID = td + "_" + fm.getMethod().getSymbol(); + + if (!td2cn.containsKey(stallNodeID)) { + StallSiteNode newNode = new StallSiteNode(stallNodeID, td, + stallSite); + td2cn.put(stallNodeID, newNode); + // it add new new stall node to conflict graph + return stallNodeID; + } + // it doesn't add new stall node because stall node has already been + // added. + return null; + } + + public StallSiteNode getStallNode(String stallNodeID) { + ConflictNode node = td2cn.get(stallNodeID); + if (node instanceof StallSiteNode) { + return (StallSiteNode) node; + } else { + return null; + } + } + + public void addLiveInNode(TempDescriptor td, FlatSESEEnterNode fsen, + Set readEffectsSet, + Set writeEffectsSet) { + + String liveinNodeID = td + "_" + fsen.getIdentifier(); + + LiveInNode newNode = new LiveInNode(liveinNodeID, td, readEffectsSet, + writeEffectsSet); + td2cn.put(liveinNodeID, newNode); + + } + + public void addWriteConflictEdge(StallSiteNode stallNode, + LiveInNode liveInNode) { + ConflictEdge newEdge = new ConflictEdge(stallNode, liveInNode, + ConflictEdge.WRITE_CONFLICT); + stallNode.addEdge(newEdge); + liveInNode.addEdge(newEdge); + } + + public HashSet getLiveInNodeSet() { + HashSet resultSet = new HashSet(); + + Set keySet = td2cn.keySet(); + for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { + String key = (String) iterator.next(); + ConflictNode node = td2cn.get(key); + + if (node instanceof LiveInNode) { + resultSet.add((LiveInNode) node); + } + } + + return resultSet; + } + + public void writeGraph(String graphName) throws java.io.IOException { + + graphName = graphName.replaceAll("[\\W]", ""); + + BufferedWriter bw = new BufferedWriter(new FileWriter(graphName + + ".dot")); + bw.write("graph " + graphName + " {\n"); + + HashSet visited = new HashSet(); + // then visit every heap region node + Set> s = td2cn.entrySet(); + Iterator> i = s.iterator(); + + HashSet addedSet=new HashSet(); + + while (i.hasNext()) { + Entry entry = i.next(); + ConflictNode node = entry.getValue(); + String attributes = "["; + + attributes += "label=\"ID" + node.getID() + "\\n"; + + if (node instanceof StallSiteNode) { + attributes += "STALL SITE" + "\\n" + "\"]"; + } else { + attributes += "LIVE-IN" + "\\n" + "\"]"; + } + bw.write(entry.getKey() + attributes + ";\n"); + + HashSet edgeSet = node.getEdgeSet(); + for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) { + ConflictEdge conflictEdge = (ConflictEdge) iterator.next(); + + ConflictNode u = conflictEdge.getVertexU(); + ConflictNode v = conflictEdge.getVertexV(); + + if (conflictEdge.getType() == ConflictEdge.WRITE_CONFLICT) { + if(!addedSet.contains(conflictEdge)){ + bw.write(" " + u.getID() + "--" + v.getID() + + "[label=\"" + + conflictEdge.toGraphEdgeString() + + "\",decorate];\n"); + addedSet.add(conflictEdge); + } + } + } + } + + bw.write(" graphTitle[label=\"" + graphName + "\",shape=box];\n"); + + bw.write("}\n"); + bw.close(); + + } + +} + +class ConflictEdge { + + private ConflictNode u; + private ConflictNode v; + private int type; + + public static final int WRITE_CONFLICT = 0; + public static final int REACH_CONFLICT = 1; + + public ConflictEdge(ConflictNode u, ConflictNode v, int type) { + this.u = u; + this.v = v; + this.type = type; + } + + public String toGraphEdgeString() { + if (type == WRITE_CONFLICT) { + return "W_CONFLICT"; + } else { + return "R_CONFLICT"; + } + } + + public ConflictNode getVertexU() { + return u; + } + + public ConflictNode getVertexV() { + return v; + } + + public int getType(){ + return type; + } + +} \ No newline at end of file diff --git a/Robust/src/Analysis/MLP/ConflictNode.java b/Robust/src/Analysis/MLP/ConflictNode.java new file mode 100644 index 00000000..623def2f --- /dev/null +++ b/Robust/src/Analysis/MLP/ConflictNode.java @@ -0,0 +1,33 @@ +package Analysis.MLP; + +import java.util.HashSet; + +import IR.Flat.TempDescriptor; + +public abstract class ConflictNode { + + protected TempDescriptor td; + protected String id; + protected HashSet edgeSet; + + public ConflictNode() { + edgeSet = new HashSet(); + } + + public TempDescriptor getTempDescriptor() { + return td; + } + + public String getID() { + return id; + } + + public void addEdge(ConflictEdge edge) { + edgeSet.add(edge); + } + + public HashSet getEdgeSet() { + return edgeSet; + } + +} diff --git a/Robust/src/Analysis/MLP/LiveInNode.java b/Robust/src/Analysis/MLP/LiveInNode.java new file mode 100644 index 00000000..f2898219 --- /dev/null +++ b/Robust/src/Analysis/MLP/LiveInNode.java @@ -0,0 +1,108 @@ +package Analysis.MLP; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + +import Analysis.OwnershipAnalysis.HeapRegionNode; +import IR.Flat.TempDescriptor; + +public class LiveInNode extends ConflictNode { + + Set readEffectsSet; + Set writeEffectsSet; + + public LiveInNode(String id, TempDescriptor td, + Set readEffectsSet, + Set writeEffectsSet) { + this.id = id; + this.td = td; + this.readEffectsSet = readEffectsSet; + this.writeEffectsSet = writeEffectsSet; + } + + public boolean isWriteConflictWith(StallSiteNode stallNode) { + + // if live-in var has write-effects on heap region node of stall site, + // it is write conflict + + boolean result = false; + StallSite stallSite = stallNode.getStallSite(); + + if (writeEffectsSet != null) { + Iterator writeIter = writeEffectsSet.iterator(); + while (writeIter.hasNext()) { + SESEEffectsKey seseEffectsKey = (SESEEffectsKey) writeIter + .next(); + String writeHeapRegionID = seseEffectsKey.getHRNUniqueId(); + String writeFieldName = seseEffectsKey.getFieldDescriptor(); + + HashSet stallSiteHRNSet = stallNode.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 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; + } + } + + } + } + + } + } + + if (readEffectsSet != null) { + Iterator readIter = readEffectsSet.iterator(); + while (readIter.hasNext()) { + + SESEEffectsKey seseEffectsKey = (SESEEffectsKey) readIter + .next(); + String readHeapRegionID = seseEffectsKey.getHRNUniqueId(); + String readFieldName = seseEffectsKey.getFieldDescriptor(); + + HashSet stallSiteHRNSet = stallNode.getHRNSet(); + for (Iterator iterator = stallSiteHRNSet.iterator(); iterator + .hasNext();) { + HeapRegionNode stallHRN = (HeapRegionNode) iterator.next(); + if (stallHRN.getGloballyUniqueIdentifier().equals( + readHeapRegionID)) { + + HashSet 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; + } + } + + } + + } + + } + + } + } + + return result; + } + +} diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 768685e3..437603cc 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -1,13 +1,53 @@ package Analysis.MLP; -import Analysis.CallGraph.*; -import Analysis.Liveness; -import Analysis.OwnershipAnalysis.*; -import IR.*; -import IR.Flat.*; -import IR.Tree.*; -import java.util.*; -import java.io.*; +import java.io.BufferedWriter; +import java.io.FileWriter; +import java.io.IOException; +import java.io.StringWriter; +import java.util.HashSet; +import java.util.Hashtable; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; +import java.util.Set; +import java.util.Stack; +import java.util.Map.Entry; + +import Analysis.CallGraph.CallGraph; +import Analysis.CallGraph.JavaCallGraph; +import Analysis.OwnershipAnalysis.AllocationSite; +import Analysis.OwnershipAnalysis.EffectsKey; +import Analysis.OwnershipAnalysis.HeapRegionNode; +import Analysis.OwnershipAnalysis.LabelNode; +import Analysis.OwnershipAnalysis.MethodContext; +import Analysis.OwnershipAnalysis.MethodEffects; +import Analysis.OwnershipAnalysis.OwnershipAnalysis; +import Analysis.OwnershipAnalysis.OwnershipGraph; +import Analysis.OwnershipAnalysis.OwnershipNode; +import Analysis.OwnershipAnalysis.ParameterDecomposition; +import Analysis.OwnershipAnalysis.ReachabilitySet; +import Analysis.OwnershipAnalysis.ReferenceEdge; +import Analysis.OwnershipAnalysis.TokenTupleSet; +import IR.Descriptor; +import IR.FieldDescriptor; +import IR.MethodDescriptor; +import IR.Operation; +import IR.State; +import IR.TypeUtil; +import IR.Flat.FKind; +import IR.Flat.FlatCall; +import IR.Flat.FlatEdge; +import IR.Flat.FlatFieldNode; +import IR.Flat.FlatMethod; +import IR.Flat.FlatNew; +import IR.Flat.FlatNode; +import IR.Flat.FlatOpNode; +import IR.Flat.FlatReturnNode; +import IR.Flat.FlatSESEEnterNode; +import IR.Flat.FlatSESEExitNode; +import IR.Flat.FlatSetFieldNode; +import IR.Flat.FlatWriteDynamicVarNode; +import IR.Flat.TempDescriptor; public class MLPAnalysis { @@ -55,6 +95,7 @@ public class MLPAnalysis { private Hashtable < FlatNode, ParentChildConflictsMap > conflictsResults; private Hashtable< FlatMethod, MethodSummary > methodSummaryResults; private OwnershipAnalysis ownAnalysisForSESEConflicts; + private Hashtable conflictGraphResults; // temporal data structures to track analysis progress. private MethodSummary currentMethodSummary; @@ -116,6 +157,7 @@ public class MLPAnalysis { conflictsResults = new Hashtable < FlatNode, ParentChildConflictsMap >(); methodSummaryResults=new Hashtable(); + conflictGraphResults=new Hashtable(); FlatMethod fmMain = state.getMethodFlat( typeUtil.getMain() ); @@ -243,7 +285,29 @@ public class MLPAnalysis { System.err.println(e); } - postSESEConflictsForward(javaCallGraph); + // postSESEConflictsForward(javaCallGraph); + // another pass for making graph + methItr = ownAnalysis.descriptorsToAnalyze.iterator(); + while (methItr.hasNext()) { + Descriptor d = methItr.next(); + FlatMethod fm = state.getMethodFlat(d); + makeConflictGraph(fm); + } + methItr = ownAnalysis.descriptorsToAnalyze.iterator(); + while(methItr.hasNext()){ + Descriptor d = methItr.next(); + FlatMethod fm = state.getMethodFlat(d); + if (fm.toString().indexOf("SomeWork") > 0) { + ConflictGraph conflictGraph=conflictGraphResults.get(fm); + try { + conflictGraph.writeGraph("ConflictGraphForSomeWork"); + } catch (IOException e) { + System.out.println("Error writing"); + System.exit(0); + } + } + } + //////////////// // 7th pass methItr = ownAnalysis.descriptorsToAnalyze.iterator(); @@ -1232,7 +1296,7 @@ public class MLPAnalysis { FlatFieldNode ffn = (FlatFieldNode) fn; TempDescriptor src = ffn.getSrc(); FieldDescriptor field = ffn.getField(); - + LabelNode srcLN = og.td2ln.get(src); if (srcLN != null) { HashSet affectedTDSet = getAccessedTaintNodeSet(srcLN); @@ -1338,9 +1402,10 @@ public class MLPAnalysis { FlatSetFieldNode fsen = (FlatSetFieldNode) fn; TempDescriptor dst = fsen.getDst(); FieldDescriptor field = fsen.getField(); - + LabelNode dstLN = og.td2ln.get(dst); if (dstLN != null) { + // check possible strong updates boolean strongUpdate = false; @@ -1822,8 +1887,9 @@ public class MLPAnalysis { private void postSESEConflictsForward(JavaCallGraph javaCallGraph) { - // store the reachability set in stall site data structure + // store the reachability set in stall site data structure Set methodCallSet = javaCallGraph.getAllMethods(typeUtil.getMain()); + LinkedList sortedMethodCalls = topologicalSort( methodCallSet, javaCallGraph); @@ -1832,6 +1898,9 @@ public class MLPAnalysis { MethodDescriptor md = (MethodDescriptor) iterator.next(); FlatMethod fm = state.getMethodFlat(md); + // create conflict graph for each flat method + ConflictGraph conflictGraph = new ConflictGraph(); + HashSet mcSet = ownAnalysis .getAllMethodContextSetByDescriptor(md); Iterator mcIter = mcSet.iterator(); @@ -1852,8 +1921,29 @@ public class MLPAnalysis { ParentChildConflictsMap currentConflictsMap = conflictsResults .get(fn); - postConflicts_nodeAction(mc, fn, - currentConflictsMap); + // + Hashtable stallMap = currentConflictsMap + .getStallMap(); + Set> entrySet = stallMap + .entrySet(); + for (Iterator iterator2 = entrySet.iterator(); iterator2 + .hasNext();) { + Entry entry = (Entry) iterator2 + .next(); + TempDescriptor td = entry.getKey(); + StallSite stallSite = entry.getValue(); + conflictGraph.addStallNode(td, fm, stallSite); + } + // + + postConflicts_nodeAction(mc, fn, currentConflictsMap); + + Set tdSet = currentConflictsMap + .getStallMap().keySet(); + + // if(tdSet.size()>0){ + // System.out.println("# of stalls="+tdSet.size()); + // } // if we have a new result, schedule forward nodes for // analysis @@ -1864,13 +1954,29 @@ public class MLPAnalysis { flatNodesToVisit.add(nn); } } - } - } - + + conflictGraphResults.put(fm, conflictGraph); + } + + for (Iterator iterator = sortedMethodCalls.iterator(); iterator + .hasNext();) { + MethodDescriptor md = (MethodDescriptor) iterator.next(); + FlatMethod fm = state.getMethodFlat(md); + if (fm.toString().indexOf("SomeWork") > 0) { + ConflictGraph conflictGraph=conflictGraphResults.get(fm); + try { + conflictGraph.writeGraph("ConflictGraphForSomeWork"); + } catch (IOException e) { + System.out.println("Error writing"); + System.exit(0); + } + } + } + } private void postConflicts_nodeAction(MethodContext mc, FlatNode fn, @@ -1885,12 +1991,17 @@ public class MLPAnalysis { TempDescriptor key = (TempDescriptor) iterator.next(); StallSite stallSite=stallMap.get(key); +// System.out.println("stallSite="+stallSite); + Set hrnSet=stallSite.getHRNSet(); for (Iterator iterator2 = hrnSet.iterator(); iterator2.hasNext();) { HeapRegionNode hrn = (HeapRegionNode) iterator2 .next(); - - HeapRegionNode hrnOG=og.id2hrn.get(hrn.getID()); + + String uniqueHRNID=hrn.getGloballyUniqueIdentifier(); + HeapRegionNode hrnOG=og.getHRNbyUniqueID(uniqueHRNID); + +// HeapRegionNode hrnOG=og.id2hrn.get(hrn.getID()); if(hrnOG!=null){ ReachabilitySet rSet=hrnOG.getAlpha(); Iterator ttIterator=rSet.iterator(); @@ -1907,6 +2018,131 @@ public class MLPAnalysis { for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { TempDescriptor key = (TempDescriptor) iterator.next(); StallSite stallSite=stallMap.get(key); + HashSet rs=stallSite.getReachabilitySet(); + Iterator iter=rs.iterator(); + while (iter.hasNext()) { + TokenTupleSet tts = (TokenTupleSet) iter.next(); +// System.out.println("TTS="+tts); + } + } + + } + + private void makeConflictGraph(FlatMethod fm) { + + // create conflict graph for each flat method + ConflictGraph conflictGraph = new ConflictGraph(); + + Set flatNodesToVisit = new HashSet(); + flatNodesToVisit.add(fm); + + Set visited = new HashSet(); + + while (!flatNodesToVisit.isEmpty()) { + Iterator fnItr = flatNodesToVisit.iterator(); + FlatNode fn = fnItr.next(); + + flatNodesToVisit.remove(fn); + visited.add(fn); + + // /////////////////////////////////////////////////////////////////////// + // 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; + if ((stallNodeID = conflictGraph + .addStallNode(td, fm, stallSite)) != 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); + } + } + } + } + + // /////////////////////////////////////////////////////////////////////// + + conflictGraph_nodeAction(fm, fn, conflictGraph, currentConflictsMap); + + for (int i = 0; i < fn.numNext(); i++) { + FlatNode nn = fn.getNext(i); + if (!visited.contains(nn)) { + flatNodesToVisit.add(nn); + } + } + } + + conflictGraphResults.put(fm, conflictGraph); + + } + + private void conflictGraph_nodeAction(FlatMethod fm, FlatNode fn, + ConflictGraph graph, ParentChildConflictsMap currentConflictsMap) { + + switch (fn.kind()) { + + case FKind.FlatSESEEnterNode: { + + FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn; + + if (!fsen.getIsCallerSESEplaceholder()) { + Set invar_set = fsen.getInVarSet(); + + String liveinStr = ""; + + for (Iterator iterator = invar_set.iterator(); iterator + .hasNext();) { + TempDescriptor tempDescriptor = (TempDescriptor) iterator + .next(); + + SESEEffectsSet seseEffectsSet = fsen.getSeseEffectsSet(); + Set readEffectsSet=seseEffectsSet.getReadingSet(tempDescriptor); + Set writeEffectsSet=seseEffectsSet.getWritingSet(tempDescriptor); + + graph.addLiveInNode(tempDescriptor,fsen,readEffectsSet,writeEffectsSet); + } + + } + + } + + break; + } } @@ -2122,17 +2358,19 @@ public class MLPAnalysis { } } + }else{ + System.out.println("src is accessible="+possibleSrc); } currentConflictsMap.addAccessibleVar(possibleSrc); // contribute read effect on source's stall site - currentConflictsMap.contributeEffect(possibleSrc, field.getType() - .getSafeSymbol(), field.toString(), + currentConflictsMap.contributeEffect(possibleSrc, field + .getType().getSafeSymbol(), field.getSymbol(), StallSite.READ_EFFECT); } - HashSet dstTempSet = getTempDescSetReferenceToSameHRN( + HashSet dstTempSet = getTempDescSetReferenceToSameHRN( og, dst); for (Iterator iterator = dstTempSet.iterator(); iterator .hasNext();) { @@ -2227,7 +2465,7 @@ public class MLPAnalysis { currentConflictsMap.addAccessibleVar(possibleDst); // contribute write effect on destination's stall site currentConflictsMap.contributeEffect(possibleDst, field - .getType().getSafeSymbol(), field.toString(), + .getType().getSafeSymbol(), field.getSymbol(), StallSite.WRITE_EFFECT); } @@ -2559,7 +2797,7 @@ public class MLPAnalysis { while (paramIter.hasNext()) { Integer paramID = paramIter.next(); PreEffectsKey effectKey = new PreEffectsKey(paramID, - field.toString(), field.getType() + field.getSymbol(), field.getType() .getSafeSymbol(), effectType); preeffectsSet.add(effectKey); } @@ -2575,7 +2813,7 @@ public class MLPAnalysis { while (paramIter.hasNext()) { Integer paramID = paramIter.next(); PreEffectsKey effectKey = new PreEffectsKey(paramID, - field.toString(), field.getType() + field.getSymbol(), field.getType() .getSafeSymbol(), effectType); preeffectsSet.add(effectKey); } diff --git a/Robust/src/Analysis/MLP/ParentChildConflictsMap.java b/Robust/src/Analysis/MLP/ParentChildConflictsMap.java index 0aa832a0..5819afab 100644 --- a/Robust/src/Analysis/MLP/ParentChildConflictsMap.java +++ b/Robust/src/Analysis/MLP/ParentChildConflictsMap.java @@ -178,13 +178,20 @@ public class ParentChildConflictsMap { } // handle reachabilitySet - ReachabilitySet currentRSet = currentStallSite.getReachabilitySet(); - ReachabilitySet newRSet = newStallSite.getReachabilitySet(); - Iterator ttsIter = newRSet.iterator(); - while (ttsIter.hasNext()) { - TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter.next(); + HashSet currentRSet=currentStallSite.getReachabilitySet(); + HashSet newRSet=newStallSite.getReachabilitySet(); + Iterator ttsIter=newRSet.iterator(); + while(ttsIter.hasNext()){ + TokenTupleSet tokenTupleSet=(TokenTupleSet) ttsIter.next(); currentRSet.add(tokenTupleSet); } +// ReachabilitySet currentRSet = currentStallSite.getReachabilitySet(); +// ReachabilitySet newRSet = newStallSite.getReachabilitySet(); +// Iterator ttsIter = newRSet.iterator(); +// while (ttsIter.hasNext()) { +// TokenTupleSet tokenTupleSet = (TokenTupleSet) ttsIter.next(); +// currentRSet.add(tokenTupleSet); +// } //handle allocationsite HashSet currentAloc=currentStallSite.getAllocationSiteSet(); diff --git a/Robust/src/Analysis/MLP/SESEEffectsKey.java b/Robust/src/Analysis/MLP/SESEEffectsKey.java index 4c5af54d..01844465 100644 --- a/Robust/src/Analysis/MLP/SESEEffectsKey.java +++ b/Robust/src/Analysis/MLP/SESEEffectsKey.java @@ -33,7 +33,7 @@ public class SESEEffectsKey { } public String toString() { - return "(" + td + ")" + fd + "#" + hrnId; + return "(" + td + ")" + fd + "#" + hrnId+":"+hrnUniqueId; } public int hashCode() { diff --git a/Robust/src/Analysis/MLP/StallSite.java b/Robust/src/Analysis/MLP/StallSite.java index 5058b027..f2739050 100644 --- a/Robust/src/Analysis/MLP/StallSite.java +++ b/Robust/src/Analysis/MLP/StallSite.java @@ -18,7 +18,8 @@ public class StallSite { private HashSet effectSet; private HashSet hrnSet; private HashSet allocationSiteSet; - private ReachabilitySet reachabilitySet; +// private ReachabilitySet reachabilitySet; + HashSet reachabilitySet; private HashSet stallTagSet; // if stall site is caller's parameter heap regtion, store its parameter idx @@ -28,7 +29,7 @@ public class StallSite { public StallSite() { effectSet = new HashSet(); hrnSet = new HashSet(); - reachabilitySet = new ReachabilitySet(); + reachabilitySet = new HashSet(); allocationSiteSet = new HashSet(); stallTagSet = new HashSet(); callerParamIdxSet = new HashSet(); @@ -48,7 +49,7 @@ public class StallSite { } public StallSite(HashSet effectSet, HashSet hrnSet, - ReachabilitySet rechabilitySet, HashSet alocSet, + HashSet rechabilitySet, HashSet alocSet, HashSet tagSet, HashSet paramIdx) { this(); this.effectSet.addAll(effectSet); @@ -109,7 +110,7 @@ public class StallSite { return hrnSet; } - public ReachabilitySet getReachabilitySet() { + public HashSet getReachabilitySet() { return reachabilitySet; } @@ -221,7 +222,7 @@ class Effect { return type; } - public Integer getEffect() { + public Integer getEffectType() { return effect; } @@ -243,7 +244,7 @@ class Effect { if (stallTagSet.equals(in.getStallTagSet()) && type.equals(in.getType()) && field.equals(in.getField()) - && effect.equals(in.getEffect())) { + && effect.equals(in.getEffectType())) { return true; } else { return false; diff --git a/Robust/src/Analysis/MLP/StallSiteNode.java b/Robust/src/Analysis/MLP/StallSiteNode.java new file mode 100644 index 00000000..e5d57421 --- /dev/null +++ b/Robust/src/Analysis/MLP/StallSiteNode.java @@ -0,0 +1,26 @@ +package Analysis.MLP; + +import java.util.HashSet; + +import Analysis.OwnershipAnalysis.HeapRegionNode; +import IR.Flat.TempDescriptor; + +public class StallSiteNode extends ConflictNode { + + protected StallSite stallSite; + + public StallSiteNode(String id, TempDescriptor td, StallSite stallSite) { + this.id = id; + this.td = td; + this.stallSite = stallSite; + } + + public HashSet getHRNSet(){ + return stallSite.getHRNSet(); + } + + public StallSite getStallSite(){ + return stallSite; + } + +} diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 9da346f7..5429938f 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -5094,5 +5094,20 @@ public class OwnershipGraph { return identifier; - } + } + + public HeapRegionNode getHRNbyUniqueID(String id) { + + Enumeration elements = id2hrn.elements(); + while (elements.hasMoreElements()) { + HeapRegionNode hrn = elements.nextElement(); + if (hrn.getGloballyUniqueIdentifier().equals(id)) { + return hrn; + } + } + + return null; + + } + } -- 2.34.1