Some initial implementation of reachability for ownership analysis.
[IRC.git] / Robust / src / Analysis / OwnershipAnalysis / OwnershipGraph.java
index e5061e12cc51f93660211997fc5b1393b3f734c3..e58dff7fabaea1ad09a1fdaa027205a7e8bd6784 100644 (file)
@@ -24,6 +24,10 @@ 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 OwnershipGraph( int allocationDepth ) {
        this.allocationDepth = allocationDepth;
@@ -34,6 +38,8 @@ public class OwnershipGraph {
        paramIndex2id = new Hashtable<Integer,        Integer       >();
 
        allocationSites = new HashSet <AllocationSite>();
+
+       alpha = new Hashtable< HeapRegionNode,     HashSet< HashSet<HeapRegionNode> > >();
     }
 
 
@@ -644,6 +650,7 @@ public class OwnershipGraph {
        mergeReferenceEdges ( og );
        mergeId2paramIndex  ( og );
        mergeAllocationSites( og );
+       mergeTokenSets      ( og );
     }
 
     protected void mergeOwnershipNodes( OwnershipGraph og ) {
@@ -811,6 +818,39 @@ public class OwnershipGraph {
     }
 
 
+    
+    protected void mergeTokenSets( OwnershipGraph og ) {
+       //      alpha = new Hashtable< HeapRegionNode,     HashSet< HashSet<HeapRegionNode> > >();
+
+       // if a key is in one or the other token set,
+       // add it to the merged token set.
+       // if a key is in both graphs, the merged
+       // token set should have that key and the union
+       // of values as the merged value.
+
+       /*
+       Set      alphaB = og.alpha.entrySet();
+       Iterator iB     = alphaB.iterator();
+       while( iB.hasNext() ) {
+           Map.Entry      meB     = (Map.Entry) iB.next();
+           HeapRegionNode hrnKeyB = (HeapRegionNode) meB.getKey();
+           HashSet< HashSet<HeapRegionNode> > > tokenSetsB = 
+               (HashSet< HashSet<HeapRegionNode> > >) meB.getValue();
+
+           if( !alpha.containsKey( hrnKeyB ) ) {
+               alpha.put( hrnKeyB, tokenSetsB );
+           } else {
+               
+           }
+       }
+       */
+    }
+
+
+
+
+
+
     // it is necessary in the equals() member functions
     // to "check both ways" when comparing the data
     // structures of two graphs.  For instance, if all