From 3afd6d9d9dad69436614ef776c5d5689f80ec626 Mon Sep 17 00:00:00 2001 From: jjenista Date: Tue, 10 Aug 2010 23:36:31 +0000 Subject: [PATCH] Some tests that are helping with SESE garbage collection, incidentally the mlp regression test defeats our current ooo java runtime as well, gotta track that down some day --- Robust/src/Tests/oooJava/regression/makefile | 32 ++++ Robust/src/Tests/oooJava/regression/runTests | 18 +++ Robust/src/Tests/oooJava/regression/test.java | 150 ++++++++++++++++++ Robust/src/Tests/oooJava/sese-gc/makefile | 29 ++++ Robust/src/Tests/oooJava/sese-gc/test.java | 28 ++++ 5 files changed, 257 insertions(+) create mode 100644 Robust/src/Tests/oooJava/regression/makefile create mode 100755 Robust/src/Tests/oooJava/regression/runTests create mode 100644 Robust/src/Tests/oooJava/regression/test.java create mode 100644 Robust/src/Tests/oooJava/sese-gc/makefile create mode 100644 Robust/src/Tests/oooJava/sese-gc/test.java diff --git a/Robust/src/Tests/oooJava/regression/makefile b/Robust/src/Tests/oooJava/regression/makefile new file mode 100644 index 00000000..e78463e2 --- /dev/null +++ b/Robust/src/Tests/oooJava/regression/makefile @@ -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 index 00000000..df6727de --- /dev/null +++ b/Robust/src/Tests/oooJava/regression/runTests @@ -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 index 00000000..c48f58ef --- /dev/null +++ b/Robust/src/Tests/oooJava/regression/test.java @@ -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 index 00000000..6a742941 --- /dev/null +++ b/Robust/src/Tests/oooJava/sese-gc/makefile @@ -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 index 00000000..51f3d86e --- /dev/null +++ b/Robust/src/Tests/oooJava/sese-gc/test.java @@ -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 ); + } + } +} -- 2.34.1