this bug is not really a bug, a variable gets optimized out and the points-to and...
authorjjenista <jjenista>
Mon, 18 Apr 2011 16:44:12 +0000 (16:44 +0000)
committerjjenista <jjenista>
Mon, 18 Apr 2011 16:44:12 +0000 (16:44 +0000)
Robust/src/Tests/disjoint/var-reuse-bug-example/makefile [new file with mode: 0644]
Robust/src/Tests/disjoint/var-reuse-bug-example/test.java [new file with mode: 0644]

diff --git a/Robust/src/Tests/disjoint/var-reuse-bug-example/makefile b/Robust/src/Tests/disjoint/var-reuse-bug-example/makefile
new file mode 100644 (file)
index 0000000..fc1d519
--- /dev/null
@@ -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= -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/var-reuse-bug-example/test.java b/Robust/src/Tests/disjoint/var-reuse-bug-example/test.java
new file mode 100644 (file)
index 0000000..127f52b
--- /dev/null
@@ -0,0 +1,60 @@
+public class Foo {
+  public int z;
+  public Foo() {}
+  public Foo f;
+  public Foo g;
+}
+
+public class Test {
+
+  static public void main( String args[] ) {
+    innerMain( args.length );
+  }
+
+  //////////////////////////////////////////////
+  //
+  //  this program exhibits a bug in the basic
+  //  points-to analysis!!! GAH!!
+  //
+  //  Variable reuse is behaving wackily.
+  //  Look at the declaration of Foo c.  In the
+  //  generated reach graphs Foo c nodes are
+  //  dropped or never appear.  If instead you
+  //  move the declaration of Foo c = getFoo3()
+  //  where it is initialized, you see the right
+  //  points-to graph.  FIX IT
+
+
+  //////////////////////////////////////////////
+  //
+  //  @@@@@@@@@ UPDATE!!!!  @@@@@@@@@@@@@@
+  //
+  //  This is not a bug.  When you declare the
+  //  variable c and then initialize it later,
+  //  the optimization passes use a temp src
+  //  that is correctly represented in the 
+  //  underlying points-to information, AND
+  //  OoOJava (and presumablely DOJ) recognize
+  //  the temp src as the in-set variable, so
+  //  all is well.  The reason I thought it was
+  //  a bug is that the temp "c" is totally
+  //  optimized out, but I interpreted that by
+  //  mistake as being dropped from the points-to
+  //  graph.
+  //
+  //////////////////////////////////////////////
+
+  static public void innerMain( int x ) {
+    Foo c;
+
+    Foo b = new Foo();
+
+    genreach p1;
+    c = new Foo();
+    genreach p2;
+
+    sese thePrinter {
+      System.out.println( b.z+c.z );
+    }
+  }
+}