honor the easy request of suppressing output for the disjoint reach pass that is...
[IRC.git] / Robust / src / Analysis / OoOJava / OoOJavaAnalysis.java
index 21815ea0549825af5478536d4dbc58bc5c44ad10..b498e71922ab8042618cd4e09534e2964827f28d 100644 (file)
@@ -19,11 +19,6 @@ import Analysis.Disjoint.DisjointAnalysis;
 import Analysis.Disjoint.Effect;
 import Analysis.Disjoint.EffectsAnalysis;
 import Analysis.Disjoint.Taint;
-import Analysis.MLP.CodePlan;
-import Analysis.MLP.SESEandAgePair;
-import Analysis.MLP.VSTWrapper;
-import Analysis.MLP.VarSrcTokTable;
-import Analysis.MLP.VariableSourceToken;
 import IR.Descriptor;
 import IR.MethodDescriptor;
 import IR.Operation;
@@ -52,11 +47,12 @@ public class OoOJavaAnalysis {
   private TypeUtil typeUtil;
   private CallGraph callGraph;
   private RBlockRelationAnalysis rblockRel;
-  private RBlockStatusAnalysis rblockStatus;
   private DisjointAnalysis disjointAnalysisTaints;
   private DisjointAnalysis disjointAnalysisReach;
 
-  private Hashtable<FlatNode, Set<TempDescriptor>> livenessRootView;
+  private Set<MethodDescriptor> descriptorsToAnalyze;
+
+  private Hashtable<FlatNode, Set<TempDescriptor>> livenessGlobalView;
   private Hashtable<FlatNode, Set<TempDescriptor>> livenessVirtualReads;
   private Hashtable<FlatNode, VarSrcTokTable> variableResults;
   private Hashtable<FlatNode, Set<TempDescriptor>> notAvailableResults;
@@ -66,8 +62,8 @@ public class OoOJavaAnalysis {
 
   private Hashtable<FlatEdge, FlatWriteDynamicVarNode> wdvNodesToSpliceIn;
 
-  // temporal data structures to track analysis progress. 
-  static private int uniqueLockSetId = 0;  
+  // temporal data structures to track analysis progress.
+  static private int uniqueLockSetId = 0;
   // mapping of a conflict graph to its compiled lock
   private Hashtable<ConflictGraph, HashSet<SESELock>> conflictGraph2SESELock;
   // mapping of a sese block to its conflict graph
@@ -85,26 +81,36 @@ public class OoOJavaAnalysis {
     return cp;
   }
 
-  public OoOJavaAnalysis(State state, TypeUtil typeUtil, CallGraph callGraph, Liveness liveness,
-      ArrayReferencees arrayReferencees) {
+  public Set<FlatNode> getNodesWithPlans() {
+    return codePlans.keySet();
+  }
+
+  public DisjointAnalysis getDisjointAnalysis() {
+    return disjointAnalysisTaints;
+  }
+
+
+  public OoOJavaAnalysis(State state, 
+                         TypeUtil typeUtil, 
+                         CallGraph callGraph, 
+                         Liveness liveness,
+                         ArrayReferencees arrayReferencees) {
 
     double timeStartAnalysis = (double) System.nanoTime();
 
     this.state = state;
     this.typeUtil = typeUtil;
     this.callGraph = callGraph;
-    this.maxSESEage = state.MLP_MAXSESEAGE;
-
-    livenessRootView = new Hashtable<FlatNode, Set<TempDescriptor>>();
-    livenessVirtualReads = new Hashtable<FlatNode, Set<TempDescriptor>>();
-    variableResults = new Hashtable<FlatNode, VarSrcTokTable>();
-    notAvailableResults = new Hashtable<FlatNode, Set<TempDescriptor>>();
-    codePlans = new Hashtable<FlatNode, CodePlan>();
-    wdvNodesToSpliceIn = new Hashtable<FlatEdge, FlatWriteDynamicVarNode>();
-
-    notAvailableIntoSESE = new Hashtable<FlatSESEEnterNode, Set<TempDescriptor>>();
-
-    sese2conflictGraph = new Hashtable<FlatNode, ConflictGraph>();
+    this.maxSESEage = state.OOO_MAXSESEAGE;
+
+    livenessGlobalView     = new Hashtable<FlatNode, Set<TempDescriptor>>();
+    livenessVirtualReads   = new Hashtable<FlatNode, Set<TempDescriptor>>();
+    variableResults        = new Hashtable<FlatNode, VarSrcTokTable>();
+    notAvailableResults    = new Hashtable<FlatNode, Set<TempDescriptor>>();
+    codePlans              = new Hashtable<FlatNode, CodePlan>();
+    wdvNodesToSpliceIn     = new Hashtable<FlatEdge, FlatWriteDynamicVarNode>();
+    notAvailableIntoSESE   = new Hashtable<FlatSESEEnterNode, Set<TempDescriptor>>();
+    sese2conflictGraph     = new Hashtable<FlatNode, ConflictGraph>();
     conflictGraph2SESELock = new Hashtable<ConflictGraph, HashSet<SESELock>>();
 
     // add all methods transitively reachable from the
@@ -112,25 +118,27 @@ public class OoOJavaAnalysis {
     MethodDescriptor mdSourceEntry = typeUtil.getMain();
     FlatMethod fmMain = state.getMethodFlat(mdSourceEntry);
 
-    Set<MethodDescriptor> descriptorsToAnalyze = callGraph.getAllMethods(mdSourceEntry);
+    descriptorsToAnalyze = callGraph.getAllMethods(mdSourceEntry);
 
     descriptorsToAnalyze.add(mdSourceEntry);
 
-    
-    // 1st pass, find basic rblock relations & status
+    // 1st pass, find basic rblock relations & potential stall sites
     rblockRel = new RBlockRelationAnalysis(state, typeUtil, callGraph);
-    rblockStatus = new RBlockStatusAnalysis(state, typeUtil, callGraph, rblockRel);
-
+    VarSrcTokTable.rblockRel = rblockRel;
 
     // 2nd pass, liveness, in-set out-set (no virtual reads yet!)
-    Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
-    while (rootItr.hasNext()) {
-      FlatSESEEnterNode root = rootItr.next();
-      livenessAnalysisBackward(root, true, null);
+    Iterator<MethodDescriptor> methItr = descriptorsToAnalyze.iterator();
+    while (methItr.hasNext()) {
+      Descriptor d = methItr.next();
+      FlatMethod fm = state.getMethodFlat(d);
+
+      // note we can't use the general liveness analysis already in
+      // the compiler because this analysis is task-aware
+      livenessAnalysisBackward(fm);
     }
 
     // 3rd pass, variable analysis
-    Iterator<MethodDescriptor> methItr = descriptorsToAnalyze.iterator();
+    methItr = descriptorsToAnalyze.iterator();
     while (methItr.hasNext()) {
       Descriptor d = methItr.next();
       FlatMethod fm = state.getMethodFlat(d);
@@ -142,25 +150,21 @@ public class OoOJavaAnalysis {
 
     // 4th pass, compute liveness contribution from
     // virtual reads discovered in variable pass
-    rootItr = rblockRel.getRootSESEs().iterator();
-    while (rootItr.hasNext()) {
-      FlatSESEEnterNode root = rootItr.next();
-      livenessAnalysisBackward(root, true, null);
+    methItr = descriptorsToAnalyze.iterator();
+    while (methItr.hasNext()) {
+      Descriptor d = methItr.next();
+      FlatMethod fm = state.getMethodFlat(d);
+      livenessAnalysisBackward(fm);
     }
 
     // 5th pass, use disjointness with NO FLAGGED REGIONS
     // to compute taints and effects
-    disjointAnalysisTaints = 
-      new DisjointAnalysis(state, 
-                           typeUtil, 
-                           callGraph, 
-                           liveness,
-                           arrayReferencees, 
-                           null, // no FlatNew set to flag
-                           rblockRel, 
-                           rblockStatus
-                           );
+    disjointAnalysisTaints =
+        new DisjointAnalysis(state, typeUtil, callGraph, liveness, arrayReferencees, null, 
+                             rblockRel,
+                             true ); // suppress output--this is an intermediate pass
 
+    /*
     // 6th pass, not available analysis FOR VARIABLES!
     methItr = descriptorsToAnalyze.iterator();
     while (methItr.hasNext()) {
@@ -171,211 +175,227 @@ public class OoOJavaAnalysis {
       // point, in a forward fixed-point pass
       notAvailableForward(fm);
     }
-    
-    // 7th pass,  make conflict graph
+
+    // 7th pass, make conflict graph
     // conflict graph is maintained by each parent sese,
-    Iterator descItr=disjointAnalysisTaints.getDescriptorsToAnalyze().iterator();
-    while (descItr.hasNext()) {
-      Descriptor d = (Descriptor)descItr.next();
-      FlatMethod fm = state.getMethodFlat(d);
-      if(fm != null)
-        makeConflictGraph(fm);
-    }
+    
+    Set<FlatSESEEnterNode> allSESEs=rblockRel.getAllSESEs();
+    for (Iterator iterator = allSESEs.iterator(); iterator.hasNext();) {
 
-    // debug routine 
-    /*
-    Iterator iter = sese2conflictGraph.entrySet().iterator();
-    while (iter.hasNext()) {
-      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<String> 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.toStringAllEffects());
+      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.getChildren();
+        for (Iterator iterator2 = children.iterator(); iterator2.hasNext();) {
+          FlatSESEEnterNode child = (FlatSESEEnterNode) iterator2.next();
+          Hashtable<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(child);
+          conflictGraph.addLiveIn(taint2Effects);
+          sese2conflictGraph.put(parent, conflictGraph);
+        }
       }
     }
-    */
     
-    // 8th pass, calculate all possible conflicts without using reachability info
-    // and identify set of FlatNew that next disjoint reach. analysis should flag
+    Iterator descItr = descriptorsToAnalyze.iterator();
+    while (descItr.hasNext()) {
+      Descriptor d = (Descriptor) descItr.next();
+      FlatMethod fm = state.getMethodFlat(d);
+      if (fm != null)
+        makeConflictGraph(fm);
+    }    
+
+
+    // 8th pass, calculate all possible conflicts without using reachability
+    // info
+    // and identify set of FlatNew that next disjoint reach. analysis should
+    // flag
     Set<FlatNew> sitesToFlag = new HashSet<FlatNew>();
-    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
-    disjointAnalysisReach = 
-      new DisjointAnalysis(state, 
-                           typeUtil, 
-                           callGraph, 
-                           liveness,
-                           arrayReferencees, 
-                           sitesToFlag,
-                           null, // don't do effects analysis again!
-                           null  // don't do effects analysis again!
-                           );
-    // 10th pass, calculate conflicts with reachability info
-    calculateConflicts(null, true);    
-   
+    calculateConflicts(sitesToFlag, false);
+
+
+    if (!state.RCR) {
+      // 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      
+      disjointAnalysisReach =
+        new DisjointAnalysis(state, typeUtil, callGraph, liveness, arrayReferencees, sitesToFlag,
+                            null // don't do effects analysis again!
+                            );
+      // 10th pass, calculate conflicts with reachability info
+      calculateConflicts(null, true);
+    }
     // 11th pass, compiling locks
     synthesizeLocks();
-    
+
     // 12th pass, compute a plan for code injections
-    methItr =descriptorsToAnalyze.iterator();
-    while( methItr.hasNext() ) {
-      Descriptor d  = methItr.next();      
-      FlatMethod fm = state.getMethodFlat( d );
-      codePlansForward( fm );
+    methItr = descriptorsToAnalyze.iterator();
+    while (methItr.hasNext()) {
+      Descriptor d = methItr.next();
+      FlatMethod fm = state.getMethodFlat(d);
+      codePlansForward(fm);
     }
-    
+
     // 13th pass,
     // splice new IR nodes into graph after all
     // analysis passes are complete
     Iterator spliceItr = wdvNodesToSpliceIn.entrySet().iterator();
-    while( spliceItr.hasNext() ) {
-      Map.Entry               me    = (Map.Entry)               spliceItr.next();
+    while (spliceItr.hasNext()) {
+      Map.Entry me = (Map.Entry) spliceItr.next();
       FlatWriteDynamicVarNode fwdvn = (FlatWriteDynamicVarNode) me.getValue();
       fwdvn.spliceIntoIR();
     }
-    
-    
-    if( state.OOODEBUG ) {      
+    */
+
+    if (state.OOODEBUG) {
       try {
-        writeReports( "" );
-        disjointAnalysisTaints.getEffectsAnalysis().writeEffects( "effects.txt" );
-        writeConflictGraph();
-      } catch( IOException e ) {}
+        writeReports("");
+        //disjointAnalysisTaints.getEffectsAnalysis().writeEffects("effects.txt");
+        //writeConflictGraph();
+      } catch (IOException e) {}
     }
     
+    System.out.println("\n\n\n##########################################################\n"+
+                       "Warning, lots of code changes going on, OoOJava and RCR/DFJ\n"+
+                       "systems are being cleaned up.  Until the analyses and code gen\n"+
+                       "are fully altered and coordinated, these systems will not run\n"+
+                       "to completion.  Partial stable check-ins are necessary to manage\n"+
+                       "the number of files getting touched.\n"+
+                       "##########################################################" );
+    System.exit( 0 );
   }
 
-  private void livenessAnalysisBackward(FlatSESEEnterNode fsen, boolean toplevel,
-      Hashtable<FlatSESEExitNode, Set<TempDescriptor>> liveout) {
 
-    // start from an SESE exit, visit nodes in reverse up to
-    // SESE enter in a fixed-point scheme, where children SESEs
-    // should already be analyzed and therefore can be skipped
-    // because child SESE enter node has all necessary info
-    Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
 
-    if (toplevel) {
-      flatNodesToVisit.add(fsen.getfmEnclosing().getFlatExit());
-    } else {
-      flatNodesToVisit.add(fsen.getFlatExit());
-    }
+    // debug routine
+    /*
+     * Iterator iter = sese2conflictGraph.entrySet().iterator(); while
+     * (iter.hasNext()) { 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<String> 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.toStringAllEffects()); } }
+     */
+
+
+  
+
+  private void writeFile(Set<FlatNew> sitesToFlag) {
 
-    Hashtable<FlatNode, Set<TempDescriptor>> livenessResults = new Hashtable<FlatNode, Set<TempDescriptor>>();
+    try {
+      BufferedWriter bw = new BufferedWriter(new FileWriter("sitesToFlag.txt"));
+
+      for (Iterator iterator = sitesToFlag.iterator(); iterator.hasNext();) {
+        FlatNew fn = (FlatNew) iterator.next();
+        bw.write(fn + "\n");
+      }
+      bw.close();
+    } catch (IOException e) {
 
-    if (toplevel) {
-      liveout = new Hashtable<FlatSESEExitNode, Set<TempDescriptor>>();
     }
 
-    while (!flatNodesToVisit.isEmpty()) {
+  }
+
+
+  private void livenessAnalysisBackward(FlatMethod fm) {
+
+    // flow backward across nodes to compute liveness, and
+    // take special care with sese enter/exit nodes that
+    // alter this from normal liveness analysis
+    Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
+    flatNodesToVisit.add( fm.getFlatExit() );
+
+    while( !flatNodesToVisit.isEmpty() ) {
       FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next();
-      flatNodesToVisit.remove(fn);
+      flatNodesToVisit.remove( fn );
 
-      Set<TempDescriptor> prev = livenessResults.get(fn);
+      Set<TempDescriptor> prev = livenessGlobalView.get( fn );
 
       // merge sets from control flow joins
-      Set<TempDescriptor> u = new HashSet<TempDescriptor>();
+      Set<TempDescriptor> livein = new HashSet<TempDescriptor>();
       for (int i = 0; i < fn.numNext(); i++) {
-        FlatNode nn = fn.getNext(i);
-        Set<TempDescriptor> s = livenessResults.get(nn);
-        if (s != null) {
-          u.addAll(s);
+        FlatNode nn = fn.getNext( i );
+        Set<TempDescriptor> s = livenessGlobalView.get( nn );
+        if( s != null ) {
+          livein.addAll( s );
         }
       }
-
-      Set<TempDescriptor> curr = liveness_nodeActions(fn, u, fsen, toplevel, liveout);
+      
+      Set<TempDescriptor> curr = liveness_nodeActions( fn, livein );
 
       // if a new result, schedule backward nodes for analysis
-      if (!curr.equals(prev)) {
-        livenessResults.put(fn, curr);
+      if( !curr.equals( prev ) ) {
+        livenessGlobalView.put( fn, curr );
 
-        // don't flow backwards past current SESE enter
-        if (!fn.equals(fsen)) {
-          for (int i = 0; i < fn.numPrev(); i++) {
-            FlatNode nn = fn.getPrev(i);
-            flatNodesToVisit.add(nn);
-          }
+        for( int i = 0; i < fn.numPrev(); i++ ) {
+          FlatNode nn = fn.getPrev( i );
+          flatNodesToVisit.add( nn );
         }
       }
     }
-
-    Set<TempDescriptor> s = livenessResults.get(fsen);
-    if (s != null) {
-      fsen.addInVarSet(s);
-    }
-
-    // remember liveness per node from the root view as the
-    // global liveness of variables for later passes to use
-    if (toplevel) {
-      livenessRootView.putAll(livenessResults);
-    }
-
-    // post-order traversal, so do children first
-    Iterator<FlatSESEEnterNode> childItr = fsen.getChildren().iterator();
-    while (childItr.hasNext()) {
-      FlatSESEEnterNode fsenChild = childItr.next();
-      livenessAnalysisBackward(fsenChild, false, liveout);
-    }
   }
 
-  private Set<TempDescriptor> liveness_nodeActions(FlatNode fn, Set<TempDescriptor> liveIn,
-      FlatSESEEnterNode currentSESE, boolean toplevel,
-      Hashtable<FlatSESEExitNode, Set<TempDescriptor>> liveout) {
-    switch (fn.kind()) {
+  private Set<TempDescriptor> liveness_nodeActions( FlatNode            fn, 
+                                                    Set<TempDescriptor> liveIn
+                                                    ) {
+    switch( fn.kind() ) {
 
-    case FKind.FlatSESEExitNode:
-      if (toplevel) {
-        FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
-        if (!liveout.containsKey(fsexn)) {
-          liveout.put(fsexn, new HashSet<TempDescriptor>());
-        }
-        liveout.get(fsexn).addAll(liveIn);
+    case FKind.FlatSESEEnterNode: {
+      // add whatever is live-in at a task enter to that
+      // task's in-var set
+      FlatSESEEnterNode fsen = (FlatSESEEnterNode)fn;
+      if( liveIn != null ) {
+        fsen.addInVarSet( liveIn );
       }
-      // no break, sese exits should also execute default actions
+      // no break, should also execute default actions
+    }
 
     default: {
       // handle effects of statement in reverse, writes then reads
       TempDescriptor[] writeTemps = fn.writesTemps();
-      for (int i = 0; i < writeTemps.length; ++i) {
-        liveIn.remove(writeTemps[i]);
-
-        if (!toplevel) {
-          FlatSESEExitNode fsexn = currentSESE.getFlatExit();
-          Set<TempDescriptor> livetemps = liveout.get(fsexn);
-          if (livetemps != null && livetemps.contains(writeTemps[i])) {
-            // write to a live out temp...
-            // need to put in SESE liveout set
-            currentSESE.addOutVar(writeTemps[i]);
-          }
+      for( int i = 0; i < writeTemps.length; ++i ) {
+        liveIn.remove( writeTemps[i] );
+
+        // if we are analyzing code declared directly in a task,
+        FlatSESEEnterNode fsen = rblockRel.getLocalInnerRBlock( fn );
+        if( fsen != null ) {
+          // check to see if we are writing to variables that will
+          // be live-out at the task's exit (and therefore should
+          // go in the task's out-var set)
+          FlatSESEExitNode fsexn = fsen.getFlatExit();
+          Set<TempDescriptor> livetemps = livenessGlobalView.get( fsexn );
+          if( livetemps != null && livetemps.contains( writeTemps[i] ) ) {
+            fsen.addOutVar( writeTemps[i] );
+          }          
         }
       }
 
       TempDescriptor[] readTemps = fn.readsTemps();
-      for (int i = 0; i < readTemps.length; ++i) {
-        liveIn.add(readTemps[i]);
-      }
-
-      Set<TempDescriptor> virtualReadTemps = livenessVirtualReads.get(fn);
-      if (virtualReadTemps != null) {
-        liveIn.addAll(virtualReadTemps);
+      for( int i = 0; i < readTemps.length; ++i ) {
+        liveIn.add( readTemps[i] );
       }
 
-    }
-      break;
+      Set<TempDescriptor> virtualReadTemps = livenessVirtualReads.get( fn );
+      if( virtualReadTemps != null ) {
+        liveIn.addAll( virtualReadTemps );
+      }      
+    } break;
 
     } // end switch
 
     return liveIn;
   }
 
+
   private void variableAnalysisForward(FlatMethod fm) {
 
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
@@ -385,9 +405,6 @@ public class OoOJavaAnalysis {
       FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next();
       flatNodesToVisit.remove(fn);
 
-      Stack<FlatSESEEnterNode> seseStack = rblockRel.getRBlockStacks(fm, fn);
-      assert seseStack != null;
-
       VarSrcTokTable prev = variableResults.get(fn);
 
       // merge sets from control flow joins
@@ -398,9 +415,12 @@ public class OoOJavaAnalysis {
         curr.merge(incoming);
       }
 
-      if (!seseStack.empty()) {
-        variable_nodeActions(fn, curr, seseStack.peek());
+      FlatSESEEnterNode currentSESE = rblockRel.getLocalInnerRBlock( fn );
+      if( currentSESE == null ) {
+        currentSESE = rblockRel.getCallerProxySESE();
       }
+      
+      variable_nodeActions(fn, curr, currentSESE);
 
       // if a new result, schedule forward nodes for analysis
       if (!curr.equals(prev)) {
@@ -414,23 +434,27 @@ public class OoOJavaAnalysis {
     }
   }
 
-  private void variable_nodeActions(FlatNode fn, VarSrcTokTable vstTable,
-      FlatSESEEnterNode currentSESE) {
+  private void variable_nodeActions(FlatNode          fn, 
+                                    VarSrcTokTable    vstTable,
+                                    FlatSESEEnterNode currentSESE) {
     switch (fn.kind()) {
 
+
     case FKind.FlatSESEEnterNode: {
       FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
-      assert fsen.equals(currentSESE);
-
-      vstTable.age(currentSESE);
+      // ignore currently executing SESE, at this point
+      // the analysis considers a new instance is becoming
+      // the current SESE
+      vstTable.age(fsen);
       vstTable.assertConsistency();
-    }
-      break;
+    } break;
+
 
     case FKind.FlatSESEExitNode: {
       FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
+
+      // fsen is the child of currently executing tasks
       FlatSESEEnterNode fsen = fsexn.getFlatEnter();
-      assert currentSESE.getChildren().contains(fsen);
 
       // remap all of this child's children tokens to be
       // from this child as the child exits
@@ -440,9 +464,11 @@ public class OoOJavaAnalysis {
       // written by an SESE and should be added to the in-set
       // anything virtually read by this SESE should be pruned
       // of parent or sibling sources
-      Set<TempDescriptor> liveVars = livenessRootView.get(fn);
-      Set<TempDescriptor> fsenVirtReads = vstTable.calcVirtReadsAndPruneParentAndSiblingTokens(
-          fsen, liveVars);
+      Set<TempDescriptor> liveVars = livenessGlobalView.get(fn);
+      Set<TempDescriptor> fsenVirtReads =
+        vstTable.calcVirtReadsAndPruneParentAndSiblingTokens(fsen, 
+                                                             liveVars);
+
       Set<TempDescriptor> fsenVirtReadsOld = livenessVirtualReads.get(fn);
       if (fsenVirtReadsOld != null) {
         fsenVirtReads.addAll(fsenVirtReadsOld);
@@ -462,9 +488,8 @@ public class OoOJavaAnalysis {
         vstTable.add(vst);
       }
       vstTable.assertConsistency();
+    } break;
 
-    }
-      break;
 
     case FKind.FlatOpNode: {
       FlatOpNode fon = (FlatOpNode) fn;
@@ -484,17 +509,36 @@ public class OoOJavaAnalysis {
           HashSet<TempDescriptor> ts = new HashSet<TempDescriptor>();
           ts.add(lhs);
 
-          if (currentSESE.getChildren().contains(vst.getSESE())) {
+          // when we do x = y for variables, just copy over from a child,
+          // there are two cases:
+          //  1. if the current task is the caller proxy, any local root is a child
+          boolean case1 = 
+            currentSESE.getIsCallerProxySESE() &&
+            rblockRel.getLocalRootSESEs().contains( vst.getSESE() );
+
+          //  2. if the child task is a locally-defined child of the current task
+          boolean case2 = currentSESE.getLocalChildren().contains( vst.getSESE() );
+            
+          if( case1 || case2 ) {
             // if the source comes from a child, copy it over
-            forAddition.add(new VariableSourceToken(ts, vst.getSESE(), vst.getAge(), vst
-                .getAddrVar()));
+            forAddition.add( new VariableSourceToken( ts, 
+                                                      vst.getSESE(), 
+                                                      vst.getAge(), 
+                                                      vst.getAddrVar()
+                                                      )
+                             );
           } else {
             // otherwise, stamp it as us as the source
-            forAddition.add(new VariableSourceToken(ts, currentSESE, new Integer(0), lhs));
+            forAddition.add( new VariableSourceToken( ts, 
+                                                      currentSESE, 
+                                                      new Integer( 0 ), 
+                                                      lhs
+                                                      )
+                             );
           }
         }
 
-        vstTable.addAll(forAddition);
+        vstTable.addAll( forAddition );
 
         // only break if this is an ASSIGN op node,
         // otherwise fall through to default case
@@ -507,32 +551,36 @@ public class OoOJavaAnalysis {
       // fall through to this default case
     default: {
       TempDescriptor[] writeTemps = fn.writesTemps();
-      if (writeTemps.length > 0) {
+      if( writeTemps.length > 0 ) {
 
         // for now, when writeTemps > 1, make sure
         // its a call node, programmer enforce only
         // doing stuff like calling a print routine
-        // assert writeTemps.length == 1;
-        if (writeTemps.length > 1) {
+        if( writeTemps.length > 1 ) {
           assert fn.kind() == FKind.FlatCall || fn.kind() == FKind.FlatMethod;
           break;
         }
 
-        vstTable.remove(writeTemps[0]);
+        vstTable.remove( writeTemps[0] );
 
         HashSet<TempDescriptor> ts = new HashSet<TempDescriptor>();
-        ts.add(writeTemps[0]);
-
-        vstTable.add(new VariableSourceToken(ts, currentSESE, new Integer(0), writeTemps[0]));
+        ts.add( writeTemps[0] );
+
+        vstTable.add( new VariableSourceToken( ts,
+                                               currentSESE, 
+                                               new Integer( 0 ), 
+                                               writeTemps[0]
+                                               )
+                      );
       }
 
       vstTable.assertConsistency();
-    }
-      break;
+    } break;
 
     } // end switch
   }
 
+
   private void notAvailableForward(FlatMethod fm) {
 
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
@@ -542,7 +590,7 @@ public class OoOJavaAnalysis {
       FlatNode fn = (FlatNode) flatNodesToVisit.iterator().next();
       flatNodesToVisit.remove(fn);
 
-      Stack<FlatSESEEnterNode> seseStack = rblockRel.getRBlockStacks(fm, fn);
+      Stack<FlatSESEEnterNode> seseStack = null; //rblockRel.getRBlockStacks(fm, fn);
       assert seseStack != null;
 
       Set<TempDescriptor> prev = notAvailableResults.get(fn);
@@ -660,8 +708,8 @@ public class OoOJavaAnalysis {
 
           VariableSourceToken vst = vstIfStatic.vst;
 
-          Iterator<VariableSourceToken> availItr = vstTable.get(vst.getSESE(), vst.getAge())
-              .iterator();
+          Iterator<VariableSourceToken> availItr =
+              vstTable.get(vst.getSESE(), vst.getAge()).iterator();
 
           // look through things that are also available from same source
           while (availItr.hasNext()) {
@@ -674,8 +722,8 @@ public class OoOJavaAnalysis {
               // if a variable is available from the same source, AND it ALSO
               // only comes from one statically known source, mark it available
               VSTWrapper vstIfStaticNotUsed = new VSTWrapper();
-              Integer srcTypeAlso = vstTable.getRefVarSrcType(refVarAlso, currentSESE,
-                  vstIfStaticNotUsed);
+              Integer srcTypeAlso =
+                  vstTable.getRefVarSrcType(refVarAlso, currentSESE, vstIfStaticNotUsed);
               if (srcTypeAlso.equals(VarSrcTokTable.SrcType_STATIC)) {
                 notAvailSet.remove(refVarAlso);
               }
@@ -689,85 +737,76 @@ public class OoOJavaAnalysis {
     } // end switch
   }
 
-  
-private void codePlansForward( FlatMethod fm ) {
-    
+  private void codePlansForward(FlatMethod fm) {
+
     // start from flat method top, visit every node in
     // method exactly once
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
-    flatNodesToVisit.add( fm );
+    flatNodesToVisit.add(fm);
 
-    Set<FlatNode> visited = new HashSet<FlatNode>();    
+    Set<FlatNode> visited = new HashSet<FlatNode>();
 
-    while( !flatNodesToVisit.isEmpty() ) {
+    while (!flatNodesToVisit.isEmpty()) {
       Iterator<FlatNode> fnItr = flatNodesToVisit.iterator();
       FlatNode fn = fnItr.next();
 
-      flatNodesToVisit.remove( fn );
-      visited.add( fn );      
+      flatNodesToVisit.remove(fn);
+      visited.add(fn);
 
-      Stack<FlatSESEEnterNode> seseStack = rblockRel.getRBlockStacks(fm, fn);
-      assert seseStack != null;      
+      Stack<FlatSESEEnterNode> seseStack = null; //rblockRel.getRBlockStacks(fm, fn);
+      assert seseStack != null;
 
       // use incoming results as "dot statement" or just
       // before the current statement
       VarSrcTokTable dotSTtable = new VarSrcTokTable();
-      for( int i = 0; i < fn.numPrev(); i++ ) {
-  FlatNode nn = fn.getPrev( i );
-  dotSTtable.merge( variableResults.get( nn ) );
+      for (int i = 0; i < fn.numPrev(); i++) {
+        FlatNode nn = fn.getPrev(i);
+        dotSTtable.merge(variableResults.get(nn));
       }
 
       // find dt-st notAvailableSet also
-      Set<TempDescriptor> dotSTnotAvailSet = new HashSet<TempDescriptor>();      
-      for( int i = 0; i < fn.numPrev(); i++ ) {
-  FlatNode nn = fn.getPrev( i );       
-  Set<TempDescriptor> notAvailIn = notAvailableResults.get( nn );
-        if( notAvailIn != null ) {
-    dotSTnotAvailSet.addAll( notAvailIn );
+      Set<TempDescriptor> dotSTnotAvailSet = new HashSet<TempDescriptor>();
+      for (int i = 0; i < fn.numPrev(); i++) {
+        FlatNode nn = fn.getPrev(i);
+        Set<TempDescriptor> notAvailIn = notAvailableResults.get(nn);
+        if (notAvailIn != null) {
+          dotSTnotAvailSet.addAll(notAvailIn);
         }
       }
 
-      Set<TempDescriptor> dotSTlive = livenessRootView.get( fn );
+      Set<TempDescriptor> dotSTlive = livenessGlobalView.get(fn);
 
-      if( !seseStack.empty() ) {
-  codePlans_nodeActions( fn, 
-             dotSTlive,
-             dotSTtable,
-             dotSTnotAvailSet,
-             seseStack.peek()
-             );
+      if (!seseStack.empty()) {
+        codePlans_nodeActions(fn, dotSTlive, dotSTtable, dotSTnotAvailSet, seseStack.peek());
       }
 
-      for( int i = 0; i < fn.numNext(); i++ ) {
-  FlatNode nn = fn.getNext( i );
+      for (int i = 0; i < fn.numNext(); i++) {
+        FlatNode nn = fn.getNext(i);
 
-  if( !visited.contains( nn ) ) {
-    flatNodesToVisit.add( nn );
-  }
+        if (!visited.contains(nn)) {
+          flatNodesToVisit.add(nn);
+        }
       }
     }
   }
 
-  private void codePlans_nodeActions( FlatNode fn,
-              Set<TempDescriptor> liveSetIn,
-              VarSrcTokTable vstTableIn,
-              Set<TempDescriptor> notAvailSetIn,
-              FlatSESEEnterNode currentSESE ) {
-    
-    CodePlan plan = new CodePlan( currentSESE);
+  private void codePlans_nodeActions(FlatNode fn, Set<TempDescriptor> liveSetIn,
+      VarSrcTokTable vstTableIn, Set<TempDescriptor> notAvailSetIn, FlatSESEEnterNode currentSESE) {
 
-    switch( fn.kind() ) {
+    CodePlan plan = new CodePlan(currentSESE);
+
+    switch (fn.kind()) {
 
     case FKind.FlatSESEEnterNode: {
       FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
-      assert fsen.equals( currentSESE );
+      assert fsen.equals(currentSESE);
 
       // track the source types of the in-var set so generated
       // code at this SESE issue can compute the number of
       // dependencies properly
       Iterator<TempDescriptor> inVarItr = fsen.getInVarSet().iterator();
-      while( inVarItr.hasNext() ) {
-  TempDescriptor inVar = inVarItr.next();
+      while (inVarItr.hasNext()) {
+        TempDescriptor inVar = inVarItr.next();
 
         // when we get to an SESE enter node we change the
         // currentSESE variable of this analysis to the
@@ -776,158 +815,141 @@ private void codePlansForward( FlatMethod fm ) {
         // the parent SESE in--at other FlatNode types just
         // use the currentSESE
         VSTWrapper vstIfStatic = new VSTWrapper();
-  Integer srcType = 
-    vstTableIn.getRefVarSrcType( inVar,
-               fsen.getParent(),
-                                       vstIfStatic
-                                       );
-
-  // the current SESE needs a local space to track the dynamic
-  // variable and the child needs space in its SESE record
-  if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    fsen.addDynamicInVar( inVar );
-    fsen.getParent().addDynamicVar( inVar );
-
-  } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) {
-    fsen.addStaticInVar( inVar );
-    VariableSourceToken vst = vstIfStatic.vst;
-    fsen.putStaticInVar2src( inVar, vst );
-    fsen.addStaticInVarSrc( new SESEandAgePair( vst.getSESE(), 
-                  vst.getAge() 
-                ) 
-        );
-  } else {
-    assert srcType.equals( VarSrcTokTable.SrcType_READY );
-    fsen.addReadyInVar( inVar );
-  } 
+        Integer srcType = null; //vstTableIn.getRefVarSrcType(inVar, fsen.getParent(), vstIfStatic);
+
+        // the current SESE needs a local space to track the dynamic
+        // variable and the child needs space in its SESE record
+        if (srcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          fsen.addDynamicInVar(inVar);
+          // %@%@%@%@%@%@%@% TODO!!!! @%@%@%@%@% fsen.getParent().addDynamicVar(inVar);
+
+        } else if (srcType.equals(VarSrcTokTable.SrcType_STATIC)) {
+          fsen.addStaticInVar(inVar);
+          VariableSourceToken vst = vstIfStatic.vst;
+          fsen.putStaticInVar2src(inVar, vst);
+          fsen.addStaticInVarSrc(new SESEandAgePair(vst.getSESE(), vst.getAge()));
+        } else {
+          assert srcType.equals(VarSrcTokTable.SrcType_READY);
+          fsen.addReadyInVar(inVar);
+        }
       }
 
-    } break;
+    }
+      break;
 
     case FKind.FlatSESEExitNode: {
       FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
-    } break;
+    }
+      break;
 
     case FKind.FlatOpNode: {
       FlatOpNode fon = (FlatOpNode) fn;
 
-      if( fon.getOp().getOp() == Operation.ASSIGN ) {
-  TempDescriptor lhs = fon.getDest();
-  TempDescriptor rhs = fon.getLeft();        
+      if (fon.getOp().getOp() == Operation.ASSIGN) {
+        TempDescriptor lhs = fon.getDest();
+        TempDescriptor rhs = fon.getLeft();
 
-  // if this is an op node, don't stall, copy
-  // source and delay until we need to use value
+        // if this is an op node, don't stall, copy
+        // source and delay until we need to use value
 
-  // ask whether lhs and rhs sources are dynamic, static, etc.
+        // ask whether lhs and rhs sources are dynamic, static, etc.
         VSTWrapper vstIfStatic = new VSTWrapper();
-  Integer lhsSrcType
-    = vstTableIn.getRefVarSrcType( lhs,
-           currentSESE,
-                                         vstIfStatic
-                                         );
-  Integer rhsSrcType
-    = vstTableIn.getRefVarSrcType( rhs,
-           currentSESE,
-                                         vstIfStatic
-                                         );
-
-  if( rhsSrcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    // if rhs is dynamic going in, lhs will definitely be dynamic
-    // going out of this node, so track that here   
-    plan.addDynAssign( lhs, rhs );
-    currentSESE.addDynamicVar( lhs );
-    currentSESE.addDynamicVar( rhs );
-
-  } else if( lhsSrcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    // otherwise, if the lhs is dynamic, but the rhs is not, we
-    // need to update the variable's dynamic source as "current SESE"
-    plan.addDynAssign( lhs );
-  }       
-
-  // only break if this is an ASSIGN op node,
-  // otherwise fall through to default case
-  break;
+        Integer lhsSrcType = vstTableIn.getRefVarSrcType(lhs, currentSESE, vstIfStatic);
+        Integer rhsSrcType = vstTableIn.getRefVarSrcType(rhs, currentSESE, vstIfStatic);
+
+        if (rhsSrcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          // if rhs is dynamic going in, lhs will definitely be dynamic
+          // going out of this node, so track that here
+          plan.addDynAssign(lhs, rhs);
+          currentSESE.addDynamicVar(lhs);
+          currentSESE.addDynamicVar(rhs);
+
+        } else if (lhsSrcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          // otherwise, if the lhs is dynamic, but the rhs is not, we
+          // need to update the variable's dynamic source as "current SESE"
+          plan.addDynAssign(lhs);
+        }
+
+        // only break if this is an ASSIGN op node,
+        // otherwise fall through to default case
+        break;
       }
     }
 
-    // note that FlatOpNode's that aren't ASSIGN
-    // fall through to this default case
-    default: {          
+      // note that FlatOpNode's that aren't ASSIGN
+      // fall through to this default case
+    default: {
 
       // a node with no live set has nothing to stall for
-      if( liveSetIn == null ) {
-  break;
+      if (liveSetIn == null) {
+        break;
       }
 
       TempDescriptor[] readarray = fn.readsTemps();
-      for( int i = 0; i < readarray.length; i++ ) {
+      for (int i = 0; i < readarray.length; i++) {
         TempDescriptor readtmp = readarray[i];
 
-  // ignore temps that are definitely available 
-  // when considering to stall on it
-  if( !notAvailSetIn.contains( readtmp ) ) {
-    continue;
-  }
+        // ignore temps that are definitely available
+        // when considering to stall on it
+        if (!notAvailSetIn.contains(readtmp)) {
+          continue;
+        }
 
-  // check the source type of this variable
+        // check the source type of this variable
         VSTWrapper vstIfStatic = new VSTWrapper();
-  Integer srcType 
-    = vstTableIn.getRefVarSrcType( readtmp,
-           currentSESE,
-                                         vstIfStatic
-                                         );
-
-  if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
-    // 1) It is not clear statically where this variable will
-    // come from, so dynamically we must keep track
-    // along various control paths, and therefore when we stall,
-    // just stall for the exact thing we need and move on
-    plan.addDynamicStall( readtmp );
-    currentSESE.addDynamicVar( readtmp );  
-
-  } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) {    
-    // 2) Single token/age pair: Stall for token/age pair, and copy
-    // all live variables with same token/age pair at the same
-    // time.  This is the same stuff that the notavaialable analysis 
-    // marks as now available.    
-    VariableSourceToken vst = vstIfStatic.vst;
-
-    Iterator<VariableSourceToken> availItr = 
-      vstTableIn.get( vst.getSESE(), vst.getAge() ).iterator();
-
-    while( availItr.hasNext() ) {
-      VariableSourceToken vstAlsoAvail = availItr.next();
-
-      // only grab additional stuff that is live
-      Set<TempDescriptor> copySet = new HashSet<TempDescriptor>();
-
-      Iterator<TempDescriptor> refVarItr = vstAlsoAvail.getRefVars().iterator();
-      while( refVarItr.hasNext() ) {
-        TempDescriptor refVar = refVarItr.next();
-        if( liveSetIn.contains( refVar ) ) {
-    copySet.add( refVar );
-        }
-      }
+        Integer srcType = vstTableIn.getRefVarSrcType(readtmp, currentSESE, vstIfStatic);
+
+        if (srcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
+          // 1) It is not clear statically where this variable will
+          // come from, so dynamically we must keep track
+          // along various control paths, and therefore when we stall,
+          // just stall for the exact thing we need and move on
+          plan.addDynamicStall(readtmp);
+          currentSESE.addDynamicVar(readtmp);
+
+        } else if (srcType.equals(VarSrcTokTable.SrcType_STATIC)) {
+          // 2) Single token/age pair: Stall for token/age pair, and copy
+          // all live variables with same token/age pair at the same
+          // time. This is the same stuff that the notavaialable analysis
+          // marks as now available.
+          VariableSourceToken vst = vstIfStatic.vst;
 
-      if( !copySet.isEmpty() ) {
-        plan.addStall2CopySet( vstAlsoAvail, copySet );
-      }
-    }          
+          Iterator<VariableSourceToken> availItr =
+              vstTableIn.get(vst.getSESE(), vst.getAge()).iterator();
 
-  } else {
-    // the other case for srcs is READY, so do nothing
-  }
+          while (availItr.hasNext()) {
+            VariableSourceToken vstAlsoAvail = availItr.next();
 
-  // assert that everything being stalled for is in the
-  // "not available" set coming into this flat node and
-  // that every VST identified is in the possible "stall set"
-  // that represents VST's from children SESE's
+            // only grab additional stuff that is live
+            Set<TempDescriptor> copySet = new HashSet<TempDescriptor>();
 
-      }      
-    } break;
-      
-    } // end switch
+            Iterator<TempDescriptor> refVarItr = vstAlsoAvail.getRefVars().iterator();
+            while (refVarItr.hasNext()) {
+              TempDescriptor refVar = refVarItr.next();
+              if (liveSetIn.contains(refVar)) {
+                copySet.add(refVar);
+              }
+            }
 
+            if (!copySet.isEmpty()) {
+              plan.addStall2CopySet(vstAlsoAvail, copySet);
+            }
+          }
+
+        } else {
+          // the other case for srcs is READY, so do nothing
+        }
+
+        // assert that everything being stalled for is in the
+        // "not available" set coming into this flat node and
+        // that every VST identified is in the possible "stall set"
+        // that represents VST's from children SESE's
+
+      }
+    }
+      break;
+
+    } // end switch
 
     // identify sese-age pairs that are statically useful
     // and should have an associated SESE variable in code
@@ -935,73 +957,65 @@ private void codePlansForward( FlatMethod fm ) {
     // AND ALWAYS GIVE NAMES TO PARENTS
     Set<VariableSourceToken> staticSet = vstTableIn.get();
     Iterator<VariableSourceToken> vstItr = staticSet.iterator();
-    while( vstItr.hasNext() ) {
+    while (vstItr.hasNext()) {
       VariableSourceToken vst = vstItr.next();
 
       // placeholder source tokens are useful results, but
       // the placeholder static name is never needed
-      if( vst.getSESE().getIsCallerSESEplaceholder() ) {
-  continue;
-      }
+      //if (vst.getSESE().getIsCallerSESEplaceholder()) {
+      //  continue;
+      //}
 
       FlatSESEEnterNode sese = currentSESE;
-      while( sese != null ) {
-  sese.addNeededStaticName( 
-         new SESEandAgePair( vst.getSESE(), vst.getAge() ) 
-          );
-  sese.mustTrackAtLeastAge( vst.getAge() );
-        
-  sese = sese.getParent();
+      while (sese != null) {
+        sese.addNeededStaticName(new SESEandAgePair(vst.getSESE(), vst.getAge()));
+        sese.mustTrackAtLeastAge(vst.getAge());
+
+        //@%@%@%@%@%@% TODO!!!!! @%@%@%@%@%@% sese = sese.getParent();
       }
     }
 
+    codePlans.put(fn, plan);
 
-    codePlans.put( fn, plan );
-
-
-    // if any variables at this-node-*dot* have a static source (exactly one vst)
+    // if any variables at this-node-*dot* have a static source (exactly one
+    // vst)
     // but go to a dynamic source at next-node-*dot*, create a new IR graph
     // node on that edge to track the sources dynamically
-    VarSrcTokTable thisVstTable = variableResults.get( fn );
-    for( int i = 0; i < fn.numNext(); i++ ) {
-      FlatNode            nn           = fn.getNext( i );
-      VarSrcTokTable      nextVstTable = variableResults.get( nn );
-      Set<TempDescriptor> nextLiveIn   = livenessRootView.get( nn );
+    VarSrcTokTable thisVstTable = variableResults.get(fn);
+    for (int i = 0; i < fn.numNext(); i++) {
+      FlatNode nn = fn.getNext(i);
+      VarSrcTokTable nextVstTable = variableResults.get(nn);
+      Set<TempDescriptor> nextLiveIn = livenessGlobalView.get(nn);
 
       // the table can be null if it is one of the few IR nodes
       // completely outside of the root SESE scope
-      if( nextVstTable != null && nextLiveIn != null ) {
+      if (nextVstTable != null && nextLiveIn != null) {
 
-  Hashtable<TempDescriptor, VSTWrapper> readyOrStatic2dynamicSet = 
-    thisVstTable.getReadyOrStatic2DynamicSet( nextVstTable, 
-                                                    nextLiveIn,
-                                                    currentSESE
-                                                    );
-  
-  if( !readyOrStatic2dynamicSet.isEmpty() ) {
-
-    // either add these results to partial fixed-point result
-    // or make a new one if we haven't made any here yet
-    FlatEdge fe = new FlatEdge( fn, nn );
-    FlatWriteDynamicVarNode fwdvn = wdvNodesToSpliceIn.get( fe );
-
-    if( fwdvn == null ) {
-      fwdvn = new FlatWriteDynamicVarNode( fn, 
-             nn,
-             readyOrStatic2dynamicSet,
-             currentSESE
-             );
-      wdvNodesToSpliceIn.put( fe, fwdvn );
-    } else {
-      fwdvn.addMoreVar2Src( readyOrStatic2dynamicSet );
-    }
-  }
+        Hashtable<TempDescriptor, VSTWrapper> readyOrStatic2dynamicSet =
+            thisVstTable.getReadyOrStatic2DynamicSet(nextVstTable, nextLiveIn, currentSESE);
+
+        if (!readyOrStatic2dynamicSet.isEmpty()) {
+
+          // either add these results to partial fixed-point result
+          // or make a new one if we haven't made any here yet
+          FlatEdge fe = new FlatEdge(fn, nn);
+          FlatWriteDynamicVarNode fwdvn = wdvNodesToSpliceIn.get(fe);
+
+          if (fwdvn == null) {
+            fwdvn = new FlatWriteDynamicVarNode(fn, nn, readyOrStatic2dynamicSet, currentSESE);
+            wdvNodesToSpliceIn.put(fe, fwdvn);
+          } else {
+            fwdvn.addMoreVar2Src(readyOrStatic2dynamicSet);
+          }
+        }
       }
     }
   }
-  
+
   private void makeConflictGraph(FlatMethod fm) {
 
+    System.out.println( "Creating conflict graph for "+fm );
+
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
     flatNodesToVisit.add(fm);
 
@@ -1012,16 +1026,10 @@ private void codePlansForward( FlatMethod fm ) {
       flatNodesToVisit.remove(fn);
       visited.add(fn);
 
-      Stack<FlatSESEEnterNode> seseStack = rblockRel.getRBlockStacks(fm, fn);
+      Stack<FlatSESEEnterNode> seseStack = null; //rblockRel.getRBlockStacks(fm, fn);
       assert seseStack != null;
 
       if (!seseStack.isEmpty()) {
-
-        ConflictGraph conflictGraph = sese2conflictGraph.get(seseStack.peek());
-        if (conflictGraph == null) {
-          conflictGraph = new ConflictGraph();
-        }
-
         conflictGraph_nodeAction(fn, seseStack.peek());
       }
 
@@ -1036,51 +1044,22 @@ private void codePlansForward( FlatMethod fm ) {
     }
 
   }
 
   private void conflictGraph_nodeAction(FlatNode fn, FlatSESEEnterNode currentSESE) {
 
     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();
-      }
-
-      FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
-
-      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);
-      }
+    switch (fn.kind()) {
 
-    }
-      break;
 
     case FKind.FlatFieldNode:
     case FKind.FlatElementNode: {
 
-      conflictGraph = sese2conflictGraph.get(currentSESE);
-      if (conflictGraph == null) {
-        conflictGraph = new ConflictGraph();
-      }
-
       if (fn instanceof FlatFieldNode) {
         FlatFieldNode ffn = (FlatFieldNode) fn;
         rhs = ffn.getSrc();
@@ -1089,6 +1068,11 @@ private void codePlansForward( FlatMethod fm ) {
         rhs = fen.getSrc();
       }
 
+      conflictGraph = sese2conflictGraph.get(currentSESE);
+      if (conflictGraph == null) {
+        conflictGraph = new ConflictGraph(state);
+      }
+
       // add stall site
       Hashtable<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
       conflictGraph.addStallSite(taint2Effects, rhs);
@@ -1096,17 +1080,12 @@ private void codePlansForward( FlatMethod fm ) {
       if (conflictGraph.id2cn.size() > 0) {
         sese2conflictGraph.put(currentSESE, conflictGraph);
       }
-    }
-      break;
+    } break;
+
 
     case FKind.FlatSetFieldNode:
     case FKind.FlatSetElementNode: {
 
-      conflictGraph = sese2conflictGraph.get(currentSESE);
-      if (conflictGraph == null) {
-        conflictGraph = new ConflictGraph();
-      }
-
       if (fn instanceof FlatSetFieldNode) {
         FlatSetFieldNode fsfn = (FlatSetFieldNode) fn;
         lhs = fsfn.getDst();
@@ -1117,7 +1096,11 @@ private void codePlansForward( FlatMethod fm ) {
         rhs = fsen.getSrc();
       }
 
-      // collects effects of stall site and generates stall site node
+      conflictGraph = sese2conflictGraph.get(currentSESE);
+      if (conflictGraph == null) {
+        conflictGraph = new ConflictGraph(state);
+      }
+
       Hashtable<Taint, Set<Effect>> taint2Effects = effectsAnalysis.get(fn);
       conflictGraph.addStallSite(taint2Effects, rhs);
       conflictGraph.addStallSite(taint2Effects, lhs);
@@ -1125,13 +1108,12 @@ private void codePlansForward( FlatMethod fm ) {
       if (conflictGraph.id2cn.size() > 0) {
         sese2conflictGraph.put(currentSESE, conflictGraph);
       }
-    }
-      break;
+    } break;
 
     case FKind.FlatCall: {
       conflictGraph = sese2conflictGraph.get(currentSESE);
       if (conflictGraph == null) {
-        conflictGraph = new ConflictGraph();
+        conflictGraph = new ConflictGraph(state);
       }
 
       FlatCall fc = (FlatCall) fn;
@@ -1139,18 +1121,18 @@ private void codePlansForward( FlatMethod fm ) {
 
       // 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);
-      }
-    }
+      }          
+    } break;
 
-      break;
 
     }
-
   }
 
+
   private void calculateConflicts(Set<FlatNew> sitesToFlag, boolean useReachInfo) {
     // decide fine-grain edge or coarse-grain edge among all vertexes by
     // pair-wise comparison
@@ -1158,9 +1140,10 @@ private void codePlansForward( FlatMethod fm ) {
     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(); 
+        conflictGraph.clearAllConflictEdge();
         conflictGraph.setDisJointAnalysis(disjointAnalysisReach);
         conflictGraph.setFMEnclosing(sese.getfmEnclosing());
       }
@@ -1168,7 +1151,7 @@ private void codePlansForward( FlatMethod fm ) {
       sese2conflictGraph.put(sese, conflictGraph);
     }
   }
-  
+
   private void writeConflictGraph() {
     Enumeration<FlatNode> keyEnum = sese2conflictGraph.keys();
     while (keyEnum.hasMoreElements()) {
@@ -1184,7 +1167,7 @@ private void codePlansForward( FlatMethod fm ) {
       }
     }
   }
-  
+
   private void synthesizeLocks() {
     Set<Entry<FlatNode, ConflictGraph>> graphEntrySet = sese2conflictGraph.entrySet();
     for (Iterator iterator = graphEntrySet.iterator(); iterator.hasNext();) {
@@ -1194,7 +1177,7 @@ private void codePlansForward( FlatMethod fm ) {
       calculateCovering(conflictGraph);
     }
   }
-  
+
   private void calculateCovering(ConflictGraph conflictGraph) {
     uniqueLockSetId = 0; // reset lock counter for every new conflict graph
     HashSet<ConflictEdge> fineToCover = new HashSet<ConflictEdge>();
@@ -1283,6 +1266,12 @@ private void codePlansForward( FlatMethod fm ) {
 
             changed = true;
 
+            if (seseLock.containsConflictNode(newNode)) {
+              seseLock.addEdge(edge);
+              fineToCover.remove(edge);
+              break;
+            }
+
             if (seseLock.isWriteNode(newNode)) {
               if (newNode.isStallSiteNode()) {
                 type = ConflictNode.PARENT_WRITE;
@@ -1327,6 +1316,7 @@ private void codePlansForward( FlatMethod fm ) {
         }
 
       } while (changed);
+      HashSet<ConflictEdge> notCovered=new HashSet<ConflictEdge>();
       do { // coarse
         changed = false;
         int type;
@@ -1341,18 +1331,26 @@ private void codePlansForward( FlatMethod fm ) {
                 // and it is not parent
                 type = ConflictNode.SCC;
               } else {
-                type = ConflictNode.PARENT_WRITE;
+                if(state.RCR){
+                  type = ConflictNode.PARENT_COARSE;
+                }else{
+                  type = ConflictNode.PARENT_WRITE;
+                }
               }
               seseLock.addConflictNode(edge.getVertexU(), type);
             } else {
               if (edge.getVertexU().isStallSiteNode()) {
-                if(edge.getVertexU().getWriteEffectSet().isEmpty()){
-                  type = ConflictNode.PARENT_READ;
+                if(state.RCR){
+                  type = ConflictNode.PARENT_COARSE;
                 }else{
-                  type = ConflictNode.PARENT_WRITE;
+                  if (edge.getVertexU().getWriteEffectSet().isEmpty()) {
+                    type = ConflictNode.PARENT_READ;
+                  } else {
+                    type = ConflictNode.PARENT_WRITE;
+                  }
                 }
               } else {
-                  type = ConflictNode.COARSE;
+                type = ConflictNode.COARSE;
               }
               seseLock.addConflictNode(edge.getVertexU(), type);
             }
@@ -1362,16 +1360,24 @@ private void codePlansForward( FlatMethod fm ) {
                 // and it is not parent
                 type = ConflictNode.SCC;
               } else {
-                type = ConflictNode.PARENT_WRITE;
+                if(state.RCR){
+                  type = ConflictNode.PARENT_COARSE;
+                }else{
+                  type = ConflictNode.PARENT_WRITE;
+                }
               }
               seseLock.addConflictNode(edge.getVertexV(), type);
             } else {
-              if (edge.getVertexV().isStallSiteNode()) {                
-                if(edge.getVertexV().getWriteEffectSet().isEmpty()){
-                  type = ConflictNode.PARENT_READ;
+              if (edge.getVertexV().isStallSiteNode()) {
+                if(state.RCR){
+                  type = ConflictNode.PARENT_COARSE;
                 }else{
-                  type = ConflictNode.PARENT_WRITE;
-                }                
+                  if (edge.getVertexV().getWriteEffectSet().isEmpty()) {
+                    type = ConflictNode.PARENT_READ;
+                  } else {
+                    type = ConflictNode.PARENT_WRITE;
+                  }
+                }
               } else {
                 type = ConflictNode.COARSE;
               }
@@ -1389,14 +1395,20 @@ private void codePlansForward( FlatMethod fm ) {
             // parent
             changed = true;
             
-            if(newNode.isInVarNode() &&
-                (!seseLock.hasSelfCoarseEdge(newNode)) &&
-                seseLock.hasCoarseEdgeWithParentCoarse(newNode)){
+            if (newNode.isInVarNode() && (!seseLock.hasSelfCoarseEdge(newNode))
+                && seseLock.hasCoarseEdgeWithParentCoarse(newNode)) {
               // this case can't be covered by this queue
               coarseToCover.remove(edge);
+              notCovered.add(edge);
               break;
             }
 
+            if (seseLock.containsConflictNode(newNode)) {
+              seseLock.addEdge(edge);
+              coarseToCover.remove(edge);
+              break;
+            }
+            
             if (seseLock.hasSelfCoarseEdge(newNode)) {
               // SCC
               if (newNode.isStallSiteNode()) {
@@ -1444,6 +1456,7 @@ private void codePlansForward( FlatMethod fm ) {
       lockSet.add(seseLock);
 
       toCover.clear();
+      coarseToCover.addAll(notCovered);
       toCover.addAll(fineToCover);
       toCover.addAll(coarseToCover);
 
@@ -1451,141 +1464,125 @@ private void codePlansForward( FlatMethod fm ) {
 
     conflictGraph2SESELock.put(conflictGraph, lockSet);
   }
-  
-  public ConflictGraph getConflictGraph(FlatNode sese){
-    return sese2conflictGraph.get(sese);    
+
+  public ConflictGraph getConflictGraph(FlatNode sese) {
+    return sese2conflictGraph.get(sese);
   }
-  
-  public Set<SESELock> getLockMappings(ConflictGraph graph){
+
+  public Set<SESELock> getLockMappings(ConflictGraph graph) {
     return conflictGraph2SESELock.get(graph);
   }
-  
+
   public Set<FlatSESEEnterNode> getAllSESEs() {
     return rblockRel.getAllSESEs();
   }
-  
+
   public FlatSESEEnterNode getMainSESE() {
     return rblockRel.getMainSESE();
   }
-  
-  public void writeReports( String timeReport ) throws java.io.IOException {
-
-    BufferedWriter bw = new BufferedWriter( new FileWriter( "mlpReport_summary.txt" ) );
-    bw.write( "MLP Analysis Results\n\n" );
-    bw.write( timeReport+"\n\n" );
-    printSESEHierarchy( bw );
-    bw.write( "\n" );
-    printSESEInfo( bw );
-    bw.close();
 
-    Iterator<Descriptor> methItr = disjointAnalysisTaints.getDescriptorsToAnalyze().iterator();
-    while( methItr.hasNext() ) {
-      MethodDescriptor md = (MethodDescriptor) methItr.next();      
-      FlatMethod       fm = state.getMethodFlat( md );
-      if (fm!=null) {
-        bw =
-            new BufferedWriter(new FileWriter("mlpReport_" + md.getClassMethodName()
-                + md.getSafeMethodDescriptor() + ".txt"));
-        bw.write("MLP Results for " + md + "\n-------------------\n");
-
-        FlatSESEEnterNode implicitSESE = (FlatSESEEnterNode) fm.getNext(0);
-        if (!implicitSESE.getIsCallerSESEplaceholder() && implicitSESE != rblockRel.getMainSESE()) {
-          System.out.println(implicitSESE + " is not implicit?!");
-          System.exit(-1);
-        }
-        bw.write("Dynamic vars to manage:\n  " + implicitSESE.getDynamicVarSet());
 
-        bw.write("\n\nLive-In, Root View\n------------------\n" + fm.printMethod(livenessRootView));
+  public void writeReports(String timeReport) throws java.io.IOException {
+
+    BufferedWriter bw = new BufferedWriter(new FileWriter("ooojReport_summary.txt"));
+    bw.write("OoOJava Analysis Results\n\n");
+    bw.write(timeReport + "\n\n");
+    printSESEHierarchy(bw);
+    bw.write("\n");
+    printSESEInfo(bw);
+    bw.close();
+
+    Iterator<MethodDescriptor> methItr = descriptorsToAnalyze.iterator();
+    while (methItr.hasNext()) {
+      MethodDescriptor md = methItr.next();
+      FlatMethod fm = state.getMethodFlat(md);
+      if (fm != null) {
+        bw = new BufferedWriter(new FileWriter("ooojReport_" + 
+                                               md.getClassMethodName() +
+                                               md.getSafeMethodDescriptor() + 
+                                               ".txt"));
+        bw.write("OoOJava Results for " + md + "\n-------------------\n");
+
+        //FlatSESEEnterNode implicitSESE = (FlatSESEEnterNode) fm.getNext(0);
+        //if (!implicitSESE.getIsCallerSESEplaceholder() && implicitSESE != rblockRel.getMainSESE()) {
+        //  System.out.println(implicitSESE + " is not implicit?!");
+        //  System.exit(-1);
+        //}
+        //bw.write("Dynamic vars to manage:\n  " + implicitSESE.getDynamicVarSet());
+
+        bw.write("\n\nLive-In, Root View\n------------------\n" + fm.printMethod(livenessGlobalView));
         bw.write("\n\nVariable Results-Out\n----------------\n" + fm.printMethod(variableResults));
-        bw.write("\n\nNot Available Results-Out\n---------------------\n"
-            + fm.printMethod(notAvailableResults));
-        bw.write("\n\nCode Plans\n----------\n" + fm.printMethod(codePlans));
+        //bw.write("\n\nNot Available Results-Out\n---------------------\n"
+        //    + fm.printMethod(notAvailableResults));
+        //bw.write("\n\nCode Plans\n----------\n" + fm.printMethod(codePlans));
         bw.close();
       }
     }
   }
-  
-  private void printSESEHierarchy( BufferedWriter bw ) throws java.io.IOException {
-    bw.write( "SESE Hierarchy\n--------------\n" ); 
-    Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
-    while( rootItr.hasNext() ) {
+
+  private void printSESEHierarchy(BufferedWriter bw) throws java.io.IOException {
+    bw.write("SESE Local Hierarchy\n--------------\n");
+    Iterator<FlatSESEEnterNode> rootItr = rblockRel.getLocalRootSESEs().iterator();
+    while (rootItr.hasNext()) {
       FlatSESEEnterNode root = rootItr.next();
-      if( root.getIsCallerSESEplaceholder() ) {
-  if( !root.getChildren().isEmpty() ) {
-    printSESEHierarchyTree( bw, root, 0 );
-  }
-      } else {
-  printSESEHierarchyTree( bw, root, 0 );
-      }
+      printSESEHierarchyTree(bw, root, 0);      
     }
   }
 
-  private void printSESEHierarchyTree( BufferedWriter bw,
-               FlatSESEEnterNode fsen,
-               int depth 
-             ) throws java.io.IOException {
-    for( int i = 0; i < depth; ++i ) {
-      bw.write( "  " );
+  private void printSESEHierarchyTree(BufferedWriter    bw, 
+                                      FlatSESEEnterNode fsen, 
+                                      int               depth
+                                      ) throws java.io.IOException {
+    for (int i = 0; i < depth; ++i) {
+      bw.write("  ");
     }
-    bw.write( "- "+fsen.getPrettyIdentifier()+"\n" );
+    bw.write("- " + fsen.getPrettyIdentifier() + "\n");
 
-    Iterator<FlatSESEEnterNode> childItr = fsen.getChildren().iterator();
-    while( childItr.hasNext() ) {
+    Iterator<FlatSESEEnterNode> childItr = fsen.getLocalChildren().iterator();
+    while (childItr.hasNext()) {
       FlatSESEEnterNode fsenChild = childItr.next();
-      printSESEHierarchyTree( bw, fsenChild, depth + 1 );
-    }
-  }
-
-  
-  private void printSESEInfo( BufferedWriter bw ) throws java.io.IOException {
-    bw.write("\nSESE info\n-------------\n" ); 
-    Iterator<FlatSESEEnterNode> rootItr = rblockRel.getRootSESEs().iterator();
-    while( rootItr.hasNext() ) {
-      FlatSESEEnterNode root = rootItr.next();
-      if( root.getIsCallerSESEplaceholder() ) {
-  if( !root.getChildren().isEmpty() ) {
-    printSESEInfoTree( bw, root );
-  }
-      } else {
-  printSESEInfoTree( bw, root );
-      }
+      printSESEHierarchyTree(bw, fsenChild, depth + 1);
     }
   }
 
-  private void printSESEInfoTree( BufferedWriter bw,
-          FlatSESEEnterNode fsen 
-        ) throws java.io.IOException {
+  private void printSESEInfo(BufferedWriter bw) throws java.io.IOException {
+    bw.write("\nSESE info\n-------------\n");
+    Iterator<FlatSESEEnterNode> fsenItr = rblockRel.getAllSESEs().iterator();
+    while( fsenItr.hasNext() ) {
+      FlatSESEEnterNode fsen = fsenItr.next();
 
-    if( !fsen.getIsCallerSESEplaceholder() ) {
-      bw.write( "SESE "+fsen.getPrettyIdentifier()+" {\n" );
+      bw.write("SESE " + fsen.getPrettyIdentifier());
+      if( fsen.getIsLeafSESE() ) {
+        bw.write(" (leaf)");
+      }
+      bw.write(" {\n");
 
-      bw.write( "  in-set: "+fsen.getInVarSet()+"\n" );
+      bw.write("  in-set: " + fsen.getInVarSet() + "\n");
       Iterator<TempDescriptor> tItr = fsen.getInVarSet().iterator();
-      while( tItr.hasNext() ) {
-  TempDescriptor inVar = tItr.next();
-  if( fsen.getReadyInVarSet().contains( inVar ) ) {
-    bw.write( "    (ready)  "+inVar+"\n" );
-  }
-  if( fsen.getStaticInVarSet().contains( inVar ) ) {
-    bw.write( "    (static) "+inVar+" from "+
-                    fsen.getStaticInVarSrc( inVar )+"\n" );
-  } 
-  if( fsen.getDynamicInVarSet().contains( inVar ) ) {
-    bw.write( "    (dynamic)"+inVar+"\n" );
-  }
+      while (tItr.hasNext()) {
+        TempDescriptor inVar = tItr.next();
+        if (fsen.getReadyInVarSet().contains(inVar)) {
+          bw.write("    (ready)  " + inVar + "\n");
+        }
+        if (fsen.getStaticInVarSet().contains(inVar)) {
+          bw.write("    (static) " + inVar + " from " + fsen.getStaticInVarSrc(inVar) + "\n");
+        }
+        if (fsen.getDynamicInVarSet().contains(inVar)) {
+          bw.write("    (dynamic)" + inVar + "\n");
+        }
       }
-      
-      bw.write( "   Dynamic vars to manage: "+fsen.getDynamicVarSet()+"\n");
-      
-      bw.write( "  out-set: "+fsen.getOutVarSet()+"\n" );
-      bw.write( "}\n" );
-    }
 
-    Iterator<FlatSESEEnterNode> childItr = fsen.getChildren().iterator();
-    while( childItr.hasNext() ) {
-      FlatSESEEnterNode fsenChild = childItr.next();
-      printSESEInfoTree( bw, fsenChild );
+      bw.write("   Dynamic vars to manage: " + fsen.getDynamicVarSet() + "\n");
+
+      bw.write("  out-set: " + fsen.getOutVarSet() + "\n");
+
+      bw.write("  local parent:   " + fsen.getLocalParent() + "\n");
+      bw.write("  local children: " + fsen.getLocalChildren() + "\n");
+
+      bw.write("  possible parents:  " + fsen.getParents() + "\n");
+      bw.write("  possible children: " + fsen.getChildren() + "\n");
+
+      bw.write("}\n");
     }
   }
-
 }