From 283d639ca94c154b5a1d13d786d0fa325f157e8a Mon Sep 17 00:00:00 2001 From: jjenista Date: Mon, 18 Apr 2011 16:44:12 +0000 Subject: [PATCH] this bug is not really a bug, a variable gets optimized out and the points-to and task in-set is fine, just has a different name --- .../disjoint/var-reuse-bug-example/makefile | 59 ++++++++++++++++++ .../disjoint/var-reuse-bug-example/test.java | 60 +++++++++++++++++++ 2 files changed, 119 insertions(+) create mode 100644 Robust/src/Tests/disjoint/var-reuse-bug-example/makefile create mode 100644 Robust/src/Tests/disjoint/var-reuse-bug-example/test.java 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 index 00000000..fc1d519f --- /dev/null +++ b/Robust/src/Tests/disjoint/var-reuse-bug-example/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= -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 index 00000000..127f52ba --- /dev/null +++ b/Robust/src/Tests/disjoint/var-reuse-bug-example/test.java @@ -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 ); + } + } +} -- 2.34.1