From 966e7fa86e317ca6f20a147b5687bafa8ac96e91 Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 17 Mar 2010 01:00:55 +0000 Subject: [PATCH] reach propagation not working, getting null states... --- Robust/src/Analysis/Disjoint/ReachGraph.java | 96 +++++++++++++++++++- 1 file changed, 95 insertions(+), 1 deletion(-) diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 9f9310dd..e5415018 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -2174,6 +2174,16 @@ public class ReachGraph { } + // set these up during the next procedure so after + // the caller has all of its nodes and edges put + // back together we can propagate the callee's + // reach changes backwards into the caller graph + HashSet edgesForPropagation = new HashSet(); + + Hashtable edgePlannedChanges = + new Hashtable(); + + // 3.b) callee -> callee edges AND out-of-context -> callee satisItr = calleeEdgesSatisfied.entrySet().iterator(); while( satisItr.hasNext() ) { @@ -2199,6 +2209,8 @@ public class ReachGraph { Set oocCallers = calleeEdges2oocCallerSrcMatches.get( reCallee ); + + boolean oocEdges = false; if( oocCallers == null ) { // there are no out-of-context matches, so it's @@ -2215,9 +2227,9 @@ public class ReachGraph { // to the callee so we ignore it in call site transfer // shouldn't this NEVER HAPPEN? assert false; - //continue; } rsnCallers.add( this.getVariableNodeFromTemp( tdArg ) ); + oocEdges = true; } else { // otherwise source is in context, one region @@ -2259,6 +2271,7 @@ public class ReachGraph { // that should NOT be translated to shadow nodes assert !oocCallers.isEmpty(); rsnCallers.addAll( oocCallers ); + oocEdges = true; } // now make all caller edges we've identified from @@ -2277,6 +2290,24 @@ public class ReachGraph { calleeStatesSatisfied ), preds ); + + ChangeSet cs = ChangeSet.factory(); + Iterator rsItr = reCaller.getBeta().iterator(); + while( rsItr.hasNext() ) { + ReachState state = rsItr.next(); + ExistPredSet preds2 = state.getPreds(); + assert preds2.preds.size() == 1; + + ExistPred pred = preds2.preds.iterator().next(); + ReachState old = pred.ne_state; + assert old != null; + + cs = Canonical.union( cs, + ChangeTuple.factory( old, + state + ) + ); + } // look to see if an edge with same field exists // and merge with it, otherwise just add the edge @@ -2295,9 +2326,22 @@ public class ReachGraph { reCaller.getPreds() ) ); + + // for reach propagation + edgePlannedChanges.put( + edgeExisting, + Canonical.union( edgePlannedChanges.get( edgeExisting ), + cs + ) + ); } else { addRefEdge( rsnCaller, hrnDstCaller, reCaller ); + + // for reach propagation + edgesForPropagation.add( reCaller ); + assert !edgePlannedChanges.containsKey( reCaller ); + edgePlannedChanges.put( reCaller, cs ); } } } @@ -2388,6 +2432,56 @@ public class ReachGraph { + if( writeDebugDOTs ) { + try { + writeGraph( "caller38propagateReach", + true, false, false, false, true, true ); + } catch( IOException e ) {} + } + + // propagate callee reachability changes to the rest + // of the caller graph edges + + + /* + if( !cts.isEmpty() ) { + Iterator incidentEdgeItr = hrn.iteratorToReferencers(); + while( incidentEdgeItr.hasNext() ) { + RefEdge incidentEdge = incidentEdgeItr.next(); + + edgesForPropagation.add( incidentEdge ); + + if( edgePlannedChanges.get( incidentEdge ) == null ) { + edgePlannedChanges.put( incidentEdge, cts ); + } else { + edgePlannedChanges.put( + incidentEdge, + Canonical.union( edgePlannedChanges.get( incidentEdge ), + cts + ) + ); + } + } + } + */ + + HashSet edgesUpdated = new HashSet(); + + propagateTokensOverEdges( edgesForPropagation, // source edges + edgePlannedChanges, // map src edge to change set + edgesUpdated ); // list of updated edges + + // commit beta' (beta<-betaNew) + Iterator edgeItr = edgesUpdated.iterator(); + while( edgeItr.hasNext() ) { + edgeItr.next().applyBetaNew(); + } + + + + + + if( writeDebugDOTs ) { try { writeGraph( "caller40BeforeShadowMerge", -- 2.34.1