bringing analysis up to clean model, buildcode is left
authorjjenista <jjenista>
Tue, 1 Feb 2011 20:28:31 +0000 (20:28 +0000)
committerjjenista <jjenista>
Tue, 1 Feb 2011 20:28:31 +0000 (20:28 +0000)
Robust/src/Analysis/OoOJava/ContextTaskNames.java [new file with mode: 0644]
Robust/src/Analysis/OoOJava/OoOJavaAnalysis.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/IR/Flat/FlatSESEEnterNode.java
Robust/src/Makefile

diff --git a/Robust/src/Analysis/OoOJava/ContextTaskNames.java b/Robust/src/Analysis/OoOJava/ContextTaskNames.java
new file mode 100644 (file)
index 0000000..fb4c9e5
--- /dev/null
@@ -0,0 +1,53 @@
+package Analysis.OoOJava;
+
+import IR.*;
+import IR.Flat.*;
+import java.util.*;
+import java.io.*;
+
+// The purpose of a ContextTaskNames is to collect the static and
+// dynamic names for tasks that the context needs to track information
+// in that context.
+//
+// For example, a method might have two tasks defined in different
+// control branches, either of which may provide a value to a third
+// task in the context.  In this case a dynamic task name should be
+// saved here so that when the code for the method is generated, a
+// local variable that points to a task will be declared.  Other flat
+// nodes will have CodePlan objects that will expect the local task
+// variable name to exist.
+//
+// There are two types of contexts: methods and task bodies.  Here we
+// don't see the difference because the names of the local variables
+// generated from these task names should be the same.
+
+
+public class ContextTaskNames {
+
+  protected Set<SESEandAgePair> needStaticNameInCode;
+  protected Set<TempDescriptor> dynamicVars;
+
+
+  public ContextTaskNames() {
+    needStaticNameInCode = new HashSet<SESEandAgePair>();
+    dynamicVars          = new HashSet<TempDescriptor>();
+  }
+
+
+  public void addNeededStaticName( SESEandAgePair p ) {
+    needStaticNameInCode.add( p );
+  }
+
+  public Set<SESEandAgePair> getNeededStaticNames() {
+    return needStaticNameInCode;
+  }
+
+  public void addDynamicVar( TempDescriptor td ) {
+    dynamicVars.add( td );
+  }
+
+  public Set<TempDescriptor> getDynamicVarSet() {
+    return dynamicVars;
+  }
+
+}
index f22c944f185e2e25e5051cca5439d7f64c499cc0..be581f30058669bb7d8a35965097a5fd3f5c3ea6 100644 (file)
@@ -62,6 +62,9 @@ public class OoOJavaAnalysis {
 
   private Hashtable<FlatEdge, FlatWriteDynamicVarNode> wdvNodesToSpliceIn;
 
+  private Hashtable<FlatNode, ContextTaskNames> fn2contextTaskNames;
+
+
   // temporal data structures to track analysis progress.
   static private int uniqueLockSetId = 0;
   // mapping of a conflict graph to its compiled lock
@@ -85,6 +88,22 @@ public class OoOJavaAnalysis {
     return codePlans.keySet();
   }
 
+  public ContextTaskNames getContextTaskNames( FlatMethod fm ) {
+    ContextTaskNames out = fn2contextTaskNames.get( fm );
+    if( out == null ) {
+      out = new ContextTaskNames();
+    }
+    return out;
+  }
+
+  public ContextTaskNames getContextTaskNames( FlatSESEEnterNode fsen ) {
+    ContextTaskNames out = fn2contextTaskNames.get( fsen );
+    if( out == null ) {
+      out = new ContextTaskNames();
+    }
+    return out;
+  }
+
   public DisjointAnalysis getDisjointAnalysis() {
     return disjointAnalysisTaints;
   }
@@ -112,6 +131,7 @@ public class OoOJavaAnalysis {
     notAvailableIntoSESE   = new Hashtable<FlatSESEEnterNode, Set<TempDescriptor>>();
     sese2conflictGraph     = new Hashtable<FlatNode, ConflictGraph>();
     conflictGraph2SESELock = new Hashtable<ConflictGraph, HashSet<SESELock>>();
+    fn2contextTaskNames    = new Hashtable<FlatNode, ContextTaskNames>();
 
     // add all methods transitively reachable from the
     // source's main to set for analysis
@@ -209,7 +229,7 @@ public class OoOJavaAnalysis {
       }
     }    
 
-    /*
+    
     // 8th pass, calculate all possible conflicts without using
     // reachability info and identify set of FlatNew that next
     // disjoint reach. analysis should flag
@@ -252,7 +272,7 @@ public class OoOJavaAnalysis {
       FlatWriteDynamicVarNode fwdvn = (FlatWriteDynamicVarNode) me.getValue();
       fwdvn.spliceIntoIR();
     }
-    */
+
 
     if (state.OOODEBUG) {
       try {
@@ -778,7 +798,9 @@ public class OoOJavaAnalysis {
         currentSESE = rblockRel.getCallerProxySESE();
       }
 
-      codePlans_nodeActions(fn, dotSTlive, dotSTtable, dotSTnotAvailSet, currentSESE);
+      codePlans_nodeActions(fm, fn, 
+                            dotSTlive, dotSTtable, dotSTnotAvailSet, 
+                            currentSESE);
 
       for (int i = 0; i < fn.numNext(); i++) {
         FlatNode nn = fn.getNext(i);
@@ -789,8 +811,9 @@ public class OoOJavaAnalysis {
       }
     }
   }
-
-  private void codePlans_nodeActions(FlatNode fn, 
+      
+  private void codePlans_nodeActions(FlatMethod fm,
+                                     FlatNode fn,
                                      Set<TempDescriptor> liveSetIn,
                                      VarSrcTokTable vstTableIn, 
                                      Set<TempDescriptor> notAvailSetIn, 
@@ -817,26 +840,18 @@ public class OoOJavaAnalysis {
         // the parent SESE in--at other FlatNode types just
         // use the currentSESE
         FlatSESEEnterNode parent = rblockRel.getLocalInnerRBlock( fn );
-
-        System.out.println( "-----\nfsen="+fsen+", parent="+parent );
-
-        assert fsen == parent;
-
-        System.exit( 0 );
-
-        if( currentSESE == null ) {
-          currentSESE = rblockRel.getCallerProxySESE();
+        if( parent == null ) {
+          parent = rblockRel.getCallerProxySESE();
         }
-        
-        /*
+                
         VSTWrapper vstIfStatic = new VSTWrapper();
-        Integer srcType = vstTableIn.getRefVarSrcType(inVar, fsen.getParent(), vstIfStatic);
+        Integer srcType = vstTableIn.getRefVarSrcType(inVar, parent, 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);
+          addDynamicVar( fsen, fm, inVar );
 
         } else if (srcType.equals(VarSrcTokTable.SrcType_STATIC)) {
           fsen.addStaticInVar(inVar);
@@ -847,16 +862,17 @@ public class OoOJavaAnalysis {
           assert srcType.equals(VarSrcTokTable.SrcType_READY);
           fsen.addReadyInVar(inVar);
         }
-        */
       }
-
-    }
-      break;
+    } break;
 
     case FKind.FlatSESEExitNode: {
       FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
-    }
-      break;
+      //TODO! Shouldn't there be a code plan for task exit
+      // where the exiting task calculates whether its own
+      // siblings need variables from its children, so the
+      // exiter should copy those variables into its own out-set
+      // and make the available?
+    } break;
 
     case FKind.FlatOpNode: {
       FlatOpNode fon = (FlatOpNode) fn;
@@ -876,9 +892,9 @@ public class OoOJavaAnalysis {
         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);
+          plan.addDynAssign( lhs, rhs );
+          addDynamicVar( currentSESE, fm, lhs );
+          addDynamicVar( currentSESE, fm, rhs );
 
         } else if (lhsSrcType.equals(VarSrcTokTable.SrcType_DYNAMIC)) {
           // otherwise, if the lhs is dynamic, but the rhs is not, we
@@ -920,8 +936,8 @@ public class OoOJavaAnalysis {
           // 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);
+          plan.addDynamicStall( readtmp );
+          addDynamicVar( currentSESE, fm, readtmp );
 
         } else if (srcType.equals(VarSrcTokTable.SrcType_STATIC)) {
           // 2) Single token/age pair: Stall for token/age pair, and copy
@@ -970,24 +986,26 @@ public class OoOJavaAnalysis {
     // identify sese-age pairs that are statically useful
     // and should have an associated SESE variable in code
     // JUST GET ALL SESE/AGE NAMES FOR NOW, PRUNE LATER,
-    // AND ALWAYS GIVE NAMES TO PARENTS
+    // AND ALWAYS GIVE NAMES TO LOCAL PARENTS
     Set<VariableSourceToken> staticSet = vstTableIn.get();
     Iterator<VariableSourceToken> vstItr = staticSet.iterator();
     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;
-      //}
+      // the caller proxy generates useful analysis facts, but we
+      // never need to generate another name for it in code (it is
+      // ALWAYS the task executing the local method context)
+      if( vst.getSESE().getIsCallerProxySESE() ) {
+        continue;
+      }
 
-      FlatSESEEnterNode sese = currentSESE;
-      while (sese != null) {
-        sese.addNeededStaticName(new SESEandAgePair(vst.getSESE(), vst.getAge()));
-        sese.mustTrackAtLeastAge(vst.getAge());
+      SESEandAgePair sap = new SESEandAgePair( vst.getSESE(), vst.getAge() );
+      sap.getSESE().mustTrackAtLeastAge( sap.getAge() );
 
-        //@%@%@%@%@%@% TODO!!!!! @%@%@%@%@%@% sese = sese.getParent();
+      FlatSESEEnterNode sese = currentSESE;
+      while( sese != null ) {
+        addNeededStaticName( sese, fm, sap );      
+        sese = sese.getLocalParent();
       }
     }
 
@@ -1028,10 +1046,55 @@ public class OoOJavaAnalysis {
     }
   }
 
+  private void addDynamicVar( FlatSESEEnterNode fsen, 
+                              FlatMethod        fm, 
+                              TempDescriptor    var ) {
+    FlatNode fnContext;
+
+    if( fsen.getIsCallerProxySESE() ) {
+      // attach the dynamic variable to track to
+      // the flat method, so it can be declared at entry
+      fnContext = fm;
+    } else {
+      // otherwise the code context is a task body
+      fnContext = fsen;
+    }
 
-  private void makeConflictGraph(FlatMethod fm) {
+    ContextTaskNames ctn = fn2contextTaskNames.get( fnContext );
+    if( ctn == null ) {
+      ctn = new ContextTaskNames();
+    }
+
+    ctn.addDynamicVar( var );
+    fn2contextTaskNames.put( fnContext, ctn );
+  }
 
-    //System.out.println( "Creating conflict graph for "+fm );
+  private void addNeededStaticName( FlatSESEEnterNode fsen, 
+                                    FlatMethod        fm, 
+                                    SESEandAgePair    sap ) {
+    FlatNode fnContext;
+
+    if( fsen.getIsCallerProxySESE() ) {
+      // attach the dynamic variable to track to
+      // the flat method, so it can be declared at entry
+      fnContext = fm;
+    } else {
+      // otherwise the code context is a task body
+      fnContext = fsen;
+    }
+
+    ContextTaskNames ctn = fn2contextTaskNames.get( fnContext );
+    if( ctn == null ) {
+      ctn = new ContextTaskNames();
+    }
+
+    ctn.addNeededStaticName( sap );
+
+    fn2contextTaskNames.put( fnContext, ctn );
+  }
+
+
+  private void makeConflictGraph(FlatMethod fm) {
 
     Set<FlatNode> flatNodesToVisit = new HashSet<FlatNode>();
     flatNodesToVisit.add(fm);
@@ -1167,14 +1230,16 @@ public class OoOJavaAnalysis {
   }
 
 
-  private void calculateConflicts(Set<FlatNew> sitesToFlag, boolean useReachInfo) {
+  private void calculateConflicts( Set<FlatNew> sitesToFlag, 
+                                   boolean      useReachInfo ) {
+
     // decide fine-grain edge or coarse-grain edge among all vertexes by
     // pair-wise comparison
     Iterator<FlatNode> seseIter = sese2conflictGraph.keySet().iterator();
     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();
@@ -1186,6 +1251,7 @@ public class OoOJavaAnalysis {
     }
   }
 
+
   private void writeConflictGraph() {
     Enumeration<FlatNode> keyEnum = sese2conflictGraph.keys();
     while (keyEnum.hasMoreElements()) {
@@ -1515,6 +1581,10 @@ public class OoOJavaAnalysis {
     return rblockRel.getMainSESE();
   }
 
+  public FlatSESEEnterNode getCallerProxySESE() {
+    return rblockRel.getCallerProxySESE();
+  }
+
 
   public void writeReports(String timeReport) throws java.io.IOException {
 
@@ -1537,18 +1607,12 @@ public class OoOJavaAnalysis {
                                                ".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("Dynamic vars to manage:\n  " + getContextTaskNames( fm ).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();
       }
     }
@@ -1606,7 +1670,7 @@ public class OoOJavaAnalysis {
         }
       }
 
-      bw.write("   Dynamic vars to manage: " + fsen.getDynamicVarSet() + "\n");
+      bw.write("   Dynamic vars to manage: " + getContextTaskNames( fsen ).getDynamicVarSet() + "\n");
 
       bw.write("  out-set: " + fsen.getOutVarSet() + "\n");
 
index 0e960d42e6d3fc2d354e3ce991e9d68c840d975f..e0c99a03b372f4fbed81a037641b42b6e5662586 100644 (file)
@@ -2067,57 +2067,58 @@ public class BuildCode {
 
 
     if( state.OOOJAVA ) {      
-      if( fm.getNext(0) instanceof FlatSESEEnterNode ) {
-       FlatSESEEnterNode callerSESEplaceholder = (FlatSESEEnterNode) fm.getNext( 0 );
-       if( callerSESEplaceholder != oooa.getMainSESE() ) {
-         // declare variables for naming static SESE's
-         output.println("   /* static SESE names */");
-         Iterator<SESEandAgePair> pItr = callerSESEplaceholder.getNeededStaticNames().iterator();
-         while( pItr.hasNext() ) {
-           SESEandAgePair pair = pItr.next();
-           output.println("   void* "+pair+" = NULL;");
-         }
-
-         // declare variables for tracking dynamic sources
-         output.println("   /* dynamic variable sources */");
-         Iterator<TempDescriptor> dynSrcItr = callerSESEplaceholder.getDynamicVarSet().iterator();
-         while( dynSrcItr.hasNext() ) {
-           TempDescriptor dynSrcVar = dynSrcItr.next();
-           output.println("   SESEcommon*  "+dynSrcVar+"_srcSESE = NULL;");
-           output.println("   INTPTR       "+dynSrcVar+"_srcOffset = 0x1;");
-         }    
-       }
-      }
-      
-      // set up related allocation sites's waiting queues
-      // eom
-
-      FlatSESEEnterNode callerSESEplaceholder = (FlatSESEEnterNode) fm.getNext( 0 );
-      if(callerSESEplaceholder!= oooa.getMainSESE()){
-        Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(callerSESEplaceholder);       
-        if (graph != null && graph.hasConflictEdge()) {          
-          output.println("   // set up waiting queues ");
-          output.println("   int numMemoryQueue=0;");
-          output.println("   int memoryQueueItemID=0;");
-          Set<Analysis.OoOJava.SESELock> lockSet = oooa.getLockMappings(graph);
-          System.out.println("#lockSet="+lockSet.hashCode());
-          System.out.println("lockset="+lockSet);
-          for (Iterator iterator = lockSet.iterator(); iterator.hasNext();) {
-            Analysis.OoOJava.SESELock seseLock = (Analysis.OoOJava.SESELock) iterator.next();
-            System.out.println("id="+seseLock.getID());
-            System.out.println("#="+seseLock);
-          }
-          System.out.println("size="+lockSet.size());
-          if (lockSet.size() > 0) {
-            output.println("   numMemoryQueue=" + lockSet.size() + ";");
-            output.println("   runningSESE->numMemoryQueue=numMemoryQueue;");
-            output.println("   runningSESE->memoryQueueArray=mlpCreateMemoryQueueArray(numMemoryQueue);");
-            output.println();
-          }
-        }
-      }
-      
-        
+      //  TODO!!!!!!!!!
+//      if( fm.getNext(0) instanceof FlatSESEEnterNode ) {
+//     FlatSESEEnterNode callerSESEplaceholder = (FlatSESEEnterNode) fm.getNext( 0 );
+//     if( callerSESEplaceholder != oooa.getMainSESE() ) {
+//       // declare variables for naming static SESE's
+//       output.println("   /* static SESE names */");
+//       Iterator<SESEandAgePair> pItr = callerSESEplaceholder.getNeededStaticNames().iterator();
+//       while( pItr.hasNext() ) {
+//         SESEandAgePair pair = pItr.next();
+//         output.println("   void* "+pair+" = NULL;");
+//       }
+//
+//       // declare variables for tracking dynamic sources
+//       output.println("   /* dynamic variable sources */");
+//       Iterator<TempDescriptor> dynSrcItr = callerSESEplaceholder.getDynamicVarSet().iterator();
+//       while( dynSrcItr.hasNext() ) {
+//         TempDescriptor dynSrcVar = dynSrcItr.next();
+//         output.println("   SESEcommon*  "+dynSrcVar+"_srcSESE = NULL;");
+//         output.println("   INTPTR       "+dynSrcVar+"_srcOffset = 0x1;");
+//       }    
+//     }
+//      }
+//      
+//      // set up related allocation sites's waiting queues
+//      // eom
+//
+//      FlatSESEEnterNode callerSESEplaceholder = (FlatSESEEnterNode) fm.getNext( 0 );
+//      if(callerSESEplaceholder!= oooa.getMainSESE()){
+//        Analysis.OoOJava.ConflictGraph graph = oooa.getConflictGraph(callerSESEplaceholder);       
+//        if (graph != null && graph.hasConflictEdge()) {          
+//          output.println("   // set up waiting queues ");
+//          output.println("   int numMemoryQueue=0;");
+//          output.println("   int memoryQueueItemID=0;");
+//          Set<Analysis.OoOJava.SESELock> lockSet = oooa.getLockMappings(graph);
+//          System.out.println("#lockSet="+lockSet.hashCode());
+//          System.out.println("lockset="+lockSet);
+//          for (Iterator iterator = lockSet.iterator(); iterator.hasNext();) {
+//            Analysis.OoOJava.SESELock seseLock = (Analysis.OoOJava.SESELock) iterator.next();
+//            System.out.println("id="+seseLock.getID());
+//            System.out.println("#="+seseLock);
+//          }
+//          System.out.println("size="+lockSet.size());
+//          if (lockSet.size() > 0) {
+//            output.println("   numMemoryQueue=" + lockSet.size() + ";");
+//            output.println("   runningSESE->numMemoryQueue=numMemoryQueue;");
+//            output.println("   runningSESE->memoryQueueArray=mlpCreateMemoryQueueArray(numMemoryQueue);");
+//            output.println();
+//          }
+//        }
+//      }
+//      
+//  
     }    
 
 
@@ -2438,21 +2439,22 @@ public class BuildCode {
 
 
     // declare variables for naming static SESE's
-    output.println("   /* static SESE names */");
-    Iterator<SESEandAgePair> pItr = fsen.getNeededStaticNames().iterator();
-    while( pItr.hasNext() ) {
-      SESEandAgePair pair = pItr.next();
-      output.println("   SESEcommon* "+pair+" = NULL;");
-    }
-
-    // declare variables for tracking dynamic sources
-    output.println("   /* dynamic variable sources */");
-    Iterator<TempDescriptor> dynSrcItr = fsen.getDynamicVarSet().iterator();
-    while( dynSrcItr.hasNext() ) {
-      TempDescriptor dynSrcVar = dynSrcItr.next();
-      output.println("   SESEcommon*  "+dynSrcVar+"_srcSESE = NULL;");
-      output.println("   INTPTR       "+dynSrcVar+"_srcOffset = 0x1;");
-    }    
+    // TODO
+    //output.println("   /* static SESE names */");
+    //Iterator<SESEandAgePair> pItr = fsen.getNeededStaticNames().iterator();
+    //while( pItr.hasNext() ) {
+    //  SESEandAgePair pair = pItr.next();
+    //  output.println("   SESEcommon* "+pair+" = NULL;");
+    //}
+    //
+    //// declare variables for tracking dynamic sources
+    //output.println("   /* dynamic variable sources */");
+    //Iterator<TempDescriptor> dynSrcItr = fsen.getDynamicVarSet().iterator();
+    //while( dynSrcItr.hasNext() ) {
+    //  TempDescriptor dynSrcVar = dynSrcItr.next();
+    //  output.println("   SESEcommon*  "+dynSrcVar+"_srcSESE = NULL;");
+    //  output.println("   INTPTR       "+dynSrcVar+"_srcOffset = 0x1;");
+    //}    
 
     // declare local temps for in-set primitives, and if it is
     // a ready-source variable, get the value from the record
@@ -3301,7 +3303,9 @@ public class BuildCode {
        dynItr = cp.getDynAssignCurr().iterator();
        while( dynItr.hasNext() ) {
          TempDescriptor dynVar = dynItr.next();          
-          assert currentSESE.getDynamicVarSet().contains( dynVar );
+
+          // TODO
+          //assert currentSESE.getDynamicVarSet().contains( dynVar );
 
           // first release a reference to current record
           output.println("#ifndef OOO_DISABLE_TASKMEMPOOL" );
@@ -4116,6 +4120,7 @@ public class BuildCode {
 
       // maintain pointers for finding dynamic SESE 
       // instances from static names      
+      // TODO
       SESEandAgePair pairNewest = new SESEandAgePair( fsen, 0 );
       SESEandAgePair pairOldest = new SESEandAgePair( fsen, fsen.getOldestAgeToTrack() );
       if(  true//fsen.getParent() != null && 
@@ -4569,21 +4574,22 @@ public class BuildCode {
     // non-null var of these types
     output.println("   // releasing static SESEs");
     output.println("#ifndef OOO_DISABLE_TASKMEMPOOL" );
-    Iterator<SESEandAgePair> pItr = fsen.getNeededStaticNames().iterator();
-    while( pItr.hasNext() ) {
-      SESEandAgePair pair = pItr.next();
-      output.println("   if( "+pair+" != NULL ) {");
-      output.println("     RELEASE_REFERENCE_TO( "+pair+" );");
-      output.println("   }");
-    }
-    output.println("   // releasing dynamic variable sources");
-    Iterator<TempDescriptor> dynSrcItr = fsen.getDynamicVarSet().iterator();
-    while( dynSrcItr.hasNext() ) {
-      TempDescriptor dynSrcVar = dynSrcItr.next();
-      output.println("   if( "+dynSrcVar+"_srcSESE != NULL ) {");
-      output.println("     RELEASE_REFERENCE_TO( "+dynSrcVar+"_srcSESE );");
-      output.println("   }");
-    }    
+    // TODO
+    //Iterator<SESEandAgePair> pItr = fsen.getNeededStaticNames().iterator();
+    //while( pItr.hasNext() ) {
+    //  SESEandAgePair pair = pItr.next();
+    //  output.println("   if( "+pair+" != NULL ) {");
+    //  output.println("     RELEASE_REFERENCE_TO( "+pair+" );");
+    //  output.println("   }");
+    //}
+    //output.println("   // releasing dynamic variable sources");
+    //Iterator<TempDescriptor> dynSrcItr = fsen.getDynamicVarSet().iterator();
+    //while( dynSrcItr.hasNext() ) {
+    //  TempDescriptor dynSrcVar = dynSrcItr.next();
+    //  output.println("   if( "+dynSrcVar+"_srcSESE != NULL ) {");
+    //  output.println("     RELEASE_REFERENCE_TO( "+dynSrcVar+"_srcSESE );");
+    //  output.println("   }");
+    //}    
     // destroy this task's mempool if it is not a leaf task
     if( !fsen.getIsLeafSESE() ) {
       output.println("     pooldestroy( runningSESE->taskRecordMemPool );");
index de512a03608d32b8a8542fbd7dbc54edc8641804..b087785dd00670fd219136d9c719594ada47c1d0 100644 (file)
@@ -23,7 +23,6 @@ public class FlatSESEEnterNode extends FlatNode {
   private   int               id;
   protected FlatSESEExitNode  exit;
   protected SESENode          treeNode;
-  protected Integer           oldestAgeToTrack;
 
   // a leaf tasks simply has no children, ever
   protected static final int ISLEAF_UNINIT = 1;
@@ -57,17 +56,17 @@ public class FlatSESEEnterNode extends FlatNode {
   protected Set<TempDescriptor> inVars;
   protected Set<TempDescriptor> outVars;
 
-  protected Set<SESEandAgePair> needStaticNameInCode;
-
-  protected Set<SESEandAgePair> staticInVarSrcs;
-
   protected Set<TempDescriptor> readyInVars;
   protected Set<TempDescriptor> staticInVars;
   protected Set<TempDescriptor> dynamicInVars;  
 
-  protected Set<TempDescriptor> dynamicVars;
+  protected Set<SESEandAgePair> staticInVarSrcs;
 
   protected Hashtable<TempDescriptor, VariableSourceToken> staticInVar2src;
+
+  // get the oldest age of this task that other contexts
+  // have a static name for when tracking variables
+  protected Integer oldestAgeToTrack;
   
 
   // a subset of the in-set variables that shouuld be traversed during
@@ -75,6 +74,7 @@ public class FlatSESEEnterNode extends FlatNode {
   // buildcode can be dumb and just gen the traversals
   protected Vector<TempDescriptor> inVarsForDynamicCoarseConflictResolution;
 
+
   // scope info for this SESE
   protected FlatMethod       fmEnclosing;
   protected MethodDescriptor mdEnclosing;
@@ -96,23 +96,22 @@ public class FlatSESEEnterNode extends FlatNode {
   public FlatSESEEnterNode( SESENode sn ) {
     this.id              = identifier++;
     treeNode             = sn;
-    oldestAgeToTrack     = new Integer( 0 );
     children             = new HashSet<FlatSESEEnterNode>();
     parents              = new HashSet<FlatSESEEnterNode>();
     localChildren        = new HashSet<FlatSESEEnterNode>();
     localParent          = null;
     inVars               = new HashSet<TempDescriptor>();
     outVars              = new HashSet<TempDescriptor>();
-    needStaticNameInCode = new HashSet<SESEandAgePair>();
-    staticInVarSrcs      = new HashSet<SESEandAgePair>();
     readyInVars          = new HashSet<TempDescriptor>();
     staticInVars         = new HashSet<TempDescriptor>();
     dynamicInVars        = new HashSet<TempDescriptor>();
-    dynamicVars          = new HashSet<TempDescriptor>();
+    staticInVarSrcs      = new HashSet<SESEandAgePair>();
+    oldestAgeToTrack     = new Integer( 0 );
+
+    staticInVar2src = new Hashtable<TempDescriptor, VariableSourceToken>();
 
     inVarsForDynamicCoarseConflictResolution = new Vector<TempDescriptor>();
     
-    staticInVar2src = new Hashtable<TempDescriptor, VariableSourceToken>();
     
     fmEnclosing = null;
     mdEnclosing = null;
@@ -185,6 +184,16 @@ public class FlatSESEEnterNode extends FlatNode {
   }
 
 
+  public void mustTrackAtLeastAge( Integer age ) {
+    if( age > oldestAgeToTrack ) {
+      oldestAgeToTrack = new Integer( age );
+    }    
+  }
+
+  public Integer getOldestAgeToTrack() {
+    return oldestAgeToTrack;
+  }
+
 
   public void addParent( FlatSESEEnterNode parent ) {
     parents.add( parent );
@@ -292,14 +301,6 @@ public class FlatSESEEnterNode extends FlatNode {
     return outVars;
   }
 
-  public void addNeededStaticName( SESEandAgePair p ) {
-    needStaticNameInCode.add( p );
-  }
-
-  public Set<SESEandAgePair> getNeededStaticNames() {
-    return needStaticNameInCode;
-  }
-
   public void addStaticInVarSrc( SESEandAgePair p ) {
     staticInVarSrcs.add( p );
   }
@@ -341,23 +342,6 @@ public class FlatSESEEnterNode extends FlatNode {
     return dynamicInVars;
   }
 
-  public void addDynamicVar( TempDescriptor td ) {
-    dynamicVars.add( td );
-  }
-
-  public Set<TempDescriptor> getDynamicVarSet() {
-    return dynamicVars;
-  }
-
-  public void mustTrackAtLeastAge( Integer age ) {
-    if( age > oldestAgeToTrack ) {
-      oldestAgeToTrack = new Integer( age );
-    }    
-  }
-
-  public Integer getOldestAgeToTrack() {
-    return oldestAgeToTrack;
-  }
 
   public void setfmEnclosing( FlatMethod fm ) { fmEnclosing = fm; }
   public FlatMethod getfmEnclosing() { return fmEnclosing; }
index d1e6129d923a260031ebb8b5e40404f168e0ecdd..7be05e0bfd2baf6ec359c85ad117383ff51d5d7d 100644 (file)
@@ -97,6 +97,7 @@ Analysis/OoOJava/SVKey.class                                          \
 Analysis/OoOJava/VSTWrapper.class                                      \
 Analysis/OoOJava/VarSrcTokTable.class                                  \
 Analysis/OoOJava/VariableSourceToken.class                             \
+Analysis/OoOJava/ContextTaskNames.class                                        \
 Util/GraphNode.class Util/Namer.class Util/Relation.class              \
 Util/UtilAlgorithms.class                                               \
 Interface/HTTPHeader.class Interface/HTTPResponse.class                        \