tracked down more bugs in not-avail and variable analyses
authorjjenista <jjenista>
Wed, 12 Aug 2009 17:58:16 +0000 (17:58 +0000)
committerjjenista <jjenista>
Wed, 12 Aug 2009 17:58:16 +0000 (17:58 +0000)
Robust/src/Analysis/MLP/MLPAnalysis.java
Robust/src/Analysis/MLP/VarSrcTokTable.java
Robust/src/Tests/mlp/tinyTest/makefile

index 6766027ea28291fb09cb97a0424682581a068295..ed72c5ac5aecbb6feb703130ce9cf13eb3a74e3f 100644 (file)
@@ -143,7 +143,7 @@ public class MLPAnalysis {
       pruneVariableResultsWithLiveness( fm );
     }
     if( state.MLPDEBUG ) {      
-      //System.out.println( "\nVariable Results-Out\n----------------\n"+fmMain.printMethod( variableResults ) );
+      System.out.println( "\nVariable Results-Out\n----------------\n"+fmMain.printMethod( variableResults ) );
     }
     
 
@@ -494,8 +494,12 @@ public class MLPAnalysis {
     case FKind.FlatSESEEnterNode: {
       FlatSESEEnterNode fsen = (FlatSESEEnterNode) fn;
       assert fsen.equals( currentSESE );
+
       vstTable.age( currentSESE );
       vstTable.assertConsistency();
+
+      vstTable.ownInSet( currentSESE );
+      vstTable.assertConsistency();
     } break;
 
     case FKind.FlatSESEExitNode: {
@@ -738,8 +742,8 @@ public class MLPAnalysis {
         TempDescriptor rTemp = readTemps[i];
         notAvailSet.remove( rTemp );
 
-       // if this variable has exactly one source, mark everything
-       // else from that source as available as well
+       // if this variable has exactly one source, potentially
+       // get other things from this source as well
        VarSrcTokTable vstTable = variableResults.get( fn );
 
        Integer srcType = 
@@ -754,9 +758,25 @@ public class MLPAnalysis {
          Iterator<VariableSourceToken> availItr = vstTable.get( vst.getSESE(),
                                                                 vst.getAge()
                                                                 ).iterator();
+
+         // look through things that are also available from same source
          while( availItr.hasNext() ) {
            VariableSourceToken vstAlsoAvail = availItr.next();
-           notAvailSet.removeAll( vstAlsoAvail.getRefVars() );
+         
+           Iterator<TempDescriptor> refVarItr = vstAlsoAvail.getRefVars().iterator();
+           while( refVarItr.hasNext() ) {
+             TempDescriptor refVarAlso = refVarItr.next();
+
+             // if a variable is available from the same source, AND it ALSO
+             // only comes from one statically known source, mark it available
+             Integer srcTypeAlso = 
+               vstTable.getRefVarSrcType( refVarAlso, 
+                                          currentSESE,
+                                          currentSESE.getParent() );
+             if( srcTypeAlso.equals( VarSrcTokTable.SrcType_STATIC ) ) {
+               notAvailSet.remove( refVarAlso );
+             }
+           }
          }
        }
       }
@@ -903,9 +923,6 @@ public class MLPAnalysis {
                                       currentSESE,
                                       currentSESE.getParent() );
 
-
-       System.out.println( "considering stall on "+readtmp+" for "+currentSESE );
-
        if( srcType.equals( VarSrcTokTable.SrcType_DYNAMIC ) ) {
          // 1) It is not clear statically where this variable will
          // come from statically, so dynamically we must keep track
@@ -913,7 +930,6 @@ public class MLPAnalysis {
          // just stall for the exact thing we need and move on
          plan.addDynamicStall( readtmp );
          currentSESE.addDynamicStallVar( readtmp );
-         System.out.println( "ADDING "+readtmp+" TO "+currentSESE+" DYNSTALLSET" );
          
        } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) {    
          // 2) Single token/age pair: Stall for token/age pair, and copy
index 226eb6a6fcdbf22c2d0c604372957f25162de393..0b07adbe0821be31b41a711a9e0e03db735766eb 100644 (file)
@@ -330,6 +330,29 @@ public class VarSrcTokTable {
     assertConsistency();
   }
 
+
+  // at an SESE enter node, all ref vars in the SESE's in-set will
+  // be copied into the SESE's local scope, change source to itself
+  public void ownInSet( FlatSESEEnterNode curr ) {
+    Iterator<TempDescriptor> inVarItr = curr.getInVarSet().iterator();
+    while( inVarItr.hasNext() ) {
+      TempDescriptor inVar = inVarItr.next();
+
+      remove( inVar );
+      assertConsistency();
+
+      Set<TempDescriptor> refVars = new HashSet<TempDescriptor>();
+      refVars.add( inVar );
+      add( new VariableSourceToken( refVars,
+                                   curr,
+                                   new Integer( 0 ),
+                                   inVar
+                                   )
+          );
+      assertConsistency();
+    }
+  }
+
   
   // for the given SESE, change child tokens into this parent
   public void remapChildTokens( FlatSESEEnterNode curr ) {
index 0b22c179d579881d2f00455a4ae24d64c89a5d7a..67e822cc0a2260803a68a7971dd3457b42155094 100644 (file)
@@ -4,7 +4,7 @@ SOURCE_FILES=$(PROGRAM).java
 
 BUILDSCRIPT=~/research/Robust/src/buildscript
 
-#USEMLP= -mlp 1 2 -mlpdebug # use to turn mlp on and off and make sure rest of build not broken
+USEMLP= -mlp 1 2 -mlpdebug # use to turn mlp on and off and make sure rest of build not broken
 BSFLAGS= -nooptimize -debug -garbagestats -mainclass Test -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions -flatirusermethods -ownaliasfile aliases.txt
 
 all: $(PROGRAM).bin