Fixed a few minor bugs in token propagation, and major bug that every
[IRC.git] / Robust / src / Tests / OwnershipAnalysisTest / test01 / test01.java
index 541f8dba3e53c6ed88943e484f8b91d552b735ac..443375d078fb7b67a24f4e7c7d1ab354655a868a 100644 (file)
@@ -1,4 +1,4 @@
-/*
+
 public class Parameter {
     flag w;
     int a, b;
@@ -18,16 +18,16 @@ public class Penguin {
 
     public void bar() { x = 1; }
 }
-*/
 
 public class Voo {
-    flag f; int x; Baw b;
+    flag f; int x; Baw b; Baw bb;
 
     public Voo() {}
 }
 
 public class Baw {
-    flag g; int y;
+    int y;
+    Foo f;
 
     public Baw() {}
 
@@ -35,14 +35,49 @@ public class Baw {
 }
 
 
+public class Foo {
+    flag f;
+
+    public Foo() {}
+
+    public Foo x;
+
+    public void ruinSomeFoos( Foo a, Foo b ) {
+       a.x = b.x;
+    }
+}
+
+
 // this empty task should still create a non-empty
 // ownership graph showing parameter allocation
 // look for the parameter s as a label referencing
 // a heap region that is multi-object, flagged, not summary
 task Startup( StartupObject s{ initialstate } ) {
+
+    /*
+    while( false ) {
+       Foo a = new Foo();
+       a.x   = new Foo();
+       a.x.x = new Foo();
+    }
+    */
+
     taskexit( s{ !initialstate } );
 }
 
+
+task NewObject( Foo a{ f }, Foo b{ f } ) {
+
+    Foo c = new Foo();
+
+    a.x = c;
+
+    taskexit( a{ !f }, b{ !f } );
+}
+
+
+
+/*
 // this task allocates a new object, so there should
 // be a heap region for the parameter, and several
 // heap regions for the allocation site, but the label
@@ -55,6 +90,7 @@ task NewObject( Voo v{ f } ) {
     taskexit( v{ !f } );
 }
 
+
 // this task 
 task Branch( Voo v{ f } ) {
     Voo w = new Voo();
@@ -71,12 +107,36 @@ task Branch( Voo v{ f } ) {
 }
 
 
-task NewInLoop( Voo v{ f } ) {
-    Voo w = new Voo();
+task NoAliasNewInLoop( Voo v{ f } ) {
+
+    for( int i = 0; i < 10; ++i ) {
+       Voo w = new Voo();
+       w.b   = new Baw();
+       w.b.f = new Foo();
+    }
+
+    taskexit( v{ !f } );
+}
+
+
+task NoAliasNewInLoopAnotherWay( Voo v{ f } ) {
 
     for( int i = 0; i < 10; ++i ) {
-       w.b = new Baw();
+       Voo w = new Voo();
+       Baw b = new Baw();
+       Foo f = new Foo();
+
+       w.b = b;
+       b.f = f;
     }
 
     taskexit( v{ !f } );
 }
+
+
+task ClobberInitParamReflex( Voo v{ f }, Voo w{ f } ) {
+    v.b = v.bb;
+
+    taskexit( v{ !f }, w{ !f } );
+}
+*/
\ No newline at end of file