not working out like I wanted
authorjjenista <jjenista>
Fri, 6 Jan 2012 19:02:29 +0000 (19:02 +0000)
committerjjenista <jjenista>
Fri, 6 Jan 2012 19:02:29 +0000 (19:02 +0000)
Robust/src/Tests/disjoint/definite-example/test.java

index a017082da07dfed847232853f967d2ee66a55053..b93eed253362ff481a6c04469d6b2e7bede7d217 100644 (file)
@@ -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() {