a test that exposed a cyclic hashcode bug and some related minor bugs
authorjjenista <jjenista>
Tue, 4 Oct 2011 23:43:02 +0000 (23:43 +0000)
committerjjenista <jjenista>
Tue, 4 Oct 2011 23:43:02 +0000 (23:43 +0000)
Robust/src/Tests/disjoint/out-of-context-reach-recursive/makefile [new file with mode: 0644]
Robust/src/Tests/disjoint/out-of-context-reach-recursive/test.java [new file with mode: 0644]

diff --git a/Robust/src/Tests/disjoint/out-of-context-reach-recursive/makefile b/Robust/src/Tests/disjoint/out-of-context-reach-recursive/makefile
new file mode 100644 (file)
index 0000000..fe085f0
--- /dev/null
@@ -0,0 +1,65 @@
+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-dvisit-stack-callees-on-top
+#      -disjoint-debug-scheduling
+#      -disjoint-debug-snap-method Test.context2 1 50 true \
+#      -disjoint-debug-callsite Test.context2 Test.context1 1 500 true
+#      -disjoint-debug-callsite Test.context1 Test.innerMain 1 500 true
+#      -disjoint-write-initial-contexts \
+#-disjoint-desire-determinism
+
+USEOOO= #-ooojava 24 2      -ooodebug -squeue
+USERCR= #-ooojava 23 2 -rcr -ooodebug -squeue 
+
+BSFLAGS= -justanalyze -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -noloop -joptimize -debug #-ooodebug-disable-task-mem-pool -64bit
+
+
+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/disjoint/out-of-context-reach-recursive/test.java b/Robust/src/Tests/disjoint/out-of-context-reach-recursive/test.java
new file mode 100644 (file)
index 0000000..da14794
--- /dev/null
@@ -0,0 +1,60 @@
+public class Foo {
+  public Foo f;
+}
+
+
+public class Test {
+
+  static public void main( String args[] ) {
+    // The initial context is special in the sense that it gets
+    // tinkered with by the analysis even though it is not special
+    // semantically.  When probing the analysis for bugs, it can't
+    // hurt to just always skip this context.
+    innerMain();
+  }
+
+  static public void innerMain() {
+    Foo z = get1();
+    Foo x = new Foo();
+    z.f = x;
+
+    Foo z2 = get1();
+    Foo x2 = new Foo();
+    z2.f = x2;
+
+    genreach context0before;
+    context1( x, x2 );
+    genreach context0post;
+
+    System.out.println( "" + z + x + z2 + x2 );
+  }
+
+  static public void context1( Foo x, Foo x2 ) {
+    genreach context1before;
+    Foo y = get1();
+    genreach context1mid;
+    context2( x2 );
+    genreach context1post;
+
+    // consume x and y to prevent optimizing them away
+    System.out.println( "" + x + y + x2 );
+  }
+
+  static public void context2( Foo q ) {
+    genreach context2before;
+    context3( q );
+    genreach context2post;
+  }
+
+  static public void context3( Foo q ) {
+    genreach context3before;
+    if( false ) {
+      context3( q );
+    }
+    genreach context3post;
+  }
+
+  static public Foo get1() {
+    return disjoint F1 new Foo();
+  }
+}