Some tests that are helping with SESE garbage collection, incidentally the mlp regres...
authorjjenista <jjenista>
Tue, 10 Aug 2010 23:36:31 +0000 (23:36 +0000)
committerjjenista <jjenista>
Tue, 10 Aug 2010 23:36:31 +0000 (23:36 +0000)
Robust/src/Tests/oooJava/regression/makefile [new file with mode: 0644]
Robust/src/Tests/oooJava/regression/runTests [new file with mode: 0755]
Robust/src/Tests/oooJava/regression/test.java [new file with mode: 0644]
Robust/src/Tests/oooJava/sese-gc/makefile [new file with mode: 0644]
Robust/src/Tests/oooJava/sese-gc/test.java [new file with mode: 0644]

diff --git a/Robust/src/Tests/oooJava/regression/makefile b/Robust/src/Tests/oooJava/regression/makefile
new file mode 100644 (file)
index 0000000..e78463e
--- /dev/null
@@ -0,0 +1,32 @@
+PROGRAM1=testSingle
+PROGRAM2=testMulti
+
+SOURCE_FILES=test.java
+
+BUILDSCRIPT=../../../buildscript
+
+USEOOO= -ooojava 8 2  -ooodebug  
+BSFLAGS= -64bit -mainclass Test -garbagestats -nooptimize -debug
+DISJOINT= -disjoint -disjoint-k 1 -enable-assertions #-disjoint-desire-determinism
+
+
+all: $(PROGRAM1).bin $(PROGRAM2).bin
+
+$(PROGRAM1).bin: $(SOURCE_FILES)
+       $(BUILDSCRIPT)           $(BSFLAGS) -o $(PROGRAM1) $(SOURCE_FILES)
+       rm -fr tmpbuilddirectory
+
+$(PROGRAM2).bin: $(SOURCE_FILES)
+       $(BUILDSCRIPT) $(USEOOO) $(BSFLAGS) -o $(PROGRAM2) $(SOURCE_FILES)
+
+clean:
+       rm -f  $(PROGRAM1).bin
+       rm -f  $(PROGRAM2).bin
+       rm -fr tmpbuilddirectory
+       rm -f  *~
+       rm -f  *.dot
+       rm -f  *.png
+       rm -f  *.txt
+       rm -f  aliases.txt
+       rm -f  mlpReport*txt
+       rm -f  results*txt
diff --git a/Robust/src/Tests/oooJava/regression/runTests b/Robust/src/Tests/oooJava/regression/runTests
new file mode 100755 (executable)
index 0000000..df6727d
--- /dev/null
@@ -0,0 +1,18 @@
+echo 'Each single/multi output line pair should be identical'
+
+echo '' > resultsSingle.txt
+echo '' > resultsMulti.txt
+
+for i in $(seq 3)
+do
+echo 'running...'
+./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*9 ] >> resultsSingle.txt
+#./testMulti.bin  $[ 50+i*9 ] >> resultsMulti.txt
+done
+
+echo 'Diffing results'
+diff resultsSingle.txt resultsMulti.txt
diff --git a/Robust/src/Tests/oooJava/regression/test.java b/Robust/src/Tests/oooJava/regression/test.java
new file mode 100644 (file)
index 0000000..c48f58e
--- /dev/null
@@ -0,0 +1,150 @@
+public class Foo {
+  public int z;
+
+  public Foo( int z ) {
+    this.z = z;
+  }  
+}
+
+public class Test {
+
+  public static void main( String args[] ) {
+    if( args.length == 0 ) {
+      System.out.println( "give an integer workload argument, please!" );
+      System.exit( 0 );
+    }
+    int x = Integer.parseInt( args[0] );
+    Foo f = new Foo( x + 1000 );
+    int s = doSomeWork( x, f );
+    int t = moreWork( x, f );
+    nullMethodBodyFinalNode();
+    int r = s+t;
+    System.out.println( "s = "+s+
+                        ", t = "+t+
+                        ", r = "+r );
+  }
+
+  public static int doSomeWork( int x, Foo f ) {
+    float delta = 1.0f;
+    int out = 0;
+    for( int i = 0; i < x; ++i ) {
+      sese calc {
+       Foo g = new Foo( i );
+       int sum = 0;
+       for( int j = 0; j <= i % 10; ++j ) {
+         sum = calculateStuff( sum, 1, 0 );
+       }        
+      }
+      sese forceVirtualReal {
+       if( i % 7 == 0 ) {
+         sum = sum + (i % 20);
+       }        
+        for( int z = 0; z < x % 50; ++z ) {
+          if( i % 2 == 0 ) {
+            delta += 1.0f;
+          }
+        }
+       g.z = sum + 1000;
+      }
+      sese arrayAlloc {
+        int tempArray[] = new int[x];
+        for( int k = 0; k < x/20; ++k ) {
+          tempArray[k] = g.z / (i+1);          
+        }        
+      }
+      sese gather {
+        int inter = 1;
+        for( int k = 0; k < x/20; ++k ) {
+          inter = inter + tempArray[k];
+        }             
+        sum = sum + inter / 10;
+      }
+      sese modobj {
+       g.z = g.z + f.z;
+      }
+      if( i % 11 == 0 ) {
+       sese change {
+         for( int k = 0; k < i*2; ++k ) {
+           sum = calculateStuff( sum, k, 1 );
+         }
+         sum = sum + 1;
+       }       
+       
+       for( int l = 0; l < 3; ++l ) {
+         sum = calculateStuff( sum, 2, 2 );
+       }       
+      } 
+      sese prnt {
+        if( i == x - 1 ) {
+          out = x + i + sum + (int)delta + g.z;
+        }
+      }
+    }
+    return out;
+  }
+
+  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;
+      }
+    } else if( mode == 1 ) {
+      sese mode2 {
+       answer = sum + (num/2);
+      }
+    } else {
+      sese mode3 {
+       answer = sum / num;
+      }
+    }    
+    return answer;
+  }
+
+  public static int moreWork( int x, Foo f ) {
+
+    int total = 0;
+
+    for( int j = 0; j < x; ++j ) {
+      sese doe {
+        Foo g = new Foo( j );
+        int prod = 1;
+      }
+      sese rae {
+        if( j % 7 == 0 ) {
+          prod = prod * j;
+        }
+        g.z = prod / x;
+      }
+      sese mi {
+        g.z = g.z + f.z;
+      }
+      if( j % 3 == 0 ) {
+        sese fa {
+          prod = prod / 2;
+        }
+      }
+
+      total = total + prod - g.z;
+    }
+
+    return total;
+  }
+
+  public static void nullMethodBodyFinalNode() {
+    int y = 1;
+    sese nothing {
+      int x = 0;
+    }
+    y = x;
+    if( x > y ) {
+      return;
+    } else {
+      return;
+    }
+  }
+}
diff --git a/Robust/src/Tests/oooJava/sese-gc/makefile b/Robust/src/Tests/oooJava/sese-gc/makefile
new file mode 100644 (file)
index 0000000..6a74294
--- /dev/null
@@ -0,0 +1,29 @@
+PROGRAM=Test
+
+SOURCE_FILES=test.java
+
+BUILDSCRIPT=../../../buildscript
+
+USEOOO= -ooojava 2 2  -ooodebug  
+BSFLAGS= -64bit -mainclass $(PROGRAM) -garbagestats -joptimize -noloop -optimize -coreprof -coreprof-checkoverflow -debug
+DISJOINT= -disjoint -disjoint-k 1 -enable-assertions #-disjoint-desire-determinism
+
+default:
+       $(BUILDSCRIPT) -nojava $(USEOOO) $(BSFLAGS) $(DISJOINT) -o $(PROGRAM)p $(SOURCE_FILES) -builddir par
+
+single:
+       $(BUILDSCRIPT) $(BSFLAGS) -thread -o $(PROGRAM)s -builddir sing $(SOURCE_FILES) 
+
+ooo:
+       $(BUILDSCRIPT) $(USEOOO) $(BSFLAGS) $(DISJOINT) -o $(PROGRAM)p -builddir par $(SOURCE_FILES) 
+
+clean:
+       rm -f  $(PROGRAM)p.bin $(PROGRAM)s.bin
+       rm -fr par sing
+       rm -f  *~
+       rm -f  *.dot
+       rm -f  *.png
+       rm -f  *.txt
+       rm -f  aliases.txt
+       rm -f  mlpReport*txt
+       rm -f  results*txt
diff --git a/Robust/src/Tests/oooJava/sese-gc/test.java b/Robust/src/Tests/oooJava/sese-gc/test.java
new file mode 100644 (file)
index 0000000..51f3d86
--- /dev/null
@@ -0,0 +1,28 @@
+public class Foo {
+  public int z;
+  public Foo() {}
+}
+
+public class Test {
+
+  static public void main( String args[] ) {
+    int x = 1;
+    Foo f = new Foo();
+    f.z = 1;
+    if( false ) {
+      rblock a {
+        x = 2;
+        f.z = 2;
+      }
+    }
+    rblock b {
+      int y = 3;
+      Foo g = new Foo();
+      g.z = 3;
+    }
+
+    rblock c {
+      System.out.println( x+y+f.z+g.z );
+    }
+  }
+}