a test case showing a bug in disjoint analysis basic points-to stuff
authorjjenista <jjenista>
Thu, 3 Mar 2011 18:31:32 +0000 (18:31 +0000)
committerjjenista <jjenista>
Thu, 3 Mar 2011 18:31:32 +0000 (18:31 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Tests/dfj/case1/makefile [new file with mode: 0644]
Robust/src/Tests/dfj/case1/test.java [new file with mode: 0644]
Robust/src/Tests/oooJava/conflict-graph-location/makefile

index 73c7a9c6fb6070a2b407b02b01c52e17ea31cd01..ffe9f072f33f84863a3d7e8afbe456446b25d826 100644 (file)
@@ -1130,9 +1130,9 @@ public class DisjointAnalysis {
 
       rg.writeGraph( "genReach"+fgrn.getGraphName(),
                      true,    // write labels (variables)                
-                     false,    // selectively hide intermediate temp vars 
+                     true,   // selectively hide intermediate temp vars 
                      true,    // prune unreachable heap regions          
-                     false,   // hide reachability altogether
+                     true,   // hide reachability altogether
                      false,   // hide subset reachability states         
                      true,    // hide predicates
                      true );  // hide edge taints      
diff --git a/Robust/src/Tests/dfj/case1/makefile b/Robust/src/Tests/dfj/case1/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/dfj/case1/test.java b/Robust/src/Tests/dfj/case1/test.java
new file mode 100644 (file)
index 0000000..49b0671
--- /dev/null
@@ -0,0 +1,69 @@
+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
+
+  static public void innerMain( int x ) {
+    Foo a = null;
+    Foo t = getFoo1();
+    Foo c;
+
+    for( int i = 0; i < 1; ++i ) {
+      a = t;
+      t = getFoo1();
+      a.g = t;
+    }
+
+    genreach p1;
+
+    Foo b = getFoo2();
+    c = getFoo3();
+
+    genreach p2;
+
+    if( x > 0 ) {
+      a.f = b;
+      b.g = b;
+      b.f = getFoo4();
+    } else {
+      a.f = c;
+      c.g = getFoo4();
+    }
+
+    genreach p3;
+
+    rblock T {
+      System.out.println( a.z+b.z+c.z );
+    }
+  }
+
+  // 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(); }
+}
index b1e14c60b4193fcfd065a8a9eddd2adb42dc0486..513d614e442a76d1b5cbbdc463265633594383b2 100644 (file)
@@ -25,7 +25,7 @@ DISJOINT= -disjoint -disjoint-k 1 -enable-assertions #-disjoint-desire-determini
 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 -justanalyze -64bit
+BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 1024 -garbagestats -noloop -joptimize -debug #-ooodebug-disable-task-mem-pool -justanalyze
 
 
 all: ooo