Heap regions with no reachability token need to have the empty reachability set
authorjjenista <jjenista>
Mon, 18 Aug 2008 19:46:54 +0000 (19:46 +0000)
committerjjenista <jjenista>
Mon, 18 Aug 2008 19:46:54 +0000 (19:46 +0000)
in order for other token operations to work.

Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java
Robust/src/Tests/OwnershipAnalysisTest/test01/makefile
Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java

index b9ca6096199d40434b4f19cdb5657772c3fd9644..ae271ff8c75ca7960e72e65323af027e167e21f8 100644 (file)
@@ -310,7 +310,7 @@ public class OwnershipAnalysis {
                boolean pruneGarbage,
                boolean writeReferencers 
                */
-               og.writeGraph( d, true, true, true, false );
+               og.writeGraph( d, true, true, false, false );
 
                // only methods have dependents, tasks cannot
                // be invoked by any user program calls
index 43e2752881ddacbc9905c7449064925c017aeede..334663edfa963eff5d842f20f1958212ba3aa27a 100644 (file)
@@ -78,9 +78,11 @@ public class OwnershipGraph {
            if( isFlagged || isParameter ) {
                alpha = new ReachabilitySet( new TokenTuple( id, 
                                                             isNewSummary,
-                                                            TokenTuple.ARITY_ONE ) );
+                                                            TokenTuple.ARITY_ONE )
+                                          ).makeCanonical();
            } else {
-               alpha = new ReachabilitySet();
+               alpha = new ReachabilitySet( new TokenTupleSet() 
+                                          ).makeCanonical();
            }
        }
 
@@ -451,11 +453,14 @@ public class OwnershipGraph {
                                                         );
                if( f != null ) {
                    // we can do a strong update here if one of two cases holds
+                   // SAVE FOR LATER, WITHOUT STILL CORRECT
+                   /*
                    if( (hrnX.getNumReferencers() == 1)                           ||
                        ( lnX.getNumReferencees() == 1 && hrnX.isSingleObject() )
                      ) {
                        clearReferenceEdgesFrom( hrnX, f, false );
                    }
+                   */
 
                    addReferenceEdge( hrnX, hrnY, edgeNew );
 
@@ -648,12 +653,17 @@ public class OwnershipGraph {
 
 
        // after tokens have been aged, reset newest node's reachability
-       hrn0.setAlpha( new ReachabilitySet( 
-                          new TokenTupleSet( 
-                              new TokenTuple( hrn0 ) 
-                                           ) 
-                                         ).makeCanonical() 
-                      );
+       if( hrn0.isFlagged() ) {
+           hrn0.setAlpha( new ReachabilitySet( new TokenTupleSet( 
+                                                                 new TokenTuple( hrn0 ) 
+                                                                ) 
+                                             ).makeCanonical() 
+                        );
+       } else {
+           hrn0.setAlpha( new ReachabilitySet( new TokenTupleSet()                                             
+                                             ).makeCanonical() 
+                        ); 
+       }
     }
  
 
@@ -1467,12 +1477,11 @@ public class OwnershipGraph {
 
                    // there is an edge in the right place with the right field,
                    // but do they have the same attributes?
-                   if( edgeA.isInitialParamReflexive() == edgeB.isInitialParamReflexive() &&
-                       edgeA.getBeta().equals( edgeB.getBeta() )                          ) {
+                   if( edgeA.getBeta().equals( edgeB.getBeta() ) ) {
                        
                        edgeFound = true;
-                   } else {
-                       return false;
+                       //} else {
+                       //return false;
                    }
                }
            }
index 81e557b0512a926c5759c5b3a250f16f36300db9..68a38cd81dc2635804a5355020c40942a8aad24e 100644 (file)
@@ -76,6 +76,12 @@ public class ReferenceEdge {
        return true;
     }
 
+
+    public boolean equalsIncludingBeta( ReferenceEdge edge ) {
+       return equals( edge ) && beta.equals( edge.beta );
+    }
+
+
     public int hashCode() {
        int hash = 0;
 
index 65cc0bbd340734de374148affd8d6c680364b461..6875fa034563fdb251175b55caf57b4b8af02879 100644 (file)
@@ -8,7 +8,7 @@ BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
 all: $(PROGRAM).bin
 
 view: PNGs
-       eog *.png
+       eog *.png &
 
 PNGs: DOTs
        d2p *COMPLETE*.dot
index 0213b85ae4ba64adabeb49990e9d8c2d502d623b..e380fb523af2f19a9a6d82418155ab57abd3eb83 100644 (file)
@@ -2,7 +2,8 @@ public class Parameter {
     flag w;
     int a, b;
     Parameter f, g;
-    Penguin penguin;
+    Penguin p;
+    Foo h;
 
     public Parameter() { a = 0; b = 0; f = null; g = null; }
 
@@ -12,6 +13,7 @@ public class Parameter {
 
 public class Penguin {
     int x, y;
+    Foo h;    
 
     public Penguin() { x = 0; y = 0; }
 
@@ -94,8 +96,10 @@ task NewObjectC( Foo a{ f }, Foo b{ f } ) {
     Foo c;
 
     while( false ) {
-       c   = new Foo();
-       c.x = new Foo();
+       c     = new Foo();
+       Foo f = new Foo();
+       c.x   = f;
+       c.y   = f;
     }
 
     taskexit( a{ !f }, b{ !f } );
@@ -103,7 +107,6 @@ task NewObjectC( Foo a{ f }, Foo 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
@@ -124,6 +127,24 @@ task ClobberInitParamReflex( Voo v{ f }, Voo w{ f } ) {
 }
 
 
+task BackToItself( Parameter p0{ w } ) {
+
+    Penguin p = new Penguin();
+    p0.p = p;
+    p.h = p0.h;
+
+    while( false ) {
+       Parameter p1   = new Parameter();
+                 p1.h = new Foo();
+       Penguin   q    = new Penguin();
+       p1.p = q;
+       q.h  = p1.h;
+    }
+
+    taskexit( p0{ !w } );
+}
+
+
 task SummaryNodeTokens( Foo p0{ f } ) {
 
     while( false ) {