From cf0fc38103bea1b50854b359ee10656b33b899af Mon Sep 17 00:00:00 2001 From: jjenista Date: Mon, 22 Mar 2010 03:33:17 +0000 Subject: [PATCH] couple fixes to make sure out-of-context nodes get all the states they need, and make sure global sweep never removes states from an out-of-context node --- .../Analysis/Disjoint/DisjointAnalysis.java | 24 ++++++++++--- Robust/src/Analysis/Disjoint/ReachGraph.java | 36 ++++++++++++++++--- 2 files changed, 50 insertions(+), 10 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index a828d465..2dbe1862 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -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; diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 9c8c8f88..3f13f490 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -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 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 itrRes = hrn.iteratorToReferencers(); while( itrRes.hasNext() ) { res.add( itrRes.next() ); -- 2.34.1