From 6c99d9e5fc6c29760bf8feaa1936f5fa1ce0d560 Mon Sep 17 00:00:00 2001 From: jjenista Date: Fri, 26 Mar 2010 15:56:27 +0000 Subject: [PATCH] collect last night's changes --- .../Analysis/Disjoint/DisjointAnalysis.java | 11 +- Robust/src/Analysis/Disjoint/ReachGraph.java | 138 +++++++++++------- Robust/src/Analysis/Disjoint/ReachState.java | 4 +- 3 files changed, 90 insertions(+), 63 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index ab0fda06..87c0ab1f 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -1046,7 +1046,7 @@ public class DisjointAnalysis { //rg.abstractGarbageCollect(); //rg.globalSweep(); - + // at this point rg should be the correct update // by an above transfer function, or untouched if // the flat node type doesn't affect the heap @@ -1633,7 +1633,7 @@ private Set getFieldSetTobeAnalyzed(TypeDescriptor typeDesc){ false, // out-of-context? as.getType(), // type as, // allocation site - null, // inherent reach + alpha, // inherent reach alpha, // current reach ExistPredSet.factory(rg.predTrue), // predicates tempDesc.toString() // description @@ -1691,7 +1691,7 @@ private Set getFieldSetTobeAnalyzed(TypeDescriptor typeDesc){ false, // out-of-context? typeDesc, // type as, // allocation site - null, // inherent reach + alpha, // inherent reach alpha, // current reach ExistPredSet.factory(rg.predTrue), // predicates tempDesc.toString() // description @@ -1750,6 +1750,7 @@ private ReachGraph createInitialTaskReachGraph(FlatMethod fm) { VariableNode lnX = rg.getVariableNodeFromTemp(tempDesc); Integer idNewest = as.getIthOldest(0); HeapRegionNode hrnNewest = rg.id2hrn.get(idNewest); + // make a new reference to allocated node RefEdge edgeNew = new RefEdge(lnX, // source hrnNewest, // dest @@ -1759,7 +1760,7 @@ private ReachGraph createInitialTaskReachGraph(FlatMethod fm) { ExistPredSet.factory(rg.predTrue) // predicates ); rg.addRefEdge(lnX, hrnNewest, edgeNew); - + // set-up a work set for class field ClassDescriptor classDesc = paramTypeDesc.getClassDesc(); for (Iterator it = classDesc.getFields(); it.hasNext();) { @@ -1814,7 +1815,7 @@ private ReachGraph createInitialTaskReachGraph(FlatMethod fm) { false, // out-of-context? allocSite.getType(), // type allocSite, // allocation site - null, // inherent reach + hrnNewest.getAlpha(), // inherent reach hrnNewest.getAlpha(), // current reach ExistPredSet.factory(rg.predTrue), // predicates strDesc // description diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 1ce53745..6f2c42bc 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -1433,7 +1433,7 @@ public class ReachGraph { stateCaller ); } - } + } } assert out.isCanonical(); @@ -2141,60 +2141,6 @@ public class ReachGraph { } } } - /* - // test param -> HRN edges, also - for( int i = 0; i < fmCallee.numParameters(); ++i ) { - - // parameter defined here is the symbol in the callee - TempDescriptor tdParam = fmCallee.getParameter( i ); - - if( !DisjointAnalysis.shouldAnalysisTrack( tdParam.getType() ) ) { - // skip primitive/immutable parameters - continue; - } - - VariableNode vnCallee = rgCallee.getVariableNodeFromTemp( tdParam ); - - Iterator reItr = vnCallee.iteratorToReferencees(); - while( reItr.hasNext() ) { - RefEdge reCallee = reItr.next(); - - ExistPredSet ifDst = - reCallee.getDst().getPreds().isSatisfiedBy( this, - callerNodeIDsCopiedToCallee - ); - if( ifDst == null ) { - continue; - } - - ExistPredSet predsIfSatis = - reCallee.getPreds().isSatisfiedBy( this, - callerNodeIDsCopiedToCallee - ); - if( predsIfSatis != null ) { - calleeEdgesSatisfied.put( reCallee, predsIfSatis ); - - // since the edge is coming over, find out which reach - // states on it should come over, too - Iterator stateItr = reCallee.getBeta().iterator(); - while( stateItr.hasNext() ) { - ReachState stateCallee = stateItr.next(); - - predsIfSatis = - stateCallee.getPreds().isSatisfiedBy( this, - callerNodeIDsCopiedToCallee - ); - if( predsIfSatis != null ) { - calleeStatesSatisfied.put( stateCallee, predsIfSatis ); - } - } - - } - } - }*/ - - - if( writeDebugDOTs ) { writeGraph( debugGraphPrefix+"caller20BeforeWipe", @@ -2230,6 +2176,8 @@ public class ReachGraph { } + + // 3. callee elements with satisfied preds come in, note that // the mapping of elements satisfied to preds is like this: // A callee element EE has preds EEp that are satisfied by @@ -2287,6 +2235,8 @@ public class ReachGraph { + + if( writeDebugDOTs ) { writeGraph( debugGraphPrefix+"caller31BeforeAddingEdges", resolveMethodDebugDOTwriteLabels, @@ -2478,7 +2428,6 @@ public class ReachGraph { - if( writeDebugDOTs ) { writeGraph( debugGraphPrefix+"caller35BeforeAssignReturnValue", resolveMethodDebugDOTwriteLabels, @@ -2591,6 +2540,7 @@ public class ReachGraph { + if( writeDebugDOTs ) { writeGraph( debugGraphPrefix+"caller40BeforeShadowMerge", resolveMethodDebugDOTwriteLabels, @@ -2690,6 +2640,10 @@ public class ReachGraph { } + + + + if( writeDebugDOTs ) { writeGraph( debugGraphPrefix+"caller45BeforeUnshadow", resolveMethodDebugDOTwriteLabels, @@ -2716,6 +2670,7 @@ public class ReachGraph { + if( writeDebugDOTs ) { writeGraph( debugGraphPrefix+"caller50BeforeGlobalSweep", resolveMethodDebugDOTwriteLabels, @@ -2733,6 +2688,8 @@ public class ReachGraph { + + if( writeDebugDOTs ) { writeGraph( debugGraphPrefix+"caller90AfterTransfer", resolveMethodDebugDOTwriteLabels, @@ -3290,6 +3247,7 @@ public class ReachGraph { // any node should name a node that is // part of the graph public boolean inContextTuplesInGraph() { + Iterator hrnItr = id2hrn.entrySet().iterator(); while( hrnItr.hasNext() ) { Map.Entry me = (Map.Entry) hrnItr.next(); @@ -3341,6 +3299,74 @@ public class ReachGraph { } + // another useful assertion for debugging + public boolean noEmptyReachSetsInGraph() { + + Iterator hrnItr = id2hrn.entrySet().iterator(); + while( hrnItr.hasNext() ) { + Map.Entry me = (Map.Entry) hrnItr.next(); + HeapRegionNode hrn = (HeapRegionNode) me.getValue(); + + if( !hrn.isOutOfContext() && + !hrn.isWiped() && + hrn.getAlpha().isEmpty() + ) { + System.out.println( "!!! "+hrn+" has an empty ReachSet !!!" ); + return false; + } + + Iterator edgeItr = hrn.iteratorToReferencers(); + while( edgeItr.hasNext() ) { + RefEdge edge = edgeItr.next(); + + if( edge.getBeta().isEmpty() ) { + System.out.println( "!!! "+edge+" has an empty ReachSet !!!" ); + return false; + } + } + } + + return true; + } + + + public boolean everyReachStateWTrue() { + + Iterator hrnItr = id2hrn.entrySet().iterator(); + while( hrnItr.hasNext() ) { + Map.Entry me = (Map.Entry) hrnItr.next(); + HeapRegionNode hrn = (HeapRegionNode) me.getValue(); + + { + Iterator stateItr = hrn.getAlpha().iterator(); + while( stateItr.hasNext() ) { + ReachState state = stateItr.next(); + + if( !state.getPreds().equals( predsTrue ) ) { + return false; + } + } + } + + Iterator edgeItr = hrn.iteratorToReferencers(); + while( edgeItr.hasNext() ) { + RefEdge edge = edgeItr.next(); + + Iterator stateItr = edge.getBeta().iterator(); + while( stateItr.hasNext() ) { + ReachState state = stateItr.next(); + + if( !state.getPreds().equals( predsTrue ) ) { + return false; + } + } + } + } + + return true; + } + + //////////////////////////////////////////////////// diff --git a/Robust/src/Analysis/Disjoint/ReachState.java b/Robust/src/Analysis/Disjoint/ReachState.java index 41b839a4..6b8e14e4 100644 --- a/Robust/src/Analysis/Disjoint/ReachState.java +++ b/Robust/src/Analysis/Disjoint/ReachState.java @@ -152,8 +152,8 @@ public class ReachState extends Canonical { public String toString() { - //return reachTuples.toString(); - return reachTuples+":"+preds; + return reachTuples.toString(); + //return reachTuples+":"+preds; } public String toStringPreds() { -- 2.34.1