From 97c76890df08b8756ff7c4db686ef1529fb6b10f Mon Sep 17 00:00:00 2001 From: jjenista Date: Fri, 6 Jan 2012 19:02:29 +0000 Subject: [PATCH] not working out like I wanted --- .../Tests/disjoint/definite-example/test.java | 75 +++++++++---------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/Robust/src/Tests/disjoint/definite-example/test.java b/Robust/src/Tests/disjoint/definite-example/test.java index a017082d..b93eed25 100644 --- a/Robust/src/Tests/disjoint/definite-example/test.java +++ b/Robust/src/Tests/disjoint/definite-example/test.java @@ -8,57 +8,50 @@ public class Test { static public void main( String args[] ) { + int m = 2; int n = 3; - Foo[] a = getArray(); - for( int j = 0; j < n; ++j ) { - a[j] = getFoo(); + Foo[] a; + Foo b; + + Foo[][] top = new Foo[m][]; + for( int i = 0; i < m; ++i ) { + a = getArray( n ); + for( int j = 0; j < n; ++j ) { + b = getFoo(); + a[j] = b; + } + top[i] = a; } - //Foo a = getFlagged(); - //Foo b = getUnflagged(); - //a.f = b; - // - //// a is flagged and b is reachable from - //// at most one object from that site - //gendefreach z0; - //genreach z0; - // - //Foo c = new Foo(); - //a.g = c; - // - //Foo t = getFlagged(); - //t = getFlagged(); - // - //Foo u = getUnflagged(); - //u = getUnflagged(); - // - //// a is flagged and b is reachable from - //// at most one object from that site, even - //// though a and b are summarized now. a - //// has a reference to a new object c - //gendefreach z1; - //genreach z1; - // - //c.f = b; - // - //// if we had definite reachability analysis - //// we would realize b is already reachable - //// from a - //gendefreach z3; - //genreach z3; - // - //System.out.println( " "+a+b+c ); + // every Foo is reachable from only one Foo array + gendefreach z0; + genreach z0; + // resize array... + //Foo[] b = getArray( n + 1 ); + //Foo[] notused = getArray( 1 ); + //b[0] = getFoo(); + //for( int j = 0; j < n; ++j ) { + // b[j+1] = a[j]; + //} + + // after array resize? + gendefreach z1; + genreach z1; + + // use info to keep compiler from optimizing anything away int total = 0; - for( int j = 0; j < n; ++j ) { - total += a[j].z; + for( int i = 0; i < m; ++i ) { + for( int j = 0; j < n; ++j ) { + total += top[i][j].z; + } } System.out.println( " "+total ); } - static public Foo[] getArray() { - return disjoint jupiter new Foo[](); + static public Foo[] getArray( int n ) { + return disjoint jupiter new Foo[n]; } static public Foo getFoo() { -- 2.34.1