From: jjenista Date: Thu, 20 Oct 2011 18:11:24 +0000 (+0000) Subject: a short, clear example that definite reachability will improve the analysis of X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=55859a3999ed6ca7e1816d9aea819828095b45c8;p=IRC.git a short, clear example that definite reachability will improve the analysis of --- diff --git a/Robust/src/Tests/disjoint/definite/test.java b/Robust/src/Tests/disjoint/definite/test.java index 04defe83..5e6ea0c0 100644 --- a/Robust/src/Tests/disjoint/definite/test.java +++ b/Robust/src/Tests/disjoint/definite/test.java @@ -1,5 +1,6 @@ public class Foo { - public Foo next; + public Foo f; + public Foo g; } public class Test { @@ -8,22 +9,42 @@ public class Test { static public void main( String args[] ) { - Foo f = new Foo(); - Foo g = f; + Foo x = getFlagged(); + Foo y = getUnflagged(); + x.f = y; - while( false ) { - f.next = new Foo(); - f = f.next; - } + // x is flagged and y is reachable from + // at most one object from that site + genreach y0; - f = yodel( f, g ); + Foo t = getFlagged(); + t = getFlagged(); - gendefreach yo; + // x is flagged and y is reachable from + // at most one object from that site, even + // though x is summarized now + genreach y1; - System.out.println( f ); + x.g = y; + + // if we had definite reachability analysis + // we would realize y is already reachable + // from x, but we don't and x is summarized + // so we conservatively increase the arity + // of objects y is reachable from. + genreach y2; + + + //gendefreach yo; + System.out.println( x+","+y ); } - static public Foo yodel( Foo a, Foo b ) { - return a.next; + static public Foo getFlagged() { + return disjoint jupiter new Foo(); } + + static public Foo getUnflagged() { + return new Foo(); + } + }