x.f = y now prunes new edge's beta by alpha at x
authorjjenista <jjenista>
Mon, 4 Aug 2008 23:23:33 +0000 (23:23 +0000)
committerjjenista <jjenista>
Mon, 4 Aug 2008 23:23:33 +0000 (23:23 +0000)
Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java
Robust/src/Analysis/OwnershipAnalysis/ReachabilitySet.java
Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java

index 69db25c20faf9782f14dbc906be99fd666133365..fb574f59f24aa1b5c7f4782c7cf729f1d2e80349 100644 (file)
@@ -442,7 +442,10 @@ public class OwnershipGraph {
 
                // finally, create the actual reference edge hrn->hrnSrc
                ReferenceEdgeProperties repNew 
-                   = new ReferenceEdgeProperties( false, false, repSrc.getBetaNew() );
+                   = new ReferenceEdgeProperties( false, 
+                                                  false, 
+                                                  repSrc.getBetaNew().pruneBy( hrn.getAlpha() )
+                                                );
 
                addReferenceEdge( hrn, hrnSrc, repNew );
            }
index d412cffd9b3c8a343a4b9294c459d63923fb74c9..f7a5721ac255b1b980618a8a273ee16641b9c4ff 100644 (file)
@@ -202,7 +202,8 @@ public class ReachabilitySet extends Canonical {
 
 
     public ReachabilitySet ageTokens( AllocationSite as ) {    
-
+       assert as != null;
+       
        ReachabilitySet rsOut = new ReachabilitySet();
 
        Iterator itrS = this.iterator();
@@ -215,6 +216,32 @@ public class ReachabilitySet extends Canonical {
     }
 
 
+    public ReachabilitySet pruneBy( ReachabilitySet rsIn ) {
+       assert rsIn != null;
+
+       ReachabilitySet rsOut = new ReachabilitySet();
+
+       Iterator itrB = this.iterator();
+       while( itrB.hasNext() ) {
+           TokenTupleSet ttsB = (TokenTupleSet) itrB.next();
+
+           boolean subsetExists = false;
+
+           Iterator itrA = rsIn.iterator();
+           while( itrA.hasNext() && !subsetExists ) {
+               TokenTupleSet ttsA = (TokenTupleSet) itrA.next();
+           
+               if( ttsA.isSubset( ttsB ) ) {
+                   subsetExists = true;
+                   rsOut.possibleReachabilities.add( ttsB );               
+               }
+           }
+       }
+
+       return rsOut.makeCanonical();   
+    }
+
+
     public boolean equals( Object o ) {
        if( !(o instanceof ReachabilitySet) ) {
            return false;
index edd9edccdd105dc098c693038fc346cee253ea77..4bd1a7186e66062f29aa05d29a6aa07f35cdffc5 100644 (file)
@@ -76,6 +76,11 @@ public class TokenTupleSet extends Canonical {
        return tokenTuples.isEmpty();
     }
 
+    public boolean isSubset( TokenTupleSet ttsIn ) {
+       assert ttsIn != null;
+       return ttsIn.tokenTuples.containsAll( this.tokenTuples );
+    }
+
     public boolean containsTuple( TokenTuple tt ) {
        return tokenTuples.contains( tt );
     }