couple fixes to make sure out-of-context nodes get all the states they need, and...
authorjjenista <jjenista>
Mon, 22 Mar 2010 03:33:17 +0000 (03:33 +0000)
committerjjenista <jjenista>
Mon, 22 Mar 2010 03:33:17 +0000 (03:33 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/ReachGraph.java

index a828d46569fa8ef4a468de30f4802ef66355d160..2dbe1862a744fff0ba4fe446a1a1c2c9f97fff58 100644 (file)
@@ -674,9 +674,25 @@ public class DisjointAnalysis {
        }
       }
 
+
+      if( takeDebugSnapshots && 
+         d.getSymbol().equals( descSymbolDebug ) 
+          ) {
+       debugSnapshot( rg, fn, true );
+      }
+
       // modify rg with appropriate transfer function
       rg = analyzeFlatNode( d, fm, fn, setReturns, rg );
+
+
+      if( takeDebugSnapshots && 
+         d.getSymbol().equals( descSymbolDebug ) 
+          ) {
+       debugSnapshot( rg, fn, false );
+      }
           
+
       // if the results of the new graph are different from
       // the current graph at this node, replace the graph
       // with the update and enqueue the children
@@ -1789,14 +1805,11 @@ getFlaggedAllocationSitesReachableFromTaskPRIVATE(TaskDescriptor td) {
 }
 
 
-  int zzz = 0;
-
-
   
   
   // get successive captures of the analysis state
   boolean takeDebugSnapshots = false;
-  String descSymbolDebug = "main";
+  String descSymbolDebug = "addSomething";
   boolean stopAfterCapture = true;
 
   // increments every visit to debugSnapshot, don't fiddle with it
@@ -1810,11 +1823,12 @@ getFlaggedAllocationSitesReachableFromTaskPRIVATE(TaskDescriptor td) {
   int freqCountReport = 0;
 
   // the debugCounter value at which to start taking snapshots
-  int iterStartCapture = 0;
+  int iterStartCapture = 25;
 
   // the number of snapshots to take
   int numIterToCapture = 300;
 
+
   void debugSnapshot( ReachGraph rg, FlatNode fn, boolean in ) {
     if( debugCounter > iterStartCapture + numIterToCapture ) {
       return;
index 9c8c8f881c13045890179c40ff2e738d1dd988b5..3f13f4901b268c0adab3040bdd5c70062f6b4f8e 100644 (file)
@@ -139,10 +139,7 @@ public class ReachGraph {
       alpha = inherent;
     }
 
-    if( preds == null ) {
-      // TODO: do this right?  For out-of-context nodes?
-      preds = ExistPredSet.factory();
-    }
+    assert preds != null;
     
     HeapRegionNode hrn = new HeapRegionNode( id,
                                             isSingleObject,
@@ -1820,6 +1817,15 @@ public class ReachGraph {
                                           preds,
                                           "out-of-context"
                                           );       
+          } else {
+            // otherwise it is there, so merge reachability
+            hrnCalleeAndOutContext.setAlpha( Canonical.unionORpreds( hrnCalleeAndOutContext.getAlpha(),
+                                                                     toCalleeContext( oocReach,
+                                                                                      preds,
+                                                                                      oocTuples
+                                                                                      )
+                                                                     )
+                                             );
           }
         }
 
@@ -1851,6 +1857,17 @@ public class ReachGraph {
                                                   reCaller.getPreds()
                                                   )
                                   );          
+
+        HeapRegionNode hrnCalleeAndOutContext =
+          (HeapRegionNode) oocEdgeExisting.getSrc();
+        hrnCalleeAndOutContext.setAlpha( Canonical.unionORpreds( hrnCalleeAndOutContext.getAlpha(),
+                                                                 toCalleeContext( oocReach,
+                                                                                  preds,
+                                                                                  oocTuples
+                                                                                  )
+                                                                 )
+                                         );
+        
         
       }                
     }
@@ -3133,7 +3150,16 @@ public class ReachGraph {
     Iterator<HeapRegionNode> nodeItr = id2hrn.values().iterator();
     while( nodeItr.hasNext() ) {
       HeapRegionNode hrn = nodeItr.next();
-      hrn.applyAlphaNew();
+
+      // as mentioned above, out-of-context nodes only serve
+      // as sources of reach states for the sweep, not part
+      // of the changes
+      if( hrn.isOutOfContext() ) {
+        assert hrn.getAlphaNew().equals( rsetEmpty );
+      } else {
+        hrn.applyAlphaNew();
+      }
+
       Iterator<RefEdge> itrRes = hrn.iteratorToReferencers();
       while( itrRes.hasNext() ) {
        res.add( itrRes.next() );