From 6544f23cb382921414069152071e2d7daa16f6b2 Mon Sep 17 00:00:00 2001 From: yeom Date: Thu, 18 Nov 2010 03:09:02 +0000 Subject: [PATCH] changes: collects a set of collect effects and generates a stall site over the method context --- Robust/src/Analysis/CallGraph/CallGraph.java | 3 +- .../Analysis/Disjoint/DisjointAnalysis.java | 13 +- .../src/Analysis/OoOJava/OoOJavaAnalysis.java | 144 +++++++++++------- .../OoOJava/RBlockRelationAnalysis.java | 75 +++++++-- .../OoOJava/RBlockStatusAnalysis.java | 58 ++++++- Robust/src/IR/Flat/BuildCode.java | 60 +++++--- Robust/src/IR/Flat/FlatSESEEnterNode.java | 15 ++ .../src/IR/Flat/RuntimeConflictResolver.java | 32 +++- 8 files changed, 294 insertions(+), 106 deletions(-) diff --git a/Robust/src/Analysis/CallGraph/CallGraph.java b/Robust/src/Analysis/CallGraph/CallGraph.java index e69578ff..1d0b6987 100644 --- a/Robust/src/Analysis/CallGraph/CallGraph.java +++ b/Robust/src/Analysis/CallGraph/CallGraph.java @@ -178,6 +178,7 @@ public class CallGraph { Descriptor md = (Descriptor) tovisit.iterator().next(); tovisit.remove(md); Set s = (Set) mapCaller2CalleeSet.get(md); + if (s != null) { for (Iterator it = s.iterator(); it.hasNext();) { MethodDescriptor md2 = (MethodDescriptor) it.next(); @@ -191,7 +192,7 @@ public class CallGraph { } } } - callable.retainAll(methodsContainingSESEs); +// callable.retainAll(methodsContainingSESEs); return callable; } diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index faae0e9e..9e686e40 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -1288,7 +1288,6 @@ public class DisjointAnalysis { // before transfer func, possibly inject // stall-site taint if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) { - if(rblockStatus.isInCriticalRegion(fmContaining, fn)){ // x=y.f, stall y if not accessible // contributes read effects on stall site of y @@ -1443,7 +1442,7 @@ public class DisjointAnalysis { } - + boolean debugCallSite = mdCaller.getSymbol().equals( state.DISJOINTDEBUGCALLER ) && mdCallee.getSymbol().equals( state.DISJOINTDEBUGCALLEE ); @@ -1602,6 +1601,16 @@ public class DisjointAnalysis { // now that we've taken care of building heap models for // callee analysis, finish this transformation rg = rgMergeOfPossibleCallers; + + //XXXXXXXXXXXXXXXXXXXXXXXXX + //need to consider more + FlatNode nextFN=fmCallee.getNext(0); + assert nextFN instanceof FlatSESEEnterNode; + FlatSESEEnterNode calleeSESE=(FlatSESEEnterNode)nextFN; + if(!calleeSESE.getIsLeafSESE()){ + rg.makeInaccessible( liveness.getLiveInTemps( fmContaining, fn ) ); + } + } break; diff --git a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java index f908fa90..97fe3ddf 100644 --- a/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java +++ b/Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java @@ -170,13 +170,41 @@ public class OoOJavaAnalysis { // 7th pass, make conflict graph // conflict graph is maintained by each parent sese, + + Set allSESEs=rblockRel.getAllSESEs(); + for (Iterator iterator = allSESEs.iterator(); iterator.hasNext();) { + + FlatSESEEnterNode parent = (FlatSESEEnterNode) iterator.next(); + if (!parent.getIsLeafSESE()) { + + EffectsAnalysis effectsAnalysis = disjointAnalysisTaints.getEffectsAnalysis(); + ConflictGraph conflictGraph = sese2conflictGraph.get(parent); + if (conflictGraph == null) { + conflictGraph = new ConflictGraph(state); + } + + Set children = parent.getSESEChildren(); + for (Iterator iterator2 = children.iterator(); iterator2.hasNext();) { + FlatSESEEnterNode child = (FlatSESEEnterNode) iterator2.next(); + Hashtable> taint2Effects = effectsAnalysis.get(child); + conflictGraph.addLiveIn(taint2Effects); + if(taint2Effects!=null) + System.out.println("#add ="+taint2Effects+"currentSESE="+child+" into conflictGraph="+conflictGraph); + + sese2conflictGraph.put(parent, conflictGraph); + } + } + } + Iterator descItr = disjointAnalysisTaints.getDescriptorsToAnalyze().iterator(); while (descItr.hasNext()) { Descriptor d = (Descriptor) descItr.next(); FlatMethod fm = state.getMethodFlat(d); if (fm != null) makeConflictGraph(fm); - } + } + + // debug routine /* @@ -245,6 +273,7 @@ public class OoOJavaAnalysis { } } + private void writeFile(Set sitesToFlag) { @@ -989,12 +1018,6 @@ public class OoOJavaAnalysis { assert seseStack != null; if (!seseStack.isEmpty()) { - - ConflictGraph conflictGraph = sese2conflictGraph.get(seseStack.peek()); - if (conflictGraph == null) { - conflictGraph = new ConflictGraph(state); - } - conflictGraph_nodeAction(fn, seseStack.peek()); } @@ -1015,43 +1038,20 @@ public class OoOJavaAnalysis { ConflictGraph conflictGraph; TempDescriptor lhs; TempDescriptor rhs; - + EffectsAnalysis effectsAnalysis = disjointAnalysisTaints.getEffectsAnalysis(); - switch (fn.kind()) { - - case FKind.FlatSESEEnterNode: { - - if (currentSESE.getParent() == null) { - return; - } - conflictGraph = sese2conflictGraph.get(currentSESE.getParent()); - if (conflictGraph == null) { - conflictGraph = new ConflictGraph(state); - } - - FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn; +// System.out.println("current="+currentSESE.getmdEnclosing()+" PARENT=" + currentSESE.getSESEParent()); - if (!fsen.getIsCallerSESEplaceholder() && currentSESE.getParent() != null) { - // collects effects set of invar set and generates invar node - Hashtable> taint2Effects = effectsAnalysis.get(currentSESE); - conflictGraph.addLiveIn(taint2Effects); - } - - if (conflictGraph.id2cn.size() > 0) { - sese2conflictGraph.put(currentSESE.getParent(), conflictGraph); - } - - } - break; + switch (fn.kind()) { case FKind.FlatFieldNode: case FKind.FlatElementNode: { - conflictGraph = sese2conflictGraph.get(currentSESE); - if (conflictGraph == null) { - conflictGraph = new ConflictGraph(state); - } + // conflictGraph = sese2conflictGraph.get(currentSESE); + // if (conflictGraph == null) { + // conflictGraph = new ConflictGraph(state); + // } if (fn instanceof FlatFieldNode) { FlatFieldNode ffn = (FlatFieldNode) fn; @@ -1059,26 +1059,35 @@ public class OoOJavaAnalysis { } else { FlatElementNode fen = (FlatElementNode) fn; rhs = fen.getSrc(); - } + } - // add stall site - Hashtable> taint2Effects = effectsAnalysis.get(fn); - conflictGraph.addStallSite(taint2Effects, rhs); + Set parentSet = currentSESE.getSESEParent(); + for (Iterator iterator = parentSet.iterator(); iterator.hasNext();) { + FlatSESEEnterNode parent = (FlatSESEEnterNode) iterator.next(); +// System.out.println("##current="+currentSESE.getmdEnclosing()+" PARENT=" + parent); + conflictGraph = sese2conflictGraph.get(parent); + if (conflictGraph == null) { + conflictGraph = new ConflictGraph(state); + } - if (conflictGraph.id2cn.size() > 0) { - sese2conflictGraph.put(currentSESE, conflictGraph); + // add stall site + Hashtable> taint2Effects = effectsAnalysis.get(fn); + conflictGraph.addStallSite(taint2Effects, rhs); + if (taint2Effects != null) +// System.out.println("add =" + taint2Effects + "currentSESE=" + parent +// + " into conflictGraph=" + conflictGraph); + + if (conflictGraph.id2cn.size() > 0) { + sese2conflictGraph.put(parent, conflictGraph); + } } + } break; case FKind.FlatSetFieldNode: case FKind.FlatSetElementNode: { - conflictGraph = sese2conflictGraph.get(currentSESE); - if (conflictGraph == null) { - conflictGraph = new ConflictGraph(state); - } - if (fn instanceof FlatSetFieldNode) { FlatSetFieldNode fsfn = (FlatSetFieldNode) fn; lhs = fsfn.getDst(); @@ -1090,13 +1099,23 @@ public class OoOJavaAnalysis { } // collects effects of stall site and generates stall site node - Hashtable> taint2Effects = effectsAnalysis.get(fn); - conflictGraph.addStallSite(taint2Effects, rhs); - conflictGraph.addStallSite(taint2Effects, lhs); + Set parentSet = currentSESE.getSESEParent(); + for (Iterator iterator = parentSet.iterator(); iterator.hasNext();) { + FlatSESEEnterNode parent = (FlatSESEEnterNode) iterator.next(); + conflictGraph = sese2conflictGraph.get(parent); + if (conflictGraph == null) { + conflictGraph = new ConflictGraph(state); + } - if (conflictGraph.id2cn.size() > 0) { - sese2conflictGraph.put(currentSESE, conflictGraph); + Hashtable> taint2Effects = effectsAnalysis.get(fn); + conflictGraph.addStallSite(taint2Effects, rhs); + conflictGraph.addStallSite(taint2Effects, lhs); + + if (conflictGraph.id2cn.size() > 0) { + sese2conflictGraph.put(parent, conflictGraph); + } } + } break; @@ -1111,10 +1130,22 @@ public class OoOJavaAnalysis { // collects effects of stall site and generates stall site node Hashtable> taint2Effects = effectsAnalysis.get(fn); - conflictGraph.addStallSite(taint2Effects, lhs); - if (conflictGraph.id2cn.size() > 0) { - sese2conflictGraph.put(currentSESE, conflictGraph); + + Set parentSet = currentSESE.getSESEParent(); + for (Iterator iterator = parentSet.iterator(); iterator.hasNext();) { + FlatSESEEnterNode parent = (FlatSESEEnterNode) iterator.next(); + conflictGraph = sese2conflictGraph.get(parent); + if (conflictGraph == null) { + conflictGraph = new ConflictGraph(state); + } + + conflictGraph.addStallSite(taint2Effects, lhs); + if (conflictGraph.id2cn.size() > 0) { + sese2conflictGraph.put(parent, conflictGraph); + } + } + } break; @@ -1130,6 +1161,7 @@ public class OoOJavaAnalysis { while (seseIter.hasNext()) { FlatSESEEnterNode sese = (FlatSESEEnterNode) seseIter.next(); ConflictGraph conflictGraph = sese2conflictGraph.get(sese); +// System.out.println("# CALCULATING SESE CONFLICT="+sese); if (useReachInfo) { // clear current conflict before recalculating with reachability info conflictGraph.clearAllConflictEdge(); diff --git a/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java b/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java index 694083fc..66306f98 100644 --- a/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java +++ b/Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java @@ -32,6 +32,9 @@ public class RBlockRelationAnalysis { // simply a set of every reachable SESE in the program, not // including caller placeholder SESEs protected Set allSESEs; + + // a set of every bogus palceholder SESEs + protected Set allBogusSESEs; // per method-per node-rblock stacks protected Hashtable< FlatMethod, @@ -57,6 +60,7 @@ public class RBlockRelationAnalysis { rootSESEs = new HashSet(); allSESEs = new HashSet(); + allBogusSESEs = new HashSet(); methodsContainingSESEs = new HashSet(); @@ -176,6 +180,8 @@ public class RBlockRelationAnalysis { if( !fsen.getIsCallerSESEplaceholder() ) { allSESEs.add( fsen ); methodsContainingSESEs.add( fm.getMethod() ); + }else{ + allBogusSESEs.add(fsen); } fsen.setfmEnclosing( fm ); @@ -223,17 +229,31 @@ public class RBlockRelationAnalysis { protected void computeLeafSESEs() { - for( Iterator itr = allSESEs.iterator(); - itr.hasNext(); - ) { + + Set all=new HashSet(); + all.addAll(allSESEs); + all.addAll(allBogusSESEs); + + for (Iterator itr = all.iterator(); itr.hasNext();) { FlatSESEEnterNode fsen = itr.next(); boolean hasNoNestedChildren = fsen.getChildren().isEmpty(); - boolean hasNoChildrenByCall = !hasChildrenByCall( fsen ); + boolean hasNoChildrenByCall = !hasChildrenByCall(fsen); - fsen.setIsLeafSESE( hasNoNestedChildren && - hasNoChildrenByCall ); + fsen.setIsLeafSESE(hasNoNestedChildren && hasNoChildrenByCall); } + + // for( Iterator itr = allSESEs.iterator(); + // itr.hasNext(); + // ) { + // FlatSESEEnterNode fsen = itr.next(); + // + // boolean hasNoNestedChildren = fsen.getChildren().isEmpty(); + // boolean hasNoChildrenByCall = !hasChildrenByCall( fsen ); + // + // fsen.setIsLeafSESE( hasNoNestedChildren && + // hasNoChildrenByCall ); + // } } @@ -268,22 +288,45 @@ public class RBlockRelationAnalysis { if (!reachable.isEmpty()) { hasChildrenByCall = true; - Set reachableSESEMethodSet = - callGraph.getFirstReachableMethodContainingSESE(mdCallee, methodsContainingSESEs); + if (!fsen.getIsCallerSESEplaceholder()) { + // System.out.println("%%%mdCallee="+mdCallee+" from fsen="+fsen); + Set reachableSESEMethodSet = + callGraph.getFirstReachableMethodContainingSESE(mdCallee, methodsContainingSESEs); - if (methodsContainingSESEs.contains(mdCallee)) { + // if (methodsContainingSESEs.contains(mdCallee)) { reachableSESEMethodSet.add(mdCallee); - } + // } + + // System.out.println("#"); + // System.out.println("fsen"+fsen); + // System.out.println("reachableSESEMethodSet="+reachableSESEMethodSet); + + for (Iterator iterator = reachableSESEMethodSet.iterator(); iterator.hasNext();) { + MethodDescriptor md = (MethodDescriptor) iterator.next(); + // Set seseSet = md2seseSet.get(md); + FlatMethod fm = state.getMethodFlat(md); + FlatSESEEnterNode fsenBogus = (FlatSESEEnterNode) fm.getNext(0); + fsenBogus.addSESEParent(fsen); + // System.out.println("% "+fm+"->"+fsen); + } - for (Iterator iterator = reachableSESEMethodSet.iterator(); iterator.hasNext();) { - MethodDescriptor md = (MethodDescriptor) iterator.next(); - Set seseSet = md2seseSet.get(md); - if (seseSet != null) { - fsen.addSESEChildren(seseSet); + reachableSESEMethodSet.retainAll(methodsContainingSESEs); + + for (Iterator iterator = reachableSESEMethodSet.iterator(); iterator.hasNext();) { + MethodDescriptor md = (MethodDescriptor) iterator.next(); + Set seseSet = md2seseSet.get(md); + if (seseSet != null) { + fsen.addSESEChildren(seseSet); + for (Iterator iterator2 = seseSet.iterator(); iterator2.hasNext();) { + FlatSESEEnterNode child = (FlatSESEEnterNode) iterator2.next(); + child.addSESEParent(fsen); + } + } } - } + } } + } if (fn == fsen.getFlatExit()) { diff --git a/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java b/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java index d11c5b2b..76756238 100644 --- a/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java +++ b/Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java @@ -6,13 +6,18 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.Set; import java.util.Stack; +import java.util.TreeSet; import java.util.Map.Entry; import Analysis.CallGraph.CallGraph; +import Analysis.Disjoint.ReachGraph; +import IR.Descriptor; import IR.MethodDescriptor; import IR.State; +import IR.TypeDescriptor; import IR.TypeUtil; import IR.Flat.FKind; +import IR.Flat.FlatCall; import IR.Flat.FlatMethod; import IR.Flat.FlatNode; import IR.Flat.FlatSESEEnterNode; @@ -50,7 +55,7 @@ public class RBlockStatusAnalysis { analyzeMethods(descriptorsToAnalyze); - // analyzeMethodsDebug(descriptorsToAnalyze); + //analyzeMethodsDebug(descriptorsToAnalyze); } protected void analyzeMethods(Set descriptorsToAnalyze) { @@ -138,9 +143,9 @@ public class RBlockStatusAnalysis { Hashtable> statusMap = fm2statusmap.get(fmContaining); Hashtable status = statusMap.get(fn); - + if(status.get(seseContaining).booleanValue()==true){ - //System.out.println(fn+" is in the critical region in according to "+seseContaining); +// System.out.println(fn+" is in the critical region in according to "+seseContaining); } return status.get(seseContaining).booleanValue(); @@ -158,6 +163,53 @@ public class RBlockStatusAnalysis { } } break; + + case FKind.FlatCall: { + Descriptor mdCaller = fm.getMethod(); + + FlatCall fc = (FlatCall) fn; + MethodDescriptor mdCallee = fc.getMethod(); + FlatMethod fmCallee = state.getMethodFlat( mdCallee ); + + Set setPossibleCallees = new HashSet(); + + if (mdCallee.isStatic()) { + setPossibleCallees.add(mdCallee); + } else { + TypeDescriptor typeDesc = fc.getThis().getType(); + setPossibleCallees.addAll(callGraph.getMethods(mdCallee, typeDesc)); + } + + Iterator mdItr = setPossibleCallees.iterator(); + while( mdItr.hasNext() ) { + MethodDescriptor mdPossible = mdItr.next(); + FlatMethod fmPossible = state.getMethodFlat( mdPossible ); + } + + boolean hasSESECallee=false; + for (Iterator iterator = setPossibleCallees.iterator(); iterator.hasNext();) { + MethodDescriptor md = (MethodDescriptor) iterator.next(); + FlatMethod flatMethod = state.getMethodFlat(md); + FlatNode flatNode = flatMethod.getNext(0); + assert flatNode instanceof FlatSESEEnterNode; + FlatSESEEnterNode flatSESE = (FlatSESEEnterNode) flatNode; + hasSESECallee |= (!flatSESE.getIsLeafSESE()); + } + + Stack seseStack = rra.getRBlockStacks(fm, fn); + if (!seseStack.isEmpty()) { + FlatSESEEnterNode currentParent = seseStack.peek(); + if(!status.containsKey(currentParent)){ +// System.out.println("currentParent="+currentParent+" fm="+currentParent.getfmEnclosing()+" hasSESECallee="+hasSESECallee); + status.put(currentParent, new Boolean(hasSESECallee)); + }else{ + boolean currentParentStatus=status.get(currentParent).booleanValue(); +// System.out.println("currentParent="+currentParent+" fm="+currentParent.getfmEnclosing()+" hasSESECallee="+hasSESECallee+" currentParentStatus="+currentParentStatus); + status.put(currentParent, new Boolean(hasSESECallee|currentParentStatus)); + } + } + + } break; default: { if (!(fn instanceof FlatMethod)) { diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java index af118999..160fb0c6 100644 --- a/Robust/src/IR/Flat/BuildCode.java +++ b/Robust/src/IR/Flat/BuildCode.java @@ -3371,7 +3371,15 @@ public class BuildCode { // eom // handling stall site if (state.OOOJAVA) { - Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(currentSESE); + // NEED TO FIX IT + // assumes that there is only one parent, but it is possible that + // currentSESE has more than one so we need to generate + // conditional case for each parent case + Analysis.OoOJava.ConflictGraph graph = null; + if(currentSESE.getSESEParent().size()>0){ + graph = oooa.getConflictGraph(currentSESE.getSESEParent().iterator().next()); + } +// Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(currentSESE); if(graph!=null){ Set seseLockSet = oooa.getLockMappings(graph); Set waitingElementSet = graph.getStallSiteWaitingElementSet(fn, seseLockSet); @@ -4280,8 +4288,13 @@ public class BuildCode { if(state.RCR) { dispatchMEMRC(fm, lb, fsen, output); } else if(state.OOOJAVA){ - FlatSESEEnterNode parent = fsen.getParent(); - Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(parent); + // NEED TO FIX IT + // assumes that there is only one parent, but it is possible that + // currentSESE has more than one so we need to generate + // conditional case for each parent case + assert fsen.getSESEParent().size()>0; + FlatSESEEnterNode parent = fsen.getSESEParent().iterator().next(); + Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(parent); if (graph != null && graph.hasConflictEdge()) { Set seseLockSet = oooa.getLockMappings(graph); output.println(); @@ -4533,7 +4546,12 @@ public class BuildCode { } void dispatchMEMRC(FlatMethod fm, LocalityBinding lb, FlatSESEEnterNode fsen, PrintWriter output) { - FlatSESEEnterNode parent = fsen.getParent(); + // NEED TO FIX IT + // assumes that there is only one parent, but it is possible that + // currentSESE has more than one so we need to generate + // conditional case for each parent case + assert fsen.getSESEParent().size()>0; + FlatSESEEnterNode parent = fsen.getSESEParent().iterator().next(); Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(parent); if (graph != null && graph.hasConflictEdge()) { Set seseLockSet = oooa.getLockMappings(graph); @@ -4547,7 +4565,7 @@ public class BuildCode { System.out.println(fm.getMethod()+"["+invars+"]"); Vector queuetovar=new Vector(); - + for(int i=0;i weset=seseWaitingQueue.getWaitingElementSet(td); @@ -4560,22 +4578,22 @@ public class BuildCode { numqueues++; queueSet.add(queueID); } - } - output.println(" seseToIssue->rcrRecords["+i+"].flag="+numqueues+";"); - output.println(" seseToIssue->rcrRecords["+i+"].index=0;"); - output.println(" seseToIssue->rcrRecords["+i+"].next=NULL;"); - output.println(" int dispCount"+i+"=0;"); - - for (Iterator wtit = weset.iterator(); wtit.hasNext();) { - Analysis.OoOJava.WaitingElement waitingElement = wtit.next(); - int queueID = waitingElement.getQueueID(); - if (queueID >= queuetovar.size()) - queuetovar.setSize(queueID + 1); - Long l = queuetovar.get(queueID); - long val = (l != null) ? l.longValue() : 0; - val = val | (1 << i); - queuetovar.set(queueID, new Long(val)); - } + } + output.println(" seseToIssue->rcrRecords["+i+"].flag="+numqueues+";"); + output.println(" seseToIssue->rcrRecords["+i+"].index=0;"); + output.println(" seseToIssue->rcrRecords["+i+"].next=NULL;"); + output.println(" int dispCount"+i+"=0;"); + + for (Iterator wtit = weset.iterator(); wtit.hasNext();) { + Analysis.OoOJava.WaitingElement waitingElement = wtit.next(); + int queueID = waitingElement.getQueueID(); + if (queueID >= queuetovar.size()) + queuetovar.setSize(queueID + 1); + Long l = queuetovar.get(queueID); + long val = (l != null) ? l.longValue() : 0; + val = val | (1 << i); + queuetovar.set(queueID, new Long(val)); + } } HashSet generatedqueueentry=new HashSet(); diff --git a/Robust/src/IR/Flat/FlatSESEEnterNode.java b/Robust/src/IR/Flat/FlatSESEEnterNode.java index c77a5cfe..ca92eadc 100644 --- a/Robust/src/IR/Flat/FlatSESEEnterNode.java +++ b/Robust/src/IR/Flat/FlatSESEEnterNode.java @@ -79,6 +79,10 @@ public class FlatSESEEnterNode extends FlatNode { // a set of sese located at the first in transitive call chain // starting from the current sese protected Set seseChildren; + + // a set of complete parent sese, not bogus one + protected Set seseParent; + public FlatSESEEnterNode( SESENode sn ) { this.id = identifier++; @@ -96,6 +100,7 @@ public class FlatSESEEnterNode extends FlatNode { dynamicInVars = new HashSet(); dynamicVars = new HashSet(); seseChildren = new HashSet(); + seseParent = new HashSet(); inVarsForDynamicCoarseConflictResolution = new Vector(); @@ -359,6 +364,7 @@ public class FlatSESEEnterNode extends FlatNode { } public void addSESEChildren(Set children){ + seseChildren.addAll(children); } @@ -439,4 +445,13 @@ public class FlatSESEEnterNode extends FlatNode { return isLeafSESE == ISLEAF_TRUE; } + + public Set getSESEParent() { + return seseParent; + } + + public void addSESEParent(FlatSESEEnterNode seseParent) { + this.seseParent.add(seseParent); + } + } diff --git a/Robust/src/IR/Flat/RuntimeConflictResolver.java b/Robust/src/IR/Flat/RuntimeConflictResolver.java index 10badb46..ca36565c 100644 --- a/Robust/src/IR/Flat/RuntimeConflictResolver.java +++ b/Robust/src/IR/Flat/RuntimeConflictResolver.java @@ -123,17 +123,29 @@ public class RuntimeConflictResolver { System.out.println(fsen); System.out.println(fsen.getIsCallerSESEplaceholder()); System.out.println(fsen.getParent()); - - if (fsen.getParent() != null) { - conflictGraph = oooa.getConflictGraph(fsen.getParent()); + +// if (fsen.getParent() != null) { + FlatSESEEnterNode parentSESE = null; + if (fsen.getSESEParent().size() > 0) { + parentSESE = (FlatSESEEnterNode) fsen.getSESEParent().iterator().next(); + System.out.println("fsen getParent=" + parentSESE); + conflictGraph = oooa.getConflictGraph(parentSESE); System.out.println("CG=" + conflictGraph); if (conflictGraph != null) System.out.println("Conflicts=" + conflictGraph.getConflictEffectSet(fsen)); + // conflictGraph = oooa.getConflictGraph(fsen.getParent()); + // System.out.println("CG=" + conflictGraph); + // if (conflictGraph != null) + // System.out.println("Conflicts=" + + // conflictGraph.getConflictEffectSet(fsen)); } - if (!fsen.getIsCallerSESEplaceholder() && fsen.getParent() != null - && (conflictGraph = oooa.getConflictGraph(fsen.getParent())) != null - && (conflicts = conflictGraph.getConflictEffectSet(fsen)) != null) { +// if (!fsen.getIsCallerSESEplaceholder() && fsen.getParent() != null +// && (conflictGraph = oooa.getConflictGraph(fsen.getParent())) != null +// && (conflicts = conflictGraph.getConflictEffectSet(fsen)) != null) { + if(!fsen.getIsCallerSESEplaceholder() && fsen.getSESEParent().size() > 0 + && (conflictGraph = oooa.getConflictGraph(parentSESE)) != null + && (conflicts = conflictGraph.getConflictEffectSet(fsen)) != null ){ FlatMethod fm = fsen.getfmEnclosing(); ReachGraph rg = oooa.getDisjointAnalysis().getReachGraph(fm.getMethod()); if (cSideDebug) @@ -147,7 +159,13 @@ public class RuntimeConflictResolver { FlatNode fn = codeit.next(); CodePlan cp = oooa.getCodePlan(fn); FlatSESEEnterNode currentSESE = cp.getCurrentSESE(); - Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(currentSESE); + + if(currentSESE.getSESEParent().size()==0){ + continue; + } + FlatSESEEnterNode parent=(FlatSESEEnterNode)currentSESE.getSESEParent().iterator().next(); +// Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(currentSESE); + Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(parent); if (graph != null) { Set seseLockSet = oooa.getLockMappings(graph); -- 2.34.1