Variable result table pruning is buggy, remove for now, also adding improved tests...
authorjjenista <jjenista>
Mon, 31 Aug 2009 23:21:49 +0000 (23:21 +0000)
committerjjenista <jjenista>
Mon, 31 Aug 2009 23:21:49 +0000 (23:21 +0000)
Robust/src/Analysis/MLP/MLPAnalysis.java
Robust/src/IR/Flat/BuildCode.java
Robust/src/Tests/mlp/regression/runTests
Robust/src/Tests/mlp/regression/test.java
Robust/src/Tests/mlp/tinyTest/test.java

index 153a258e4862a44f0a97b32b3063482ca03eddfe..1dbb8d14dd1912f031de9fa8342a4ba07366cec0 100644 (file)
@@ -146,7 +146,6 @@ public class MLPAnalysis {
       variableAnalysisForward( fm );
     }
 
-
     // 4th pass, compute liveness contribution from
     // virtual reads discovered in variable pass
     rootItr = rootSESEs.iterator();
@@ -158,6 +157,9 @@ public class MLPAnalysis {
     }
 
 
+    /*
+      SOMETHING IS WRONG WITH THIS, DON'T USE IT UNTIL IT CAN BE FIXED
+
     // 5th pass
     methItr = ownAnalysis.descriptorsToAnalyze.iterator();
     while( methItr.hasNext() ) {
@@ -168,7 +170,8 @@ public class MLPAnalysis {
       // by removing reference variables that are not live
       pruneVariableResultsWithLiveness( fm );
     }
-    
+    */
+
 
     // 6th pass
     methItr = ownAnalysis.descriptorsToAnalyze.iterator();
