From 14502f5f2f5f05b1f86274e321d97e2d22ff94a6 Mon Sep 17 00:00:00 2001 From: jjenista <jjenista> Date: Thu, 3 Mar 2011 19:33:29 +0000 Subject: [PATCH] a functioning test program for stephen that produces a bad traverser for current dfj system --- Robust/src/Tests/dfj/case2/makefile | 59 +++++++++++++++++++++++ Robust/src/Tests/dfj/case2/test.java | 70 ++++++++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 Robust/src/Tests/dfj/case2/makefile create mode 100644 Robust/src/Tests/dfj/case2/test.java diff --git a/Robust/src/Tests/dfj/case2/makefile b/Robust/src/Tests/dfj/case2/makefile new file mode 100644 index 00000000..dd02a9f3 --- /dev/null +++ b/Robust/src/Tests/dfj/case2/makefile @@ -0,0 +1,59 @@ +PROGRAM=Test + +SOURCE_FILES=test.java + +BUILDSCRIPT=../../../buildscript + +COREPROFOVERFLOW= #-coreprof-checkoverflow +USECOREPROF= #-coreprof $(COREPROFOVERFLOW) \ + -coreprof-eventwords 1024*1024*128 \ + -coreprof-enable cpe_main \ + -coreprof-enable cpe_runmalloc \ + -coreprof-enable cpe_runfree \ + -coreprof-enable cpe_count_poolalloc \ + -coreprof-enable cpe_count_poolreuse \ + -coreprof-enable cpe_workschedgrab \ + -coreprof-enable cpe_taskdispatch \ + -coreprof-enable cpe_taskexecute \ + -coreprof-enable cpe_taskretire +# -coreprof-enable cpe_taskstallvar \ +# -coreprof-enable cpe_taskstallmem + + +DISJOINT= -disjoint -disjoint-k 1 -enable-assertions #-disjoint-desire-determinism + +USEOOO= -ooojava 24 2 -ooodebug -squeue +USERCR= -ooojava 23 2 -rcr -ooodebug -squeue + +BSFLAGS= -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -noloop -joptimize -debug #-ooodebug-disable-task-mem-pool -64bit -justanalyze + + +all: ooo + + +single: + $(BUILDSCRIPT) $(BSFLAGS) -thread -o $(PROGRAM)s -builddir sing $(SOURCE_FILES) + + +ooo: $(PROGRAM)p.bin + +$(PROGRAM)p.bin: $(SOURCE_FILES) makefile + $(BUILDSCRIPT) $(BSFLAGS) $(USECOREPROF) $(USEOOO) $(DISJOINT) -o $(PROGRAM)p -builddir par $(SOURCE_FILES) + +rcr: $(PROGRAM)r.bin + +$(PROGRAM)r.bin: $(SOURCE_FILES) makefile + $(BUILDSCRIPT) $(BSFLAGS) $(USECOREPROF) $(USERCR) $(DISJOINT) -o $(PROGRAM)r -builddir rcr $(SOURCE_FILES) + + +clean: + rm -f $(PROGRAM)p.bin $(PROGRAM)r.bin $(PROGRAM)s.bin + rm -fr par rcr sing + rm -f *~ + rm -f *.dot + rm -f *.png + rm -f *.txt + rm -f aliases.txt + rm -f mlpReport*txt + rm -f results*txt + rm -f coreprof.dat diff --git a/Robust/src/Tests/dfj/case2/test.java b/Robust/src/Tests/dfj/case2/test.java new file mode 100644 index 00000000..4904cfb7 --- /dev/null +++ b/Robust/src/Tests/dfj/case2/test.java @@ -0,0 +1,70 @@ +public class Foo { + public int z; + public Foo f; + public Foo g; + + public Foo() { + z = 0; + f = null; + g = null; + } +} + +public class Test { + + static public void main( String args[] ) { + innerMain( args.length ); + } + + static public void innerMain( int x ) { + Foo a = null; + Foo t = getFoo1(); + t.z = 3; + + for( int i = 0; i < 3; ++i ) { + a = t; + t = getFoo1(); + t.g = a; + } + + genreach p1; + + Foo b = getFoo2(); + Foo c = getFoo3(); + + genreach p2; + + if( x > 0 ) { + a.f = b; + b.g = b; + b.f = getFoo4(); + b.f.z = 1; + } else { + a.g = c; + c.g = getFoo4(); + c.g.z = 2; + } + + genreach p3; + + int total = 0; + + rblock T { + if( a.f != null ) { + total += a.f.g.g.f.z; + } + if( a.g != null ) { + total += a.g.g.z; + } + } + + System.out.println( total ); + } + + // these "getFoo" methods are exactly the same, except a heap + // analysis considers each one a separate allocation site + static public Foo getFoo1() { return new Foo(); } + static public Foo getFoo2() { return new Foo(); } + static public Foo getFoo3() { return new Foo(); } + static public Foo getFoo4() { return new Foo(); } +} -- 2.34.1