From 7ab801e800b263ebc59348a2646680d10fcdf632 Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 4 Mar 2010 22:25:06 +0000 Subject: [PATCH] bug fix, other transfer funcs invoke mutating methods, call site transfer creates new reachgraph--but new graph wasn't being returned to fixed point computation --- .../Analysis/Disjoint/DisjointAnalysis.java | 19 +++---- Robust/src/Analysis/Disjoint/ExistPred.java | 9 ---- Robust/src/Analysis/Disjoint/ReachGraph.java | 53 +------------------ .../Tests/disjoint/predicateTest2/makefile | 6 +-- .../Tests/disjoint/predicateTest2/test.java | 2 +- 5 files changed, 16 insertions(+), 73 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 626fb6c1..eee0aa6a 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -350,11 +350,13 @@ public class DisjointAnalysis { } // modify rg with appropriate transfer function - analyzeFlatNode( d, fm, fn, setReturns, rg ); + rg = analyzeFlatNode( d, fm, fn, setReturns, rg ); + if( takeDebugSnapshots && - d.getSymbol().equals( descSymbolDebug ) ) { + d.getSymbol().equals( descSymbolDebug ) + ) { debugSnapshot( rg, fn ); } @@ -393,7 +395,7 @@ public class DisjointAnalysis { } - protected void + protected ReachGraph analyzeFlatNode( Descriptor d, FlatMethod fmContaining, FlatNode fn, @@ -621,11 +623,9 @@ public class DisjointAnalysis { ); } - rgMergeOfEffects.merge( rgCopy ); + rgMergeOfEffects.merge( rgCopy ); } - - // now that we've taken care of building heap models for // callee analysis, finish this transformation @@ -656,6 +656,7 @@ public class DisjointAnalysis { // 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 + return rg; } @@ -696,7 +697,7 @@ public class DisjointAnalysis { rg.writeGraph( "COMPLETE"+d, true, // write labels (variables) true, // selectively hide intermediate temp vars - true, // prune unreachable heap regions + false, // prune unreachable heap regions false, // show back edges to confirm graph validity true, // hide subset reachability states true ); // hide edge taints @@ -1183,7 +1184,7 @@ public class DisjointAnalysis { // get successive captures of the analysis state boolean takeDebugSnapshots = false; - String descSymbolDebug = "addSomething"; + String descSymbolDebug = "addBar"; boolean stopAfterCapture = true; // increments every visit to debugSnapshot, don't fiddle with it @@ -1228,7 +1229,7 @@ public class DisjointAnalysis { try { rg.writeGraph( graphName, true, // write labels (variables) - true, // selectively hide intermediate temp vars + false, // selectively hide intermediate temp vars false, // prune unreachable heap regions false, // show back edges to confirm graph validity true, // hide subset reachability states diff --git a/Robust/src/Analysis/Disjoint/ExistPred.java b/Robust/src/Analysis/Disjoint/ExistPred.java index 0581100a..bc7988fb 100644 --- a/Robust/src/Analysis/Disjoint/ExistPred.java +++ b/Robust/src/Analysis/Disjoint/ExistPred.java @@ -189,15 +189,11 @@ public class ExistPred extends Canonical { } if( predType == TYPE_EDGE ) { - - System.out.println( " type==edge" ); - // first establish whether the source of the // reference edge exists VariableNode vnSrc = null; if( e_tdSrc != null ) { vnSrc = rg.td2vn.get( e_tdSrc ); - System.out.println( " vnSrc="+vnSrc ); } HeapRegionNode hrnSrc = null; if( e_hrnSrcID != null ) { @@ -229,9 +225,6 @@ public class ExistPred extends Canonical { if( !calleeReachableNodes.contains( hrnDst ) ) { return false; } - - - System.out.println( " check the edge..." ); // is there an edge between them with the given // type and field? @@ -240,12 +233,10 @@ public class ExistPred extends Canonical { e_type, e_field ); if( edge == null ) { - System.out.println( " edge is null!" ); return false; } if( !calleeReachableEdges.contains( edge ) ) { - System.out.println( " edge not reachable!" ); return false; } diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index e695e570..ee47e9aa 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -894,7 +894,7 @@ public class ReachGraph { HeapRegionNode hrnReferencee = edge.getDst(); RefEdge edgeNew = edge.copy(); edgeNew.setSrc( hrnB ); - edgeNew.setDst( hrnB ); + edgeNew.setDst( hrnReferencee ); addRefEdge( hrnB, hrnReferencee, edgeNew ); } @@ -1387,14 +1387,12 @@ public class ReachGraph { } } - if( writeDebugDOTs ) { try { rg.writeGraph( "calleeview", true, false, false, false, true, true ); } catch( IOException e ) {} } - return rg; } @@ -1429,11 +1427,6 @@ public class ReachGraph { - if( writeDebugDOTs ) { - System.out.println( "doing call site, edges:"+callerEdgesCopiedToCallee ); - } - - // 1. mark what callee elements have satisfied predicates Set calleeNodesSatisfied = new HashSet(); @@ -1453,13 +1446,6 @@ public class ReachGraph { ) ) { calleeNodesSatisfied.add( hrnCallee ); - - - - if( writeDebugDOTs ) { - System.out.println( " node satissfied: "+hrnCallee ); - } - } Iterator reItr = hrnCallee.iteratorToReferencees(); @@ -1486,12 +1472,6 @@ public class ReachGraph { Iterator reItr = vnCallee.iteratorToReferencees(); while( reItr.hasNext() ) { RefEdge reCallee = reItr.next(); - - - if( writeDebugDOTs ) { - System.out.println( " satisfied?: "+reCallee ); - } - if( reCallee.getPreds().isSatisfiedBy( this, callerNodesCopiedToCallee, @@ -1499,20 +1479,8 @@ public class ReachGraph { ) ) { calleeEdgesSatisfied.add( reCallee ); - - if( writeDebugDOTs ) { - System.out.println( " satisfied: "+reCallee ); - } } - - else - if( writeDebugDOTs ) { - System.out.println( " NOT satisfied: "+reCallee ); - } - - } - } @@ -1522,10 +1490,6 @@ public class ReachGraph { while( hrnItr.hasNext() ) { HeapRegionNode hrnCaller = hrnItr.next(); wipeOut( hrnCaller ); - - if( writeDebugDOTs ) { - System.out.println( " wiping: "+hrnCaller ); - } } @@ -1557,10 +1521,6 @@ public class ReachGraph { ); } - if( writeDebugDOTs ) { - System.out.println( " stitching in: "+hrnCaller ); - } - // TODO: alpha should be some rewritten version of callee in caller context hrnCaller.setAlpha( rsetEmpty ); @@ -1581,11 +1541,6 @@ public class ReachGraph { TempDescriptor tdParam = vnCallee.getTempDescriptor(); TempDescriptor tdArg = fc.getArgMatchingParam( fm, tdParam ); - - if( writeDebugDOTs ) { - System.out.println( " considering: "+rsnCallee ); - } - if( tdArg == null ) { // this means the variable isn't a parameter, its local // to the callee so we ignore it in call site transfer @@ -1593,10 +1548,6 @@ public class ReachGraph { } rsnCaller = this.getVariableNodeFromTemp( tdArg ); - - if( writeDebugDOTs ) { - System.out.println( " stitching in: "+rsnCaller ); - } } else { HeapRegionNode hrnSrcCallee = (HeapRegionNode) reCallee.getSrc(); @@ -1631,7 +1582,7 @@ public class ReachGraph { if( writeDebugDOTs ) { try { - writeGraph( "callerAfter", + writeGraph( "callerAfterTransfer", true, false, false, false, true, true, null, null ); } catch( IOException e ) {} diff --git a/Robust/src/Tests/disjoint/predicateTest2/makefile b/Robust/src/Tests/disjoint/predicateTest2/makefile index dac21d9c..0f5ef262 100644 --- a/Robust/src/Tests/disjoint/predicateTest2/makefile +++ b/Robust/src/Tests/disjoint/predicateTest2/makefile @@ -3,9 +3,9 @@ PROGRAM=test SOURCE_FILES=$(PROGRAM).java BUILDSCRIPT=~/research/Robust/src/buildscript -DEBUGFLAGS= -disjoint-debug-callsite Bar addBar 1 -DEBUGFLAGS= -disjoint-debug-callsite addBar addSomething 1 -#DEBUGFLAGS= +#DEBUGFLAGS= -disjoint-debug-callsite addBar addSomething 1 +#DEBUGFLAGS= -disjoint-debug-callsite Bar addBar 1 +DEBUGFLAGS= BSFLAGS= -mainclass Test -justanalyze -disjoint -disjoint-k 2 -disjoint-write-dots final -disjoint-write-ihms -disjoint-alias-file aliases.txt normal -enable-assertions all: $(PROGRAM).bin diff --git a/Robust/src/Tests/disjoint/predicateTest2/test.java b/Robust/src/Tests/disjoint/predicateTest2/test.java index 071d50a9..7f8eb32e 100644 --- a/Robust/src/Tests/disjoint/predicateTest2/test.java +++ b/Robust/src/Tests/disjoint/predicateTest2/test.java @@ -16,7 +16,7 @@ public class Test { /* Foo f2 = new Foo(); - addSomething( f2 ); + addSomething( f2 ); */ } -- 2.34.1