@@ -623,7 +626,6 @@ public class MLPAnalysis {
       Set<TempDescriptor> rootLiveSet = livenessRootView.get( fn );
       VarSrcTokTable      vstTable    = variableResults.get( fn );
       
-      // fix later, not working, only wanted it to make tables easier to read
       vstTable.pruneByLiveness( rootLiveSet );
       
       for( int i = 0; i < fn.numNext(); i++ ) {
@@ -950,7 +952,7 @@ public class MLPAnalysis {
          // 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 );
+         currentSESE.addDynamicVar( readtmp );  
 
        } else if( srcType.equals( VarSrcTokTable.SrcType_STATIC ) ) {    
          // 2) Single token/age pair: Stall for token/age pair, and copy
index fbecf44a46791af2369da8551dae144a5e967cf6..f17905a5c54cdb52dc62c917f3721aeab3d06aec 100644 (file)
@@ -2889,11 +2889,18 @@ public class BuildCode {
                                         FlatSESEEnterNode fsen, 
                                         PrintWriter output 
                                       ) {
+
+    // if MLP flag is off, okay that SESE nodes are in IR graph, 
+    // just skip over them and code generates exactly the same
     if( !state.MLP ) {
-      // SESE nodes can be parsed for normal compilation, just skip over them
       return;
     }    
 
+    // there may be an SESE in an unreachable method, skip over
+    if( !mlpa.getAllSESEs().contains( fsen ) ) {
+      return;
+    }
+
     // also, if we have encountered a placeholder, just skip it
     if( fsen.getIsCallerSESEplaceholder() ) {
       return;
@@ -3081,8 +3088,15 @@ public class BuildCode {
                                        FlatSESEExitNode fsexn, 
                                        PrintWriter output
                                      ) {
+
+    // if MLP flag is off, okay that SESE nodes are in IR graph, 
+    // just skip over them and code generates exactly the same 
     if( !state.MLP ) {
-      // SESE nodes can be parsed for normal compilation, just skip over them
+      return;
+    }
+
+    // there may be an SESE in an unreachable method, skip over
+    if( !mlpa.getAllSESEs().contains( fsexn.getFlatEnter() ) ) {
       return;
     }
 
@@ -3095,18 +3109,6 @@ public class BuildCode {
 
     String com = paramsprefix+"->common";
 
-    /*
-    // take yourself off the thread-local sese call stack
-    output.println("   if( isEmpty( seseCallStack ) ) {");
-    output.println("     printf( \"Error, sese call stack is empty.\\n\" );");
-    output.println("     exit( -1 );");
-    output.println("   }");
-    output.println("   if( (void*)"+paramsprefix+" != getItem( seseCallStack ) ) {");
-    output.println("     printf( \"Error, sese call stack mismatch.\\n\" );");
-    output.println("     exit( -1 );");
-    output.println("   }");
-    */
-
     // this SESE cannot be done until all of its children are done
     // so grab your own lock with the condition variable for watching
     // that the number of your running children is greater than zero    
index 0af7eee9c9ffb191808b0e14820dc95b72894d05..efe1a65a4db802bd162a45a6bf3de85805ec43ac 100755 (executable)
@@ -3,17 +3,15 @@ echo 'Each single/multi output line pair should be identical'
 echo '' > resultsSingle.txt
 echo '' > resultsMulti.txt
 
-for i in $(seq 5)
+for i in $(seq 20)
 do
 echo 'running...'
-./testSingle.bin 10 >> resultsSingle.txt
-./testMulti.bin  10 >> resultsMulti.txt
-./testSingle.bin 25 >> resultsSingle.txt
-./testMulti.bin  25 >> resultsMulti.txt
-./testSingle.bin 125 >> resultsSingle.txt
-./testMulti.bin  125 >> resultsMulti.txt
-./testSingle.bin 1255 >> resultsSingle.txt
-./testMulti.bin  1255 >> resultsMulti.txt
+./testSingle.bin $[ i      ] >> resultsSingle.txt
+./testMulti.bin  $[ i      ] >> resultsMulti.txt
+./testSingle.bin $[ i*7    ] >> resultsSingle.txt
+./testMulti.bin  $[ i*7    ] >> resultsMulti.txt
+./testSingle.bin $[ 50+i*7 ] >> resultsSingle.txt
+./testMulti.bin  $[ 50+i*7 ] >> resultsMulti.txt
 done
 
 echo 'Diffing results'
index aaed0336d923cdb9afb37c05b497f3afcb04afcf..4318fed0c253486468f05771db8fe950158d2c08 100644 (file)
@@ -40,6 +40,10 @@ public class Test {
 
   public static int calculateStuff( int sum, int num, int mode ) {
     int answer = sum;    
+    sese makePlaceholderStallAfter {
+      sum = sum + 1;
+    }
+    sum = sum + 1;
     if( mode == 0 ) {
       sese mode1 {
        answer = sum + num;
index aaed0336d923cdb9afb37c05b497f3afcb04afcf..3c779968d36df04ca5184eed5927ca6775081de9 100644 (file)
@@ -4,22 +4,21 @@ public class Test {
   public static void main( String args[] ) {        
     int x = Integer.parseInt( args[0] );
     doSomeWork( x );
-    nullMethodBodyFinalNode();
   }
 
   public static void doSomeWork( int x ) {
     for( int i = 0; i < x; ++i ) {
       sese calc {
-       int sum = 0;
+       int sum = 0;    
        for( int j = 0; j <= i; ++j ) {
          sum = calculateStuff( sum, 1, 0 );
-       }
-      }
+       }       
+      }           
       sese forceVirtualReal {
        if( i % 3 == 0 ) {
          sum = sum + (i % 20);
        }
-      }
+      }      
       if( i % 2 == 0 ) {
        sese change {
          for( int k = 0; k < i*2; ++k ) {
@@ -31,7 +30,7 @@ public class Test {
        for( int l = 0; l < 3; ++l ) {
          sum = calculateStuff( sum, 2, 2 );
        }
-      }
+      }      
       sese prnt {
        mightPrint( x, i, sum );
       }
@@ -39,7 +38,11 @@ public class Test {
   }
 
   public static int calculateStuff( int sum, int num, int mode ) {
-    int answer = sum;    
+    int answer = sum;
+    sese makePlaceholderStallAfter {
+      sum = sum + 1;
+    }
+    sum = sum + 1;
     if( mode == 0 ) {
       sese mode1 {
        answer = sum + num;
@@ -48,25 +51,13 @@ public class Test {
       sese mode2 {
        answer = sum + (num/2);
       }
-    } else {
+    } else if( mode == 2 ) {
       sese mode3 {
-       answer = sum / num;
+       answer = sum + (num/2);
       }
     }    
-    return answer;
-  }
 
-  public static void nullMethodBodyFinalNode() {
-    int y = 1;
-    sese nothing {
-      int x = 0;
-    }
-    y = x;
-    if( x > y ) {
-      return;
-    } else {
-      return;
-    }
+    return answer;
   }
 
   public static void mightPrint( int x, int i, int sum ) {