Changed allocation depth to default to minimum possible so graphs are
authorjjenista <jjenista>
Mon, 18 Aug 2008 23:48:43 +0000 (23:48 +0000)
committerjjenista <jjenista>
Mon, 18 Aug 2008 23:48:43 +0000 (23:48 +0000)
less cluttered during development.  Other minor display changes, too.

Robust/src/Analysis/OwnershipAnalysis/AllocationSite.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Analysis/OwnershipAnalysis/TokenTuple.java
Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java

index fb02f4611ea60558eb80165b4d4f00f340b1394a..c915bbd0d9ac84a276291d30f87fa84166736911 100644 (file)
@@ -35,7 +35,7 @@ public class AllocationSite {
 
 
     public AllocationSite( int allocationDepth, TypeDescriptor type ) {
-       assert allocationDepth >= 3;
+       assert allocationDepth >= 1;
 
        this.allocationDepth = allocationDepth; 
        this.type            = type;
index ae271ff8c75ca7960e72e65323af027e167e21f8..24b3912b6169c1eb967f622fdbf6892f5c1de429 100644 (file)
@@ -194,6 +194,9 @@ public class OwnershipAnalysis {
        this.callGraph       = callGraph;
        this.allocationDepth = allocationDepth;
 
+       // temporary for debugging
+       this.allocationDepth = 1;
+
        descriptorsToVisit = new HashSet<Descriptor>();
 
        mapDescriptorToCompleteOwnershipGraph =
@@ -310,7 +313,7 @@ public class OwnershipAnalysis {
                boolean pruneGarbage,
                boolean writeReferencers 
                */
-               og.writeGraph( d, true, true, false, false );
+               og.writeGraph( d, true, true, true, false );
 
                // only methods have dependents, tasks cannot
                // be invoked by any user program calls
index 334663edfa963eff5d842f20f1958212ba3aa27a..87052d0a92a9e1bccb5b7f9cf60a25e7ad56cc02 100644 (file)
@@ -27,7 +27,7 @@ public class OwnershipGraph {
 
     public OwnershipGraph( int allocationDepth ) {
        this.allocationDepth = allocationDepth;
-
+       
        id2hrn        = new Hashtable<Integer,        HeapRegionNode>();
        td2ln         = new Hashtable<TempDescriptor, LabelNode     >();
        id2paramIndex = new Hashtable<Integer,        Integer       >();
@@ -77,7 +77,7 @@ public class OwnershipGraph {
        if( alpha == null ) {
            if( isFlagged || isParameter ) {
                alpha = new ReachabilitySet( new TokenTuple( id, 
-                                                            isNewSummary,
+                                                            !isSingleObject,
                                                             TokenTuple.ARITY_ONE )
                                           ).makeCanonical();
            } else {
@@ -418,6 +418,7 @@ public class OwnershipGraph {
                HeapRegionNode  hrnY  = edgeY.getDst();         
                ReachabilitySet O     = edgeY.getBeta();
 
+
                // propagate tokens over nodes starting from hrnSrc, and it will
                // take care of propagating back up edges from any touched nodes
                ChangeTupleSet Cy = O.unionUpArityToChangeSet( R );
@@ -444,23 +445,29 @@ public class OwnershipGraph {
                                          nodesWithNewAlpha,
                                          edgesWithNewBeta );
 
-               // finally, create the actual reference edge hrnX.f -> hrnY
+
+
+               //System.out.println( edgeY.getBetaNew() + "\nbeing pruned by\n" + hrnX.getAlpha() );
+
+               // create the actual reference edge hrnX.f -> hrnY
                ReferenceEdge edgeNew = new ReferenceEdge( hrnX,
                                                           hrnY,
                                                           f,
                                                           false,
                                                           edgeY.getBetaNew().pruneBy( hrnX.getAlpha() )
+                                                          //edgeY.getBeta().pruneBy( hrnX.getAlpha() )
                                                         );
+               addReferenceEdge( hrnX, hrnY, edgeNew );
+
+               /*
                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 );
 
@@ -482,6 +489,7 @@ public class OwnershipGraph {
                        addReferenceEdge( hrnX, hrnY, edgeNew );
                    }
                }
+               */
            }
        }       
 
@@ -522,7 +530,7 @@ public class OwnershipGraph {
        paramIndex2id.put( paramIndex, newID );
 
        ReachabilitySet beta = new ReachabilitySet( new TokenTuple( newID, 
-                                                                   false,
+                                                                   true,
                                                                    TokenTuple.ARITY_ONE ) );
 
        // heap regions for parameters are always multiple object (see above)
index 99c4faed5c7141274130b9e4280857a5b93c0d6b..93f6a6da1206d1d45739b80a40e0535960293f96 100644 (file)
@@ -92,16 +92,16 @@ public class TokenTuple extends Canonical {
 
 
     public String toString() {
-       String s = "";
+       String s = token.toString();
+
        if( isNewSummary ) {
-           s = "S";
+           s += "S";
        }
 
-       String t = "";
        if( arity == ARITY_MANY ) {
-           = "*";
+           s += "*";
        }
 
-       return new String( token+s+t );
+       return s;
     }
 }
index e380fb523af2f19a9a6d82418155ab57abd3eb83..73256c19d2adfea5e4f11dc1f4fd47d5466134d7 100644 (file)
@@ -1,3 +1,4 @@
+/*
 public class Parameter {
     flag w;
     int a, b;
@@ -34,6 +35,7 @@ public class Baw {
 
     public void doTheBaw( Voo v ) { v = new Voo(); }
 }
+*/
 
 public class Foo {
     flag f;
@@ -43,6 +45,7 @@ public class Foo {
     public Foo x;
     public Foo y;
 
+    /*
     public void ruinSomeFoos( Foo a, Foo b ) {
        a.x = b.x;
     }
@@ -57,6 +60,7 @@ public class Foo {
        p1.x = f1;
        p1.x = f2;
     }
+    */
 }
 
 
@@ -68,7 +72,7 @@ task Startup( StartupObject s{ initialstate } ) {
     taskexit( s{ !initialstate } );
 }
 
-
+/*
 task NewObjectA( Foo a{ f }, Foo b{ f } ) {
 
     Foo c = new Foo();
@@ -90,9 +94,15 @@ task NewObjectB( Foo a{ f }, Foo b{ f } ) {
 
     taskexit( a{ !f }, b{ !f } );
 }
+*/
 
+/*
 task NewObjectC( Foo a{ f }, Foo b{ f } ) {
 
+    Foo z = new Foo();
+    a.x = z;
+    a.y = z;
+
     Foo c;
 
     while( false ) {
@@ -104,9 +114,32 @@ task NewObjectC( Foo a{ f }, Foo b{ f } ) {
 
     taskexit( a{ !f }, b{ !f } );
 }
+*/
+
+
+task forMethod( Foo p0{ f } ) {
+
+    Foo a0;
+    Foo a1;
+
+    while( false ) {   
+       a1 = a0;            
+       if( false ) {
+           a0 = new Foo();
+       }
+    }
+
+    Foo z = new Foo();
+    a1.x = z;
+    z.x  = a1;
+
+
+    taskexit( p0{ !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
@@ -229,3 +262,4 @@ task methodTest( Foo p0{ f } ) {
 
     taskexit( p0{ !f } );
 }
+*/