changes: collects a set of collect effects and generates a stall site over the method...
authoryeom <yeom>
Thu, 18 Nov 2010 03:09:02 +0000 (03:09 +0000)
committeryeom <yeom>
Thu, 18 Nov 2010 03:09:02 +0000 (03:09 +0000)
Robust/src/Analysis/CallGraph/CallGraph.java
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java
Robust/src/Analysis/OoOJava/RBlockRelationAnalysis.java
Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/FlatSESEEnterNode.java
Robust/src/IR/Flat/RuntimeConflictResolver.java

index e69578ff024615a67334e138675b2de4345b23f3..1d0b6987f40549dd49f9186c5487f0237509d6cd 100644 (file)
@@ -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;
   }
   
index faae0e9e91e0fc69a5f3a7363b2596f6fa13dfec..9e686e4006ad15fe0ccd2b4a43be26b2b7537e34 100644 (file)
@@ -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;
       
 
index f908fa9073c56827542dc985aeda0df872cbbc8b..97fe3ddfc01a04a7d3b7ba87e0633c83fa0b9a01 100644 (file)
@@ -170,13 +170,41 @@ public class OoOJavaAnalysis {
 
     // 7th pass, make conflict graph
     // conflict graph is maintained by each parent sese,
+    
+    Set<FlatSESEEnterNode> 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<FlatSESEEnterNode> children = parent.getSESEChildren();
+        for (Iterator iterator2 = children.iterator(); iterator2.hasNext();) {
+          FlatSESEEnterNode child = (FlatSESEEnterNode) iterator2.next();
+          Hashtable<Taint, Set<Effect>> 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<FlatNew> 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<Taint, Set<Effect>> 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<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
-      conflictGraph.addStallSite(taint2Effects, rhs);
+      Set<FlatSESEEnterNode> 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<Taint, Set<Effect>> 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<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
-      conflictGraph.addStallSite(taint2Effects, rhs);
-      conflictGraph.addStallSite(taint2Effects, lhs);
+      Set<FlatSESEEnterNode> 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<Taint, Set<Effect>> 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<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
-      conflictGraph.addStallSite(taint2Effects, lhs);
-      if (conflictGraph.id2cn.size() > 0) {
-        sese2conflictGraph.put(currentSESE, conflictGraph);
+
+      Set<FlatSESEEnterNode> 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();
index 694083fc00878b2dd394f017394879fed6b83fe0..66306f9803992424f96f02900e658d27e297bb5f 100644 (file)
@@ -32,6 +32,9 @@ public class RBlockRelationAnalysis {
   // simply a set of every reachable SESE in the program, not
   // including caller placeholder SESEs
   protected Set<FlatSESEEnterNode> allSESEs;
+  
+  // a set of every bogus palceholder SESEs 
+  protected Set<FlatSESEEnterNode> allBogusSESEs;
 
   // per method-per node-rblock stacks
   protected Hashtable< FlatMethod, 
@@ -57,6 +60,7 @@ public class RBlockRelationAnalysis {
 
     rootSESEs = new HashSet<FlatSESEEnterNode>();
     allSESEs  = new HashSet<FlatSESEEnterNode>();
+    allBogusSESEs  = new HashSet<FlatSESEEnterNode>();
 
     methodsContainingSESEs = new HashSet<MethodDescriptor>();
 
@@ -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<FlatSESEEnterNode> itr = allSESEs.iterator();
-         itr.hasNext();
-         ) {
+    
+    Set<FlatSESEEnterNode> all=new HashSet<FlatSESEEnterNode>();
+    all.addAll(allSESEs);
+    all.addAll(allBogusSESEs);
+    
+    for (Iterator<FlatSESEEnterNode> 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<FlatSESEEnterNode> 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<FlatSESEEnterNode> 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<FlatSESEEnterNode> 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<FlatSESEEnterNode> 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()) {
index d11c5b2b4ee5dfbd59fca889721f028fb63e9972..7675623821608470ac301d58be1cfc64831ab4fe 100644 (file)
@@ -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<MethodDescriptor> descriptorsToAnalyze) {
@@ -138,9 +143,9 @@ public class RBlockStatusAnalysis {
     Hashtable<FlatNode, Hashtable<FlatSESEEnterNode, Boolean>> statusMap =
         fm2statusmap.get(fmContaining);
     Hashtable<FlatSESEEnterNode, Boolean> 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<MethodDescriptor> setPossibleCallees = new HashSet<MethodDescriptor>();
+
+      if (mdCallee.isStatic()) {
+        setPossibleCallees.add(mdCallee);
+      } else {
+        TypeDescriptor typeDesc = fc.getThis().getType();
+        setPossibleCallees.addAll(callGraph.getMethods(mdCallee, typeDesc));
+      }
+      
+      Iterator<MethodDescriptor> 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<FlatSESEEnterNode> 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)) {
index af11899977d60aaca92c91528c73700959ace48e..160fb0c6b9f5c2291d5fab0d26ae3e04a6dff8f6 100644 (file)
@@ -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<Analysis.OoOJava.SESELock> seseLockSet = oooa.getLockMappings(graph);
             Set<Analysis.OoOJava.WaitingElement> 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<Analysis.OoOJava.SESELock> 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<Analysis.OoOJava.SESELock> seseLockSet = oooa.getLockMappings(graph);
@@ -4547,7 +4565,7 @@ public class BuildCode {
        System.out.println(fm.getMethod()+"["+invars+"]");
        
        Vector<Long> queuetovar=new Vector<Long>();
-        
+
        for(int i=0;i<invars.size();i++) {
          TempDescriptor td=invars.get(i);
          Set<Analysis.OoOJava.WaitingElement> 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<Analysis.OoOJava.WaitingElement> 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<Analysis.OoOJava.WaitingElement> 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();
index c77a5cfeac866cc366541c4d76ab923e19803ca4..ca92eadc72aa055971f4cdd0912d8187cd14c568 100644 (file)
@@ -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<FlatSESEEnterNode> seseChildren;
+  
+  // a set of complete parent sese, not bogus one
+  protected Set<FlatSESEEnterNode> seseParent;
+
 
   public FlatSESEEnterNode( SESENode sn ) {
     this.id              = identifier++;
@@ -96,6 +100,7 @@ public class FlatSESEEnterNode extends FlatNode {
     dynamicInVars        = new HashSet<TempDescriptor>();
     dynamicVars          = new HashSet<TempDescriptor>();
     seseChildren         = new HashSet<FlatSESEEnterNode>();
+    seseParent            = new HashSet<FlatSESEEnterNode>();
 
     inVarsForDynamicCoarseConflictResolution = new Vector<TempDescriptor>();
     
@@ -359,6 +364,7 @@ public class FlatSESEEnterNode extends FlatNode {
   }
   
   public void addSESEChildren(Set<FlatSESEEnterNode> children){
+    
     seseChildren.addAll(children);
   }
   
@@ -439,4 +445,13 @@ public class FlatSESEEnterNode extends FlatNode {
 
     return isLeafSESE == ISLEAF_TRUE;
   }
+  
+  public Set<FlatSESEEnterNode> getSESEParent() {
+    return seseParent;
+  }
+
+  public void addSESEParent(FlatSESEEnterNode  seseParent) {
+    this.seseParent.add(seseParent);
+  }
+
 }
index 10badb462f6d56f2a16d367de245e0b531e0fae4..ca36565cf82115738511e10d685f427add3cc0b4 100644 (file)
@@ -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<Analysis.OoOJava.SESELock> seseLockSet = oooa.getLockMappings(graph);