From 5c3338d1b48266fa4dbe08dcf384440d894ee150 Mon Sep 17 00:00:00 2001 From: yeom Date: Wed, 16 Dec 2009 01:56:25 +0000 Subject: [PATCH] fix the problem of handling nested parent/child SESE definition. --- Robust/src/Analysis/MLP/ConflictGraph.java | 58 ++- Robust/src/Analysis/MLP/MLPAnalysis.java | 405 ++++++++---------- .../Analysis/MLP/ParentChildConflictsMap.java | 22 +- Robust/src/Analysis/MLP/SESESummary.java | 46 ++ 4 files changed, 240 insertions(+), 291 deletions(-) create mode 100644 Robust/src/Analysis/MLP/SESESummary.java diff --git a/Robust/src/Analysis/MLP/ConflictGraph.java b/Robust/src/Analysis/MLP/ConflictGraph.java index 3898a07b..6cf4cbc0 100644 --- a/Robust/src/Analysis/MLP/ConflictGraph.java +++ b/Robust/src/Analysis/MLP/ConflictGraph.java @@ -176,18 +176,11 @@ public class ConflictGraph { private int determineWriteConflictsType(StallSiteNode stallNode, LiveInNode liveInNode) { - System.out.println("determine write ocnflict type between " + stallNode - + "<->" + liveInNode); - Set stallHrnSet = stallNode.getHRNSet(); Set 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; @@ -199,7 +192,6 @@ public class ConflictGraph { 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 @@ -336,9 +328,6 @@ public class ConflictGraph { int conflictType = determineWriteConflictsType( (StallSiteNode) currentNode, (LiveInNode) entryNode); - // System.out.println("WRITE CONFLICT type=" - // + conflictType + " BETWEEN=" + currentNode - // + "<->" + entryNode); if (conflictType > 0) { addConflictEdge(conflictType, currentNode, entryNode); @@ -354,9 +343,6 @@ public class ConflictGraph { int conflictType = determineWriteConflictsType( (LiveInNode) currentNode, (LiveInNode) entryNode); -// System.out.println("WRITE CONFLICT type=" -// + conflictType + " BETWEEN=" + currentNode -// + "<->" + entryNode); if (conflictType > 0) { addConflictEdge(conflictType, currentNode, entryNode); @@ -474,7 +460,8 @@ public class ConflictGraph { return resultSet; } - public void writeGraph(String graphName) throws java.io.IOException { + public void writeGraph(String graphName, boolean filter) + throws java.io.IOException { graphName = graphName.replaceAll("[\\W]", ""); @@ -493,13 +480,15 @@ public class ConflictGraph { 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; - } + if (filter) { + if (node.getID().startsWith("___dst") + || node.getID().startsWith("___srctmp") + || node.getID().startsWith("___neverused") + || node.getID().startsWith("___temp")) { + + continue; + } + } String attributes = "["; @@ -519,18 +508,19 @@ 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 (filter) { + 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=\"" diff --git a/Robust/src/Analysis/MLP/MLPAnalysis.java b/Robust/src/Analysis/MLP/MLPAnalysis.java index 07734064..24517637 100644 --- a/Robust/src/Analysis/MLP/MLPAnalysis.java +++ b/Robust/src/Analysis/MLP/MLPAnalysis.java @@ -102,6 +102,8 @@ public class MLPAnalysis { // temporal data structures to track analysis progress. private MethodSummary currentMethodSummary; private HashSet preeffectsSet; + private Hashtable isAfterChildSESEIndicatorMap; + private Hashtable seseSummaryMap; public static int maxSESEage = -1; @@ -160,6 +162,9 @@ public class MLPAnalysis { conflictsResults = new Hashtable < FlatNode, ParentChildConflictsMap >(); methodSummaryResults=new Hashtable(); conflictGraphResults=new Hashtable(); + + seseSummaryMap= new Hashtable(); + isAfterChildSESEIndicatorMap= new Hashtable(); FlatMethod fmMain = state.getMethodFlat( typeUtil.getMain() ); @@ -302,7 +307,7 @@ public class MLPAnalysis { if (fm.toString().indexOf("SomeWork") > 0) { ConflictGraph conflictGraph=conflictGraphResults.get(fm); try { - conflictGraph.writeGraph("ConflictGraphForSomeWork"); + conflictGraph.writeGraph("ConflictGraphForSomeWork", false); } catch (IOException e) { System.out.println("Error writing"); System.exit(0); @@ -944,7 +949,7 @@ public class MLPAnalysis { MethodDescriptor md=fm.getMethod(); HashSet mcSet=ownAnalysis.getAllMethodContextSetByDescriptor(md); Iterator mcIter=mcSet.iterator(); - + while(mcIter.hasNext()){ MethodContext mc=mcIter.next(); @@ -1406,8 +1411,9 @@ public class MLPAnalysis { FieldDescriptor field = fsen.getField(); LabelNode dstLN = og.td2ln.get(dst); + if (dstLN != null) { - + // check possible strong updates boolean strongUpdate = false; @@ -1431,9 +1437,7 @@ public class MLPAnalysis { } } } - HashSet affectedTDSet = getAccessedTaintNodeSet(dstLN); - Iterator affectedIter = affectedTDSet .iterator(); @@ -1446,7 +1450,6 @@ public class MLPAnalysis { Iterator hrnIter = hrnSet.iterator(); while (hrnIter.hasNext()) { HeapRegionNode hrn = hrnIter.next(); - Iterator referencers = hrn .iteratorToReferencers(); while (referencers.hasNext()) { @@ -1457,7 +1460,7 @@ public class MLPAnalysis { HeapRegionNode refHRN = og.id2hrn .get(referenceEdge.getDst().getID()); - + System.out.println("refHRN=" + refHRN); currentSESE.writeEffects(affectedTD, field .getSymbol(), dst.getType(), refHRN, strongUpdate); @@ -1885,149 +1888,6 @@ public class MLPAnalysis { } return sorted; - } - /* - private void postSESEConflictsForward(JavaCallGraph javaCallGraph) { - - // store the reachability set in stall site data structure - Set methodCallSet = javaCallGraph.getAllMethods(typeUtil.getMain()); - - LinkedList sortedMethodCalls = topologicalSort( - methodCallSet, javaCallGraph); - - for (Iterator iterator = sortedMethodCalls.iterator(); iterator - .hasNext();) { - 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(); - - while (mcIter.hasNext()) { - MethodContext mc = mcIter.next(); - - Set visited = new HashSet(); - - Set flatNodesToVisit = new HashSet(); - flatNodesToVisit.add(fm); - - while (!flatNodesToVisit.isEmpty()) { - FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next(); - flatNodesToVisit.remove(fn); - visited.add(fn); - - ParentChildConflictsMap currentConflictsMap = conflictsResults - .get(fn); - - // - 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 - conflictsResults.put(fn, 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); - - } - - - 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, - ParentChildConflictsMap currentConflictsMap) { - - OwnershipGraph og = ownAnalysisForSESEConflicts.getOwnvershipGraphByMethodContext(mc); - - Hashtable stallMap=currentConflictsMap.getStallMap(); - Set keySet=stallMap.keySet(); - - for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { - 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(); - - 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(); - while (ttIterator.hasNext()) { - TokenTupleSet tts = (TokenTupleSet) ttIterator.next(); - stallSite.addTokenTupleSet(tts); - } - } - - } - } - - //DEBUG - 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) { @@ -2192,7 +2052,7 @@ public class MLPAnalysis { } } - + private void seseConflictsForward(JavaCallGraph javaCallGraph) { Set methodCallSet = javaCallGraph.getAllMethods(typeUtil.getMain()); @@ -2204,6 +2064,7 @@ public class MLPAnalysis { for (Iterator iterator = sortedMethodCalls.iterator(); iterator .hasNext();) { + MethodDescriptor md = (MethodDescriptor) iterator.next(); FlatMethod fm = state.getMethodFlat(md); @@ -2215,18 +2076,19 @@ public class MLPAnalysis { currentMethodSummary = new MethodSummary(); preeffectsSet = new HashSet(); + // iterates over all possible method context while (mcIter.hasNext()) { MethodContext mc = mcIter.next(); - Set visited = new HashSet(); - Set flatNodesToVisit = new HashSet(); flatNodesToVisit.add(fm); + SESESummary summary = new SESESummary(null, fm); + seseSummaryMap.put(fm, summary); + while (!flatNodesToVisit.isEmpty()) { FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next(); flatNodesToVisit.remove(fn); - visited.add(fn); ParentChildConflictsMap prevResult = conflictsResults .get(fn); @@ -2242,93 +2104,120 @@ public class MLPAnalysis { } } + SESESummary currentSummary = seseSummaryMap.get(fn); + if (currentSummary == null) { + FlatNode current = null; + FlatNode currentParent = null; + // calculate sese summary info from previous flat nodes + + for (int i = 0; i < fn.numPrev(); i++) { + FlatNode prevFlatNode = fn.getPrev(i); + SESESummary prevSummary = seseSummaryMap + .get(prevFlatNode); + if (prevSummary != null) { + if (prevFlatNode instanceof FlatSESEExitNode + && !((FlatSESEExitNode) prevFlatNode) + .getFlatEnter() + .getIsCallerSESEplaceholder()) { + current = prevSummary.getCurrentParent(); + SESESummary temp = seseSummaryMap + .get(current); + currentParent = temp.getCurrentParent(); + } else { + current = prevSummary.getCurrentSESE(); + currentParent = prevSummary + .getCurrentParent(); + } + break; + } + } + + currentSummary = new SESESummary(currentParent, current); + seseSummaryMap.put(fn, currentSummary); + } + conflicts_nodeAction(mc, fn, callGraph, preeffectsSet, - currentConflictsMap); + currentConflictsMap, currentSummary); // if we have a new result, schedule forward nodes for // analysis - if (!currentConflictsMap.isAfterChildSESE()) { + if (!currentConflictsMap.equals(prevResult)) { conflictsResults.put(fn, currentConflictsMap); for (int i = 0; i < fn.numNext(); i++) { FlatNode nn = fn.getNext(i); - if (!visited.contains(nn)) { - flatNodesToVisit.add(nn); - } - } - } else { - if (!currentConflictsMap.equals(prevResult)) { - conflictsResults.put(fn, currentConflictsMap); - for (int i = 0; i < fn.numNext(); i++) { - FlatNode nn = fn.getNext(i); - flatNodesToVisit.add(nn); - } + flatNodesToVisit.add(nn); } } } + } - methodSummaryResults.put(fm, currentMethodSummary); - } - // if the method has at least one child SESE, we need to calculate the - // reachability set of its stall sites. - for (Iterator iterator = sortedMethodCalls.iterator(); iterator - .hasNext();) { - MethodDescriptor md = (MethodDescriptor) iterator.next(); - FlatMethod fm = state.getMethodFlat(md); - - } - + } + private void conflicts_nodeAction(MethodContext mc, FlatNode fn, - CallGraph callGraph, HashSet preeffectsSet,ParentChildConflictsMap currentConflictsMap) { + CallGraph callGraph, HashSet preeffectsSet, + ParentChildConflictsMap currentConflictsMap, + SESESummary currentSummary) { OwnershipGraph og = ownAnalysis.getOwnvershipGraphByMethodContext(mc); switch (fn.kind()) { case FKind.FlatSESEEnterNode: { - + FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn; + if (!fsen.getIsCallerSESEplaceholder()) { - currentMethodSummary.increaseChildSESECount(); + FlatNode parentNode = currentSummary.getCurrentSESE(); + currentSummary.setCurrentParent(parentNode); + currentSummary.setCurrentSESE(fsen); + seseSummaryMap.put(fsen, currentSummary); } + if (!fsen.getIsCallerSESEplaceholder()) { + currentMethodSummary.increaseChildSESECount(); + } if (currentMethodSummary.getChildSESECount() == 1) { // need to store pre-effects currentMethodSummary.getEffectsSet().addAll(preeffectsSet); - for (Iterator iterator = currentMethodSummary.getEffectsSet() .iterator(); iterator.hasNext();) { PreEffectsKey preEffectsKey = (PreEffectsKey) iterator .next(); } - preeffectsSet.clear(); } - } break; case FKind.FlatSESEExitNode: { - + FlatSESEExitNode fsen = (FlatSESEExitNode) fn; - + if (!fsen.getFlatEnter().getIsCallerSESEplaceholder()) { // all object variables are inaccessible. - currentConflictsMap.setAfterChildSESE(true); - currentConflictsMap = new ParentChildConflictsMap(); + isAfterChildSESEIndicatorMap.put(currentSummary + .getCurrentParent(), new Boolean(true)); } - + } break; - case FKind.FlatNew: { - if (currentConflictsMap.isAfterChildSESE()) { - FlatNew fnew = (FlatNew) fn; + FlatNew fnew = (FlatNew) fn; + + boolean isAfterChildSESE = false; + FlatNode current = currentSummary.getCurrentSESE(); + Boolean isAfter = isAfterChildSESEIndicatorMap.get(current); + if (isAfter != null && isAfter.booleanValue()) { + isAfterChildSESE = true; + } + + if (isAfterChildSESE) { TempDescriptor dst = fnew.getDst(); currentConflictsMap.addAccessibleVar(dst); } @@ -2342,9 +2231,16 @@ public class MLPAnalysis { TempDescriptor dst = ffn.getDst(); TempDescriptor src = ffn.getSrc(); FieldDescriptor field = ffn.getField(); - - if (currentConflictsMap.isAfterChildSESE()) { - + + boolean isAfterChildSESE = false; + FlatNode current = currentSummary.getCurrentSESE(); + Boolean isAfter = isAfterChildSESEIndicatorMap.get(current); + if (isAfter != null && isAfter.booleanValue()) { + isAfterChildSESE = true; + } + + if (isAfterChildSESE) { + HashSet srcTempSet = getTempDescSetReferenceToSameHRN( og, src); for (Iterator iterator = srcTempSet.iterator(); iterator @@ -2375,9 +2271,9 @@ public class MLPAnalysis { } } -// else{ -// System.out.println("src is accessible="+possibleSrc); -// } + // else{ + // System.out.println("src is accessible="+possibleSrc); + // } currentConflictsMap.addAccessibleVar(possibleSrc); @@ -2411,8 +2307,15 @@ public class MLPAnalysis { TempDescriptor dst = fsen.getDst(); FieldDescriptor field = fsen.getField(); TempDescriptor src = fsen.getSrc(); - - if (currentConflictsMap.isAfterChildSESE()) { + + boolean isAfterChildSESE = false; + FlatNode current = currentSummary.getCurrentSESE(); + Boolean isAfter = isAfterChildSESEIndicatorMap.get(current); + if (isAfter != null && isAfter.booleanValue()) { + isAfterChildSESE = true; + } + + if (isAfterChildSESE) { HashSet srcTempSet = getTempDescSetReferenceToSameHRN( og, src); @@ -2431,9 +2334,10 @@ public class MLPAnalysis { .hasNext();) { HeapRegionNode hrn = (HeapRegionNode) iterator2 .next(); - + if (hrn.isParameter()) { - // if stall site is paramter heap region, need to decompose into caller's + // if stall site is paramter heap region, need + // to decompose into caller's HashSet visitedHRN = new HashSet(); visitedHRN.add(hrn); setupRelatedAllocSiteAnalysis(og, mc, hrn, @@ -2441,7 +2345,7 @@ public class MLPAnalysis { } else { flagAllocationSite(mc, hrn.getAllocationSite()); } - + } } @@ -2478,7 +2382,7 @@ public class MLPAnalysis { } } } - + currentConflictsMap.addAccessibleVar(possibleDst); // contribute write effect on destination's stall site currentConflictsMap.contributeEffect(possibleDst, field @@ -2496,8 +2400,9 @@ public class MLPAnalysis { .hasNext();) { ReferenceEdge referenceEdge = (ReferenceEdge) iterator .next(); - if(!(referenceEdge.getSrc() instanceof LabelNode)){ - currentConflictsMap.addStallEdge(referenceEdge,new StallTag(fn)); + if (!(referenceEdge.getSrc() instanceof LabelNode)) { + currentConflictsMap.addStallEdge(referenceEdge, + new StallTag(fn)); } } } @@ -2512,7 +2417,15 @@ public class MLPAnalysis { break; case FKind.FlatOpNode: { - if (currentConflictsMap.isAfterChildSESE()) { + + boolean isAfterChildSESE = false; + FlatNode current = currentSummary.getCurrentSESE(); + Boolean isAfter = isAfterChildSESEIndicatorMap.get(current); + if (isAfter != null && isAfter.booleanValue()) { + isAfterChildSESE = true; + } + + if (isAfterChildSESE) { // destination variable gets the status of source. FlatOpNode fon = (FlatOpNode) fn; @@ -2554,6 +2467,13 @@ public class MLPAnalysis { FlatCall fc = (FlatCall) fn; + boolean isAfterChildSESE = false; + FlatNode current = currentSummary.getCurrentSESE(); + Boolean isAfter = isAfterChildSESEIndicatorMap.get(current); + if (isAfter != null && isAfter.booleanValue()) { + isAfterChildSESE = true; + } + int base = 0; if (!fc.getMethod().isStatic()) { base = 1; @@ -2575,7 +2495,7 @@ public class MLPAnalysis { for (int i = 0; i < fc.numArgs(); i++) { TempDescriptor paramTemp = fc.getArg(i); - if (currentConflictsMap.isAfterChildSESE()) { + if (isAfterChildSESE) { if (currentConflictsMap.isAccessible(paramTemp) && currentConflictsMap.hasStallSite(paramTemp)) { // preeffect contribute its effect to caller's stall @@ -2609,7 +2529,8 @@ public class MLPAnalysis { // is going to be inaccessible. // currentConflictsMap = new ParentChildConflictsMap(); currentConflictsMap.makeAllInaccessible(); - currentConflictsMap.setAfterChildSESE(true); + isAfterChildSESEIndicatorMap.put(currentSummary + .getCurrentSESE(), new Boolean(true)); TempDescriptor returnTemp = fc.getReturnTemp(); @@ -2636,14 +2557,16 @@ public class MLPAnalysis { } - // flag stall site's allocation sites for disjointness analysis - HashSet hrnSet=returnStallSite.getHRNSet(); + // flag stall site's allocation sites for disjointness + // analysis + HashSet hrnSet = returnStallSite + .getHRNSet(); for (Iterator iterator = hrnSet.iterator(); iterator .hasNext();) { - HeapRegionNode hrn = (HeapRegionNode) iterator - .next(); + HeapRegionNode hrn = (HeapRegionNode) iterator.next(); if (hrn.isParameter()) { - // if stall site is paramter heap region, need to decompose into caller's + // if stall site is paramter heap region, need to + // decompose into caller's HashSet visitedHRN = new HashSet(); visitedHRN.add(hrn); setupRelatedAllocSiteAnalysis(og, mc, hrn, @@ -2682,51 +2605,57 @@ 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; - */ + /* + * 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; TempDescriptor returnTD = frn.getReturnTemp(); + boolean isAfterChildSESE = false; + FlatNode current = currentSummary.getCurrentSESE(); + Boolean isAfter = isAfterChildSESEIndicatorMap.get(current); + if (isAfter != null && isAfter.booleanValue()) { + isAfterChildSESE = true; + } + if (returnTD != null) { - if (!currentConflictsMap.isAfterChildSESE()) { + if (!isAfterChildSESE) { // in this case, all variables are accessible. There are no // child SESEs. } else { if (currentConflictsMap.isAccessible(returnTD)) { - + currentMethodSummary .setReturnValueAccessibility(MethodSummary.ACCESSIBLE); StallSite returnStallSite = currentConflictsMap .getStallMap().get(returnTD); - - HashSet stallSiteHRNSet=returnStallSite.getHRNSet(); + + HashSet stallSiteHRNSet = returnStallSite + .getHRNSet(); for (Iterator iterator = stallSiteHRNSet.iterator(); iterator .hasNext();) { HeapRegionNode stallSiteHRN = (HeapRegionNode) iterator .next(); - Set paramSet=og.idPrimary2paramIndexSet - .get(stallSiteHRN.getID()); + Set paramSet = og.idPrimary2paramIndexSet + .get(stallSiteHRN.getID()); returnStallSite.addCallerParamIdxSet(paramSet); - paramSet=og.idSecondary2paramIndexSet - .get(stallSiteHRN.getID()); + paramSet = og.idSecondary2paramIndexSet + .get(stallSiteHRN.getID()); returnStallSite.addCallerParamIdxSet(paramSet); } - + currentMethodSummary .setReturnStallSite(returnStallSite); - + } else { currentMethodSummary .setReturnValueAccessibility(MethodSummary.INACCESSIBLE); @@ -2742,7 +2671,8 @@ public class MLPAnalysis { if (currentMethodSummary.getChildSESECount() > 0) { // current flat method FlatMethod fm = state.getMethodFlat(mc.getDescriptor()); - Set stallTempSet=currentConflictsMap.getStallMap().keySet(); + Set stallTempSet = currentConflictsMap + .getStallMap().keySet(); for (Iterator iterator = stallTempSet.iterator(); iterator .hasNext();) { TempDescriptor stallTD = (TempDescriptor) iterator.next(); @@ -2779,8 +2709,9 @@ public class MLPAnalysis { } + seseSummaryMap.put(fn, currentSummary); + } - private void putStallTagOnReferenceEdges(OwnershipGraph og, TempDescriptor argTD, HashSet stallTagSet, diff --git a/Robust/src/Analysis/MLP/ParentChildConflictsMap.java b/Robust/src/Analysis/MLP/ParentChildConflictsMap.java index 5819afab..5a6cd89d 100644 --- a/Robust/src/Analysis/MLP/ParentChildConflictsMap.java +++ b/Robust/src/Analysis/MLP/ParentChildConflictsMap.java @@ -7,10 +7,8 @@ import java.util.Set; import Analysis.OwnershipAnalysis.AllocationSite; import Analysis.OwnershipAnalysis.HeapRegionNode; -import Analysis.OwnershipAnalysis.ReachabilitySet; import Analysis.OwnershipAnalysis.ReferenceEdge; import Analysis.OwnershipAnalysis.TokenTupleSet; -import IR.Flat.FlatNode; import IR.Flat.TempDescriptor; public class ParentChildConflictsMap { @@ -22,15 +20,11 @@ public class ParentChildConflictsMap { private Hashtable stallMap; private Hashtable < ReferenceEdge, HashSet > stallEdgeMap; - private boolean afterChildSESE; - public ParentChildConflictsMap() { accessibleMap = new Hashtable(); stallMap = new Hashtable(); stallEdgeMap= new Hashtable < ReferenceEdge, HashSet >(); - afterChildSESE=false; - } public void makeAllInaccessible(){ @@ -61,14 +55,6 @@ public class ParentChildConflictsMap { return stallEdgeMap.get(edge); } - public void setAfterChildSESE(boolean b){ - this.afterChildSESE=b; - } - - public boolean isAfterChildSESE(){ - return afterChildSESE; - } - public Hashtable getAccessibleMap() { return accessibleMap; } @@ -118,10 +104,6 @@ public class ParentChildConflictsMap { public void merge(ParentChildConflictsMap newConflictsMap) { - if(afterChildSESE==false && newConflictsMap.isAfterChildSESE()){ - this.afterChildSESE=true; - } - Hashtable newAccessibleMap = newConflictsMap .getAccessibleMap(); Hashtable newStallMap = newConflictsMap @@ -250,7 +232,7 @@ public class ParentChildConflictsMap { ParentChildConflictsMap in = (ParentChildConflictsMap) o; - if (afterChildSESE==in.isAfterChildSESE() && accessibleMap.equals(in.getAccessibleMap()) + if ( accessibleMap.equals(in.getAccessibleMap()) && stallMap.equals(in.getStallMap())) { return true; } else { @@ -261,7 +243,7 @@ public class ParentChildConflictsMap { public String toString() { return "ParentChildConflictsMap [accessibleMap=" + accessibleMap - + ", afterChildSESE=" + afterChildSESE + ", stallMap=" + + ", stallMap=" + stallMap + "]"; } diff --git a/Robust/src/Analysis/MLP/SESESummary.java b/Robust/src/Analysis/MLP/SESESummary.java new file mode 100644 index 00000000..c0643df1 --- /dev/null +++ b/Robust/src/Analysis/MLP/SESESummary.java @@ -0,0 +1,46 @@ +package Analysis.MLP; + +import IR.Flat.FlatNode; +import IR.Flat.FlatSESEEnterNode; + +public class SESESummary { + + private FlatNode currentParent; + private FlatNode currentSESE; + + public SESESummary(FlatNode currentParent, FlatNode currentChild) { + this.currentParent = currentParent; + this.currentSESE = currentChild; + } + + public FlatNode getCurrentParent() { + return currentParent; + } + + public FlatNode getCurrentSESE() { + return currentSESE; + } + + public void setCurrentParent(FlatNode parent) { + currentParent = parent; + } + + public void setCurrentSESE(FlatNode current) { + currentSESE = current; + } + + public String toString() { + String rtn; + + rtn = "parent=" + currentParent; + if (currentSESE instanceof FlatSESEEnterNode) { + rtn += " current=" + + ((FlatSESEEnterNode) currentSESE).getPrettyIdentifier(); + } else { + rtn += " current=" + currentSESE; + } + + return rtn; + } + +} -- 2.34.1