Starting to integrate reachability classes into ownership.
authorjjenista <jjenista>
Wed, 2 Jul 2008 18:37:05 +0000 (18:37 +0000)
committerjjenista <jjenista>
Wed, 2 Jul 2008 18:37:05 +0000 (18:37 +0000)
Robust/src/Analysis/OwnershipAnalysis/HeapRegionNode.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Analysis/OwnershipAnalysis/ReachabilitySet.java
Robust/src/Tests/OwnershipAnalysisTest/test01/makefile

index 55774b538b945a5f396fabedc9f8ab7185c34fb1..1e28f9045410f029f1cf67a5c358773f16c512c1 100644 (file)
@@ -17,21 +17,25 @@ public class HeapRegionNode extends OwnershipNode {
 
     protected AllocationSite allocSite;
 
+    protected ReachabilitySet alpha;
+
     protected String description;
 
 
 
-    public HeapRegionNode( Integer        id,
-                          boolean        isSingleObject,
-                          boolean        isFlagged,
-                          boolean        isNewSummary,
-                          AllocationSite allocSite,
-                          String         description ) {
+    public HeapRegionNode( Integer         id,
+                          boolean         isSingleObject,
+                          boolean         isFlagged,
+                          boolean         isNewSummary,
+                          AllocationSite  allocSite,
+                          ReachabilitySet alpha,
+                          String          description ) {
        this.id = id;
        this.isSingleObject = isSingleObject;
        this.isFlagged      = isFlagged;
        this.isNewSummary   = isNewSummary;
        this.allocSite      = allocSite;
+       this.alpha          = alpha;
        this.description    = description;
 
        referencers  = new HashSet<OwnershipNode>();
@@ -44,6 +48,7 @@ public class HeapRegionNode extends OwnershipNode {
                                   isFlagged,
                                   isNewSummary,
                                   allocSite,
+                                  alpha,
                                   description );
     }
 
@@ -110,10 +115,20 @@ public class HeapRegionNode extends OwnershipNode {
        return allocSite;
     }
 
+
+    public ReachabilitySet getAlpha() {
+       return alpha;
+    }
+
+
     public String getIDString() {
        return id.toString();
     }
 
+    public String getAlphaString() {
+       return alpha.toStringEscapeNewline();
+    }
+
     public String toString() {
        return "HRN"+getIDString();
     }
index e58dff7fabaea1ad09a1fdaa027205a7e8bd6784..39fa29d8839e05f5592b2849df4c3c797136ccca 100644 (file)
@@ -25,8 +25,8 @@ public class OwnershipGraph {
     public HashSet<AllocationSite> allocationSites;
 
     // CHANGE!  Map HRN ID's to token sets (sets of IDs!)
-    public Hashtable< HeapRegionNode,     HashSet< HashSet<HeapRegionNode> > > alpha;
-  //public Hashtable< touple< HRN, HRN >, HashSet< HashSet<HeapRegionNode> > > beta;
+    //public Hashtable< HeapRegionNode,     HashSet< HashSet<HeapRegionNode> > > alpha;
+    //public Hashtable< touple< HRN, HRN >, HashSet< HashSet<HeapRegionNode> > > beta;
 
 
     public OwnershipGraph( int allocationDepth ) {
@@ -39,7 +39,7 @@ public class OwnershipGraph {
 
        allocationSites = new HashSet <AllocationSite>();
 
-       alpha = new Hashtable< HeapRegionNode,     HashSet< HashSet<HeapRegionNode> > >();
+       //alpha = new Hashtable< HeapRegionNode, HashSet< HashSet<HeapRegionNode> > >();
     }
 
 
@@ -67,22 +67,35 @@ public class OwnershipGraph {
     // in the merge() operation) or to create new heap
     // regions with a new unique ID.
     protected HeapRegionNode 
-       createNewHeapRegionNode( Integer        id,
-                                boolean        isSingleObject,
-                                boolean        isFlagged,
-                                boolean        isNewSummary,
-                                AllocationSite allocSite,
-                                String         description ) {
+       createNewHeapRegionNode( Integer         id,
+                                boolean         isSingleObject,
+                                boolean         isFlagged,
+                                boolean         isNewSummary,
+                                boolean         isParameter,
+                                AllocationSite  allocSite,
+                                ReachabilitySet alpha,
+                                String          description ) {
 
        if( id == null ) {
            id = OwnershipAnalysis.generateUniqueHeapRegionNodeID();
        }
 
+       if( alpha == null ) {
+           if( isFlagged || isParameter ) {
+               alpha = new ReachabilitySet( new TokenTuple( id, 
+                                                            isNewSummary,
+                                                            TokenTuple.ARITY_ONE ) );
+           } else {
+               alpha = new ReachabilitySet();
+           }
+       }
+
        HeapRegionNode hrn = new HeapRegionNode( id,
                                                 isSingleObject,
                                                 isFlagged,
                                                 isNewSummary,
                                                 allocSite,
+                                                alpha,
                                                 description );
        id2hrn.put( id, hrn );
        return hrn;
@@ -242,6 +255,8 @@ public class OwnershipGraph {
                                                          false,
                                                          isTask,
                                                          false,
+                                                         true,
+                                                         null,
                                                          null,
                                                          "param" + paramIndex );
 
@@ -347,7 +362,9 @@ public class OwnershipGraph {
                                                  false,
                                                  hasFlags,
                                                  true,
+                                                 false,
                                                  as,
+                                                 null,
                                                  as + "\\n" + as.getType() + "\\nsummary" );
 
            for( int i = 0; i < as.getAllocationDepth(); ++i ) {
@@ -357,7 +374,9 @@ public class OwnershipGraph {
                                         true,
                                         hasFlags,
                                         false,
+                                        false,
                                         as,
+                                        null,
                                         as + "\\n" + as.getType() + "\\n" + i + " oldest" );
            }
        }
@@ -650,7 +669,7 @@ public class OwnershipGraph {
        mergeReferenceEdges ( og );
        mergeId2paramIndex  ( og );
        mergeAllocationSites( og );
-       mergeTokenSets      ( og );
+       //mergeTokenSets      ( og );
     }
 
     protected void mergeOwnershipNodes( OwnershipGraph og ) {
@@ -819,7 +838,7 @@ public class OwnershipGraph {
 
 
     
-    protected void mergeTokenSets( OwnershipGraph og ) {
+    //protected void mergeTokenSets( OwnershipGraph og ) {
        //      alpha = new Hashtable< HeapRegionNode,     HashSet< HashSet<HeapRegionNode> > >();
 
        // if a key is in one or the other token set,
@@ -844,7 +863,7 @@ public class OwnershipGraph {
            }
        }
        */
-    }
+    //}
 
 
 
@@ -1374,6 +1393,8 @@ public class OwnershipGraph {
                          hrn.getID()          +
                          "\\n"                +
                          hrn.getDescription() + 
+                         "\\n"                +
+                         hrn.getAlphaString() +
                          "\"]";
 
            bw.write( "  " + hrn.toString() + attributes + ";\n" );
index 83d6bfce40b5de2ba81e5c8c6de80ec5653456ad..972e3d5b98cf141843a70542d6e12561535ada93 100644 (file)
@@ -19,6 +19,10 @@ public class ReachabilitySet {
        possibleReachabilities.add( tts );
     }
 
+    public ReachabilitySet( TokenTuple tt ) {
+       this( new TokenTupleSet( tt ) );
+    }
+
     public ReachabilitySet( ReachabilitySet rs ) {
        possibleReachabilities = (HashSet<TokenTupleSet>) rs.possibleReachabilities.clone(); // again, DEEP COPY?!
     }
@@ -82,9 +86,7 @@ public class ReachabilitySet {
 
                if( !theUnion.isEmpty() ) {
                    ctsOut = ctsOut.union( 
-                              new ChangeTupleSet( 
-                                new ChangeTuple( o, theUnion )
-                                                 )
+                     new ChangeTupleSet( new ChangeTuple( o, theUnion ) )
                                          );
                }
            }
@@ -93,6 +95,21 @@ public class ReachabilitySet {
        return ctsOut;
     }
 
+
+    public String toStringEscapeNewline() {
+       String s = "[";
+
+       Iterator i = this.iterator();
+       while( i.hasNext() ) {
+           s += "\\n  "+i.next();
+       }
+
+       s += "]";
+
+       return s;       
+    }
+
+
     public String toString() {
        String s = "[";
 
index 650e7e72e0d255f1114a37fe621e33a80de32b8c..37e72086b6db43325b6c1ccf221090943c12532a 100644 (file)
@@ -9,10 +9,10 @@ BSFLAGS= -recover -flatirtasks -ownership -enable-assertions
 all: $(PROGRAM).bin
 
 view: PNGs
-       eog *flatIRGraph*.png &
+       #eog *flatIRGraph*.png &
        #eog *FN*.png &
        #eog *Ownership*.png &
-       eog *.png &
+       eog *COMPLETE*.png &
 
 printable:
        rm -f *Startup*.dot