From b9caca8c045ba18ecbda2a8f68e682c283e5a439 Mon Sep 17 00:00:00 2001 From: jjenista Date: Sat, 20 Mar 2010 00:38:06 +0000 Subject: [PATCH] trying to fix call site transfer bug, fixed caused other problems, still working on it --- Robust/src/Analysis/Disjoint/ExistPred.java | 42 ++++++++++++++++---- Robust/src/Analysis/Disjoint/ReachGraph.java | 29 +++++++++++--- Robust/src/Analysis/Disjoint/ReachSet.java | 5 --- Robust/src/Analysis/Disjoint/RefEdge.java | 4 ++ 4 files changed, 62 insertions(+), 18 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/ExistPred.java b/Robust/src/Analysis/Disjoint/ExistPred.java index 88267e1d..1bd58318 100644 --- a/Robust/src/Analysis/Disjoint/ExistPred.java +++ b/Robust/src/Analysis/Disjoint/ExistPred.java @@ -194,7 +194,8 @@ public class ExistPred extends Canonical { // otherwise look for state too // TODO: contains OR containsSuperSet OR containsWithZeroes?? - if( hrn.getAlpha().contains( ne_state ) ) { + if( hrn.getAlpha().containsIgnorePreds( ne_state ) + == null ) { return hrn.getPreds(); } @@ -213,6 +214,10 @@ public class ExistPred extends Canonical { hrnSrc = rg.id2hrn.get( e_hrnSrcID ); } assert (vnSrc == null) || (hrnSrc == null); + + + System.out.println( " checking if src in graph" ); + // the source is not present in graph if( vnSrc == null && hrnSrc == null ) { @@ -223,15 +228,28 @@ public class ExistPred extends Canonical { if( vnSrc != null ) { rsn = vnSrc; } else { - if( !calleeReachableNodes.contains( e_hrnSrcID ) && !e_srcOutContext ) { - return null; - } - if( calleeReachableNodes.contains( e_hrnSrcID ) && e_srcOutContext ) { - return null; + + + System.out.println( " doing this thing, reachable nodes: "+calleeReachableNodes ); + + if( e_srcOutContext ) { + if( !hrnSrc.isOutOfContext() ) { + return null; + } + } else { + if( hrnSrc.isOutOfContext() ) { + return null; + } } + rsn = hrnSrc; } + + + System.out.println( " checking if dst in graph" ); + + // is the destination present? HeapRegionNode hrnDst = rg.id2hrn.get( e_hrnDstID ); if( hrnDst == null ) { @@ -242,6 +260,11 @@ public class ExistPred extends Canonical { return null; } + + + System.out.println( " checking if edge/type/field matches" ); + + // is there an edge between them with the given // type and field? // TODO: type OR a subtype? @@ -258,9 +281,14 @@ public class ExistPred extends Canonical { return edge.getPreds(); } + + System.out.println( " state not null, checking for existence" ); + + // otherwise look for state too // TODO: contains OR containsSuperSet OR containsWithZeroes?? - if( hrnDst.getAlpha().contains( ne_state ) ) { + if( hrnDst.getAlpha().containsIgnorePreds( ne_state ) + == null ) { return edge.getPreds(); } diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 74502221..661c43b9 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -1444,10 +1444,10 @@ public class ReachGraph { calleeStatesSatisfied.get( stateCallee ) ); out = Canonical.add( out, - stateCaller - ); + stateCaller + ); } - } + } } assert out.isCanonical(); @@ -1748,19 +1748,22 @@ public class ReachGraph { ReachSet oocReach; TempDescriptor oocPredSrcTemp = null; Integer oocPredSrcID = null; + boolean oocooc; if( rsnCaller instanceof VariableNode ) { VariableNode vnCaller = (VariableNode) rsnCaller; oocNodeType = null; oocReach = rsetEmpty; oocPredSrcTemp = vnCaller.getTempDescriptor(); + oocooc = false; } else { HeapRegionNode hrnSrcCaller = (HeapRegionNode) rsnCaller; assert !callerNodeIDsCopiedToCallee.contains( hrnSrcCaller.getID() ); oocNodeType = hrnSrcCaller.getType(); oocReach = hrnSrcCaller.getAlpha(); - oocPredSrcID = hrnSrcCaller.getID(); + oocPredSrcID = hrnSrcCaller.getID(); + oocooc = hrnSrcCaller.isOutOfContext(); } ExistPred pred = @@ -1770,7 +1773,7 @@ public class ReachGraph { reCaller.getType(), reCaller.getField(), null, - true ); // out-of-context + oocooc ); // out-of-context ExistPredSet preds = ExistPredSet.factory( pred ); @@ -2038,6 +2041,12 @@ public class ReachGraph { continue; } + + + System.out.println( " preds satisfied? for "+reCallee+" "+reCallee.getPreds() ); + + + // first see if the source is out-of-context, and only // proceed with this edge if we find some caller-context // matches @@ -2118,8 +2127,14 @@ public class ReachGraph { } } + System.out.println( " YES" ); } + + else { + System.out.println( " NO" ); + } + } } @@ -2421,6 +2436,7 @@ public class ReachGraph { } } + // look to see if an edge with same field exists // and merge with it, otherwise just add the edge RefEdge edgeExisting = rsnCaller.getReferenceTo( hrnDstCaller, @@ -3096,7 +3112,8 @@ public class ReachGraph { if( B != null ) { ReachSet boldB_rtOld_incident = B.get( incidentEdge ); if( boldB_rtOld_incident != null && - boldB_rtOld_incident.contains( stateOld ) ) { + boldB_rtOld_incident.containsIgnorePreds( stateOld ) != null + ) { foundState = true; } } diff --git a/Robust/src/Analysis/Disjoint/ReachSet.java b/Robust/src/Analysis/Disjoint/ReachSet.java index 49417732..c5cf3947 100644 --- a/Robust/src/Analysis/Disjoint/ReachSet.java +++ b/Robust/src/Analysis/Disjoint/ReachSet.java @@ -62,11 +62,6 @@ public class ReachSet extends Canonical { return reachStates.isEmpty(); } - public boolean contains( ReachState state ) { - assert state != null; - return reachStates.contains( state ); - } - // this should be a hash table so we can do this by key public ReachState containsIgnorePreds( ReachState state ) { assert state != null; diff --git a/Robust/src/Analysis/Disjoint/RefEdge.java b/Robust/src/Analysis/Disjoint/RefEdge.java index 9883bfb1..c66b699d 100644 --- a/Robust/src/Analysis/Disjoint/RefEdge.java +++ b/Robust/src/Analysis/Disjoint/RefEdge.java @@ -238,4 +238,8 @@ public class RefEdge { "->"+dst+")" ); } + + public String toStringAndBeta() { + return toString()+beta.toString(); + } } -- 2.34.1