From 2256a2842b659291df903dd96daca956477fb6cb Mon Sep 17 00:00:00 2001 From: yeom Date: Tue, 29 Jun 2010 23:45:49 +0000 Subject: [PATCH] changes according to new forms of effect analysis --- .../Analysis/Disjoint/EffectsAnalysis.java | 58 ------ .../src/Analysis/OoOJava/ConflictGraph.java | 186 +++++++++++------- Robust/src/Analysis/OoOJava/ConflictNode.java | 23 ++- .../src/Analysis/OoOJava/OoOJavaAnalysis.java | 130 +++++++----- 4 files changed, 211 insertions(+), 186 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/EffectsAnalysis.java b/Robust/src/Analysis/Disjoint/EffectsAnalysis.java index 1ed85fa9..9ee62fb5 100644 --- a/Robust/src/Analysis/Disjoint/EffectsAnalysis.java +++ b/Robust/src/Analysis/Disjoint/EffectsAnalysis.java @@ -59,63 +59,6 @@ public class EffectsAnalysis { return taint2effects.entrySet().iterator(); } - /* - public Hashtable> getSESEEffects(FlatSESEEnterNode sese){ - - Hashtable> taint2Effects = new Hashtable>(); - Iterator iter=iteratorTaintEffectPairs(); - while (iter.hasNext()) { - Entry entry = (Entry) iter.next(); - Taint taint = (Taint) entry.getKey(); - Set effects = (Set) entry.getValue(); - if (taint.getSESE().equals(sese)) { - Iterator eIter = effects.iterator(); - while (eIter.hasNext()) { - Effect effect = eIter.next(); - if (taint.getSESE().equals(sese)) { - Set effectSet = taint2Effects.get(taint); - if (effectSet == null) { - effectSet = new HashSet(); - } - effectSet.add(effect); - taint2Effects.put(taint, effectSet); - } - } - } - } - - return taint2Effects; - - } - */ - - public Hashtable> getStallSiteEffects(FlatNode fn, TempDescriptor td){ - - Hashtable> taint2Effects = new Hashtable>(); - Iterator iter=iteratorTaintEffectPairs(); - while(iter.hasNext()){ - Entry entry=(Entry)iter.next(); - Taint taint=(Taint)entry.getKey(); - Set effects=(Set)entry.getValue(); - if(taint.getStallSite().equals(fn)){ - Iterator eIter=effects.iterator(); - while (eIter.hasNext()) { - Effect effect = eIter.next(); - if( taint.getStallSite().equals(fn) && taint.getVar().equals(td) ){ - Set effectSet=taint2Effects.get(taint); - if(effectSet==null){ - effectSet=new HashSet(); - } - effectSet.add(effect); - taint2Effects.put(taint, effectSet); - } - } - } - } - return taint2Effects; - } - - protected void add(Taint t, Effect e) { if( t.getSESE() != null && t.getSESE().getIsCallerSESEplaceholder() ) { @@ -167,7 +110,6 @@ public class EffectsAnalysis { } effects.add(e); te.put(tNoPreds, effects); - stallSite2te.put(stallSite, te); } } diff --git a/Robust/src/Analysis/OoOJava/ConflictGraph.java b/Robust/src/Analysis/OoOJava/ConflictGraph.java index 45b1cec6..6f114385 100644 --- a/Robust/src/Analysis/OoOJava/ConflictGraph.java +++ b/Robust/src/Analysis/OoOJava/ConflictGraph.java @@ -11,25 +11,43 @@ import java.util.Set; import java.util.Map.Entry; import Analysis.Disjoint.AllocSite; +import Analysis.Disjoint.DisjointAnalysis; import Analysis.Disjoint.Effect; import Analysis.Disjoint.Taint; +import IR.Flat.FlatMethod; +import IR.Flat.FlatNew; import IR.Flat.FlatNode; import IR.Flat.FlatSESEEnterNode; import IR.Flat.TempDescriptor; public class ConflictGraph { - public Hashtable id2cn; + protected Hashtable id2cn; + + protected DisjointAnalysis da; + protected FlatMethod fmEnclosing; public static final int NON_WRITE_CONFLICT = 0; public static final int FINE_GRAIN_EDGE = 1; public static final int COARSE_GRAIN_EDGE = 2; + public static final int CONFLICT = 3; public ConflictGraph() { id2cn = new Hashtable(); } - + + public void setDisJointAnalysis(DisjointAnalysis da) { + this.da = da; + } + + public void setFMEnclosing(FlatMethod fmEnclosing) { + this.fmEnclosing = fmEnclosing; + } + public void addLiveIn(Hashtable> taint2Effects) { + if (taint2Effects == null) { + return; + } Iterator entryIter = taint2Effects.entrySet().iterator(); while (entryIter.hasNext()) { Entry entry = (Entry) entryIter.next(); @@ -45,7 +63,10 @@ public class ConflictGraph { } } - public void addStallSite(Hashtable> taint2Effects) { + public void addStallSite(Hashtable> taint2Effects, TempDescriptor var) { + if (taint2Effects == null) { + return; + } Iterator entryIter = taint2Effects.entrySet().iterator(); while (entryIter.hasNext()) { Entry entry = (Entry) entryIter.next(); @@ -55,7 +76,9 @@ public class ConflictGraph { Iterator effectIter = effectSet.iterator(); while (effectIter.hasNext()) { Effect effect = (Effect) effectIter.next(); - addStallSiteEffect(taint, effect); + if (taint.getVar().equals(var)) { + addStallSiteEffect(taint, effect); + } } } } @@ -66,21 +89,14 @@ public class ConflictGraph { TempDescriptor var = t.getVar(); AllocSite as = t.getAllocSite(); - String id = var + "_" + fn; + String id = var + "_fn" + fn.hashCode(); ConflictNode node = id2cn.get(id); if (node == null) { - node = new ConflictNode(id, ConflictNode.INVAR); - } - - if (!id2cn.containsKey(id)) { - - } else { - node = id2cn.get(id); + node = new ConflictNode(id, ConflictNode.STALLSITE); } node.addEffect(as, e); id2cn.put(id, node); - } public void addLiveInNodeEffect(Taint t, Effect e) { @@ -88,18 +104,11 @@ public class ConflictGraph { TempDescriptor invar = t.getVar(); AllocSite as = t.getAllocSite(); - String id = invar + "_" + sese.getIdentifier(); - + String id = invar + "_sese" + sese.getIdentifier(); ConflictNode node = id2cn.get(id); if (node == null) { node = new ConflictNode(id, ConflictNode.INVAR); } - - if (!id2cn.containsKey(id)) { - - } else { - node = id2cn.get(id); - } node.addEffect(as, e); id2cn.put(id, node); @@ -139,7 +148,7 @@ public class ConflictGraph { } - public void analyzeConflicts() { + public void analyzeConflicts(Set sitesToFlag, boolean useReachInfo) { Set keySet = id2cn.keySet(); Set analyzedIDSet = new HashSet(); @@ -147,20 +156,24 @@ public class ConflictGraph { for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { String nodeID = (String) iterator.next(); ConflictNode node = id2cn.get(nodeID); - analyzePossibleConflicts(analyzedIDSet, node); + analyzePossibleConflicts(analyzedIDSet, node, sitesToFlag, useReachInfo); } } - private void analyzePossibleConflicts(Set analyzedIDSet, ConflictNode currentNode) { + private void analyzePossibleConflicts(Set analyzedIDSet, ConflictNode currentNode, + Set sitesToFlag, boolean useReachInfo) { // compare with all nodes // examine the case where self-edge exists int conflictType; if (currentNode.isInVarNode()) { - conflictType = calculateConflictType(currentNode); + conflictType = calculateConflictType(currentNode, useReachInfo); if (conflictType > ConflictGraph.NON_WRITE_CONFLICT) { addConflictEdge(conflictType, currentNode, currentNode); + if (sitesToFlag != null) { + sitesToFlag.addAll(currentNode.getFlatNewSet()); + } } } @@ -175,27 +188,22 @@ public class ConflictGraph { && !(analyzedIDSet.contains(currentNode.getID() + entryNodeID) || analyzedIDSet .contains(entryNodeID + currentNode.getID()))) { - if (currentNode.isStallSiteNode() && entryNode.isInVarNode()) { - /* - * int conflictType = calculateConflictType((StallSiteNode) - * currentNode, (LiveInNode) entryNode); if (conflictType > 0) { - * addConflictEdge(conflictType, currentNode, entryNode); } - * - * analyzedIDSet.add(currentNode.getID() + entryNodeID); - */ - } else if (currentNode.isInVarNode() && entryNode.isInVarNode()) { - conflictType = calculateConflictType(currentNode, entryNode); - if (conflictType > ConflictGraph.NON_WRITE_CONFLICT) { - addConflictEdge(conflictType, currentNode, entryNode); + conflictType = calculateConflictType(currentNode, entryNode, useReachInfo); + if (conflictType > ConflictGraph.NON_WRITE_CONFLICT) { + addConflictEdge(conflictType, currentNode, entryNode); + if (sitesToFlag != null) { + sitesToFlag.addAll(currentNode.getFlatNewSet()); + sitesToFlag.addAll(entryNode.getFlatNewSet()); } - analyzedIDSet.add(currentNode.getID() + entryNodeID); } + analyzedIDSet.add(currentNode.getID() + entryNodeID); + } } } - private int calculateConflictType(ConflictNode node) { + private int calculateConflictType(ConflictNode node, boolean useReachInfo) { int conflictType = ConflictGraph.NON_WRITE_CONFLICT; Hashtable> alloc2readEffects = node.getReadEffectSet(); @@ -204,16 +212,16 @@ public class ConflictGraph { conflictType = updateConflictType(conflictType, determineConflictType(alloc2writeEffects, - alloc2writeEffects)); + alloc2writeEffects, useReachInfo)); conflictType = updateConflictType(conflictType, hasStrongUpdateConflicts(alloc2SUEffects, - alloc2readEffects, alloc2writeEffects)); + alloc2readEffects, alloc2writeEffects, useReachInfo)); return conflictType; } - private int calculateConflictType(ConflictNode nodeA, ConflictNode nodeB) { + private int calculateConflictType(ConflictNode nodeA, ConflictNode nodeB, boolean useReachInfo) { int conflictType = ConflictGraph.NON_WRITE_CONFLICT; @@ -227,13 +235,15 @@ public class ConflictGraph { // if node A has write effects on reading/writing regions of node B conflictType = updateConflictType(conflictType, determineConflictType(alloc2writeEffectsA, - alloc2readEffectsB)); + alloc2readEffectsB, useReachInfo)); conflictType = updateConflictType(conflictType, determineConflictType(alloc2writeEffectsA, - alloc2writeEffectsB)); + alloc2writeEffectsB, useReachInfo)); // if node B has write effects on reading regions of node A - determineConflictType(alloc2writeEffectsB, alloc2readEffectsA); + conflictType = + updateConflictType(conflictType, determineConflictType(alloc2writeEffectsB, + alloc2readEffectsA, useReachInfo)); // strong udpate effects conflict with all effects // on objects that are reachable from the same heap roots @@ -241,21 +251,22 @@ public class ConflictGraph { if (!alloc2SUEffectsA.isEmpty()) { conflictType = updateConflictType(conflictType, hasStrongUpdateConflicts(alloc2SUEffectsA, - alloc2readEffectsB, alloc2writeEffectsB)); + alloc2readEffectsB, alloc2writeEffectsB, useReachInfo)); } // if node B has SU on regions of node A if (!alloc2SUEffectsB.isEmpty()) { conflictType = updateConflictType(conflictType, hasStrongUpdateConflicts(alloc2SUEffectsB, - alloc2readEffectsA, alloc2writeEffectsA)); + alloc2readEffectsA, alloc2writeEffectsA, useReachInfo)); } return conflictType; } private int hasStrongUpdateConflicts(Hashtable> SUEffectsTableA, - Hashtable> readTableB, Hashtable> writeTableB) { + Hashtable> readTableB, Hashtable> writeTableB, + boolean useReachInfo) { int conflictType = ConflictGraph.NON_WRITE_CONFLICT; @@ -278,13 +289,17 @@ public class ConflictGraph { if (strongUpdateA.getAffectedAllocSite().equals(effectB.getAffectedAllocSite()) && strongUpdateA.getField().equals(effectB.getField())) { - // possible conflict - // check affected allocation site can be reached from both heap - // roots - // if(og.isReachable(asA, asB, - // strongUpdateA.getAffectedAllocSite()){ - // return ConflictGraph.COARSE_GRAIN_EDGE; - // } + if (useReachInfo) { + FlatNew fnRoot1 = asA.getFlatNew(); + FlatNew fnRoot2 = asB.getFlatNew(); + FlatNew fnTarget = strongUpdateA.getAffectedAllocSite().getFlatNew(); + if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) { + conflictType = updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE); + } + } else { + return ConflictGraph.CONFLICT; + } + } } @@ -304,13 +319,13 @@ public class ConflictGraph { if (strongUpdateA.getAffectedAllocSite().equals(effectB.getAffectedAllocSite()) && strongUpdateA.getField().equals(effectB.getField())) { - // possible conflict - // check affected allocation site can be reached from both heap - // roots - // if(og.isReachable(asA, asB, - // strongUpdateA.getAffectedAllocSite()){ - // return ConflictGraph.COARSE_GRAIN_EDGE; - // } + + FlatNew fnRoot1 = asA.getFlatNew(); + FlatNew fnRoot2 = asB.getFlatNew(); + FlatNew fnTarget = strongUpdateA.getAffectedAllocSite().getFlatNew(); + if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) { + conflictType = updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE); + } } } @@ -324,7 +339,7 @@ public class ConflictGraph { } private int determineConflictType(Hashtable> nodeAtable, - Hashtable> nodeBtable) { + Hashtable> nodeBtable, boolean useReachInfo) { int conflictType = ConflictGraph.NON_WRITE_CONFLICT; @@ -337,8 +352,8 @@ public class ConflictGraph { Iterator effectItrB = nodeBtable.entrySet().iterator(); while (effectItrB.hasNext()) { Map.Entry meB = (Map.Entry) effectItrB.next(); - AllocSite asB = (AllocSite) meA.getKey(); - Set esB = (Set) meA.getValue(); + AllocSite asB = (AllocSite) meB.getKey(); + Set esB = (Set) meB.getValue(); for (Iterator iterator = esA.iterator(); iterator.hasNext();) { Effect effectA = (Effect) iterator.next(); @@ -347,16 +362,29 @@ public class ConflictGraph { if (effectA.getAffectedAllocSite().equals(effectB.getAffectedAllocSite()) && effectA.getField().equals(effectB.getField())) { - // possible conflict - /* - * if(og.isReachable(asA, asB, effectA.getAffectedAllocSite())){ - * //affected allocation site can be reached from both heap roots - * if(isFineGrainConflict()){ - * conflictType=updateConflictType(conflictType - * ,ConflictGraph.FINE_GRAIN_EDGE); }else{ - * conflictType=updateConflictType - * (conflictType,ConflictGraph.COARSE_GRAIN_EDGE); } } - */ + + if (useReachInfo) { + FlatNew fnRoot1 = asA.getFlatNew(); + FlatNew fnRoot2 = asB.getFlatNew(); + FlatNew fnTarget = effectA.getAffectedAllocSite().getFlatNew(); + if (da.mayBothReachTarget(fmEnclosing, fnRoot1, fnRoot2, fnTarget)) { + if (fnRoot1.equals(fnRoot2)) { + if (!da.mayManyReachTarget(fmEnclosing, fnRoot1, fnTarget)) { + // fine-grained conflict case + conflictType = + updateConflictType(conflictType, ConflictGraph.FINE_GRAIN_EDGE); + } else { + conflictType = + updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE); + } + } else { + conflictType = + updateConflictType(conflictType, ConflictGraph.COARSE_GRAIN_EDGE); + } + } + } else { + return ConflictGraph.CONFLICT; + } } } } @@ -374,6 +402,14 @@ public class ConflictGraph { } } + public void clearAllConflictEdge() { + Collection nodes = id2cn.values(); + for (Iterator iterator = nodes.iterator(); iterator.hasNext();) { + ConflictNode conflictNode = (ConflictNode) iterator.next(); + conflictNode.getEdgeSet().clear(); + } + } + public HashSet getEdgeSet() { HashSet returnSet = new HashSet(); diff --git a/Robust/src/Analysis/OoOJava/ConflictNode.java b/Robust/src/Analysis/OoOJava/ConflictNode.java index 3df327e6..51908e43 100644 --- a/Robust/src/Analysis/OoOJava/ConflictNode.java +++ b/Robust/src/Analysis/OoOJava/ConflictNode.java @@ -2,14 +2,17 @@ package Analysis.OoOJava; import java.util.HashSet; import java.util.Hashtable; +import java.util.Iterator; import java.util.Set; import Analysis.Disjoint.AllocSite; import Analysis.Disjoint.Effect; +import IR.Flat.FlatNew; public class ConflictNode { protected HashSet edgeSet; + protected HashSet allocSet; protected Hashtable> alloc2readEffectSet; protected Hashtable> alloc2writeEffectSet; @@ -32,6 +35,9 @@ public class ConflictNode { public ConflictNode(String id, int nodeType) { edgeSet = new HashSet(); + // redundant views of access root's + // allocation sites for efficient retrieval + allocSet = new HashSet(); alloc2readEffectSet = new Hashtable>(); alloc2writeEffectSet = new Hashtable>(); @@ -52,6 +58,7 @@ public class ConflictNode { } public void addReadEffect(AllocSite as, Effect e) { + allocSet.add(as); Set effectSet = alloc2readEffectSet.get(as); if (effectSet == null) { effectSet = new HashSet(); @@ -62,6 +69,7 @@ public class ConflictNode { } public void addWriteEffect(AllocSite as, Effect e) { + allocSet.add(as); Set effectSet = alloc2writeEffectSet.get(as); if (effectSet == null) { effectSet = new HashSet(); @@ -72,6 +80,7 @@ public class ConflictNode { } public void addStrongUpdateEffect(AllocSite as, Effect e) { + allocSet.add(as); Set effectSet = alloc2strongUpdateEffectSet.get(as); if (effectSet == null) { effectSet = new HashSet(); @@ -103,6 +112,16 @@ public class ConflictNode { public boolean isStallSiteNode() { return !isInVarNode(); } + + public Set getFlatNewSet(){ + Set fnSet=new HashSet(); + for (Iterator iterator = allocSet.iterator(); iterator.hasNext();) { + AllocSite as = (AllocSite) iterator.next(); + FlatNew fn=as.getFlatNew(); + fnSet.add(fn); + } + return fnSet; + } public Set getEdgeSet() { return edgeSet; @@ -140,7 +159,7 @@ public class ConflictNode { } - public String toString() { + public String toStringAllEffects() { String str = ""; @@ -158,5 +177,5 @@ public class ConflictNode { return str; } - + } diff --git a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java index 0c7707d3..d8ec7134 100644 --- a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java +++ b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java @@ -180,15 +180,12 @@ public class OoOJavaAnalysis { // 7th pass, make conflict graph // conflict graph is maintained by each parent sese, - // and while making the graph identify set of FlatNew - // that next disjoint reach. analysis should flag - Set sitesToFlag = new HashSet(); - - methItr = descriptorsToAnalyze.iterator(); - while (methItr.hasNext()) { - Descriptor d = methItr.next(); + Iterator descItr=disjointAnalysisTaints.getDescriptorsToAnalyze().iterator(); + while (descItr.hasNext()) { + Descriptor d = (Descriptor)descItr.next(); FlatMethod fm = state.getMethodFlat(d); - makeConflictGraph(fm, sitesToFlag); + if(fm != null) + makeConflictGraph(fm); } // debug routine @@ -197,16 +194,22 @@ public class OoOJavaAnalysis { Entry e = (Entry) iter.next(); FlatNode fn = (FlatNode) e.getKey(); ConflictGraph conflictGraph = (ConflictGraph) e.getValue(); + System.out.println("---------------------------------------"); System.out.println("CONFLICT GRAPH for " + fn); Set keySet = conflictGraph.id2cn.keySet(); for (Iterator iterator = keySet.iterator(); iterator.hasNext();) { String key = (String) iterator.next(); ConflictNode node = conflictGraph.id2cn.get(key); - System.out.println("key=" + key + " --\n" + node.toString()); + System.out.println("key=" + key + " \n" + node.toStringAllEffects()); } } - // 8th pass, ask disjoint analysis to compute reachability + // 8th pass, calculate all possible conflicts without using reachability info + // and identify set of FlatNew that next disjoint reach. analysis should flag + Set sitesToFlag = new HashSet(); + calculateConflicts(sitesToFlag,false); + + // 9th pass, ask disjoint analysis to compute reachability // for objects that may cause heap conflicts so the most // efficient method to deal with conflict can be computed // later @@ -221,11 +224,11 @@ public class OoOJavaAnalysis { null // don't do effects analysis again! ); - // 9th pass, calculate conflicts - //calculateConflicts(); + // 10th pass, calculate conflicts with reachability info + calculateConflicts(null, true); /* - // #th pass, compiling locks + // 11th pass, compiling locks synthesizeLocks(); // #th pass, writing conflict graph @@ -669,7 +672,7 @@ public class OoOJavaAnalysis { } // end switch } - private void makeConflictGraph(FlatMethod fm, Set sitesToFlag) { + private void makeConflictGraph(FlatMethod fm) { Set flatNodesToVisit = new HashSet(); flatNodesToVisit.add(fm); @@ -691,7 +694,7 @@ public class OoOJavaAnalysis { conflictGraph = new ConflictGraph(); } - conflictGraph_nodeAction(fn, seseStack.peek(), sitesToFlag); + conflictGraph_nodeAction(fn, seseStack.peek()); } // schedule forward nodes for analysis @@ -707,74 +710,99 @@ public class OoOJavaAnalysis { } - private void conflictGraph_nodeAction(FlatNode fn, FlatSESEEnterNode currentSESE, Set sitesToFlag) { + private void conflictGraph_nodeAction(FlatNode fn, FlatSESEEnterNode currentSESE) { + ConflictGraph conflictGraph; EffectsAnalysis effectsAnalysis = disjointAnalysisTaints.getEffectsAnalysis(); - ConflictGraph conflictGraph = sese2conflictGraph.get(currentSESE.getParent()); - if (conflictGraph == null) { - conflictGraph = new ConflictGraph(); - } - + switch (fn.kind()) { case FKind.FlatSESEEnterNode: { + if (currentSESE.getParent() == null) { + return; + } + conflictGraph = sese2conflictGraph.get(currentSESE.getParent()); + if (conflictGraph == null) { + conflictGraph = new ConflictGraph(); + } + FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn; if (!fsen.getIsCallerSESEplaceholder() && currentSESE.getParent() != null) { // collects effects set of invar set and generates invar node - Hashtable> taint2Effects=effectsAnalysis.get(currentSESE); + Hashtable> taint2Effects = effectsAnalysis.get(currentSESE); conflictGraph.addLiveIn(taint2Effects); } + + if (conflictGraph.id2cn.size() > 0) { + sese2conflictGraph.put(currentSESE.getParent(), conflictGraph); + } + } break; - - case FKind.FlatFieldNode: + + case FKind.FlatFieldNode: case FKind.FlatElementNode: { - + + conflictGraph = sese2conflictGraph.get(currentSESE); + if (conflictGraph == null) { + conflictGraph = new ConflictGraph(); + } + FlatFieldNode ffn = (FlatFieldNode) fn; TempDescriptor rhs = ffn.getSrc(); - - // add stall site - //Hashtable> taint2Effects=effectsAnalysis.get(fn, rhs); - //conflictGraph.addStallSite(taint2Effects); - - } + + // add stall site + Hashtable> taint2Effects = effectsAnalysis.get(fn); + conflictGraph.addStallSite(taint2Effects, rhs); + + if (conflictGraph.id2cn.size() > 0) { + sese2conflictGraph.put(currentSESE, conflictGraph); + } + } break; - - case FKind.FlatSetFieldNode: + + case FKind.FlatSetFieldNode: case FKind.FlatSetElementNode: { - + + conflictGraph = sese2conflictGraph.get(currentSESE); + if (conflictGraph == null) { + conflictGraph = new ConflictGraph(); + } + FlatSetFieldNode fsfn = (FlatSetFieldNode) fn; TempDescriptor lhs = fsfn.getDst(); TempDescriptor rhs = fsfn.getSrc(); - + // collects effects of stall site and generates stall site node - //Hashtable> taint2Effects=effectsAnalysis.get(fn, rhs); - //conflictGraph.addStallSite(taint2Effects); - - //taint2Effects=effectsAnalysis.get(fn, lhs); - //conflictGraph.addStallSite(taint2Effects); - - } + Hashtable> taint2Effects = effectsAnalysis.get(fn); + conflictGraph.addStallSite(taint2Effects, rhs); + conflictGraph.addStallSite(taint2Effects, lhs); + + if (conflictGraph.id2cn.size() > 0) { + sese2conflictGraph.put(currentSESE, conflictGraph); + } + } break; } - if (conflictGraph.id2cn.size() > 0) { - sese2conflictGraph.put(currentSESE.getParent(), conflictGraph); - } - } - - private void calculateConflicts() { + + private void calculateConflicts(Set sitesToFlag, boolean useReachInfo) { // decide fine-grain edge or coarse-grain edge among all vertexes by // pair-wise comparison - Iterator seseIter = sese2conflictGraph.keySet().iterator(); while (seseIter.hasNext()) { - FlatNode sese = seseIter.next(); + FlatSESEEnterNode sese = (FlatSESEEnterNode) seseIter.next(); ConflictGraph conflictGraph = sese2conflictGraph.get(sese); - conflictGraph.analyzeConflicts(); + if (useReachInfo) { + // clear current conflict before recalculating with reachability info + conflictGraph.clearAllConflictEdge(); + conflictGraph.setDisJointAnalysis(disjointAnalysisReach); + conflictGraph.setFMEnclosing(sese.getfmEnclosing()); + } + conflictGraph.analyzeConflicts(sitesToFlag, useReachInfo); sese2conflictGraph.put(sese, conflictGraph); } } -- 2.34.1