From fdb56c4ed28b6889b41afe727e51bac155601eed Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 4 Mar 2010 08:23:56 +0000 Subject: [PATCH] getting closer, still major bugs in call site transfer function --- Robust/src/Analysis/Disjoint/ExistPred.java | 18 ++++- Robust/src/Analysis/Disjoint/ReachGraph.java | 65 ++++++++++++++++++- .../Tests/disjoint/predicateTest2/makefile | 5 +- 3 files changed, 83 insertions(+), 5 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/ExistPred.java b/Robust/src/Analysis/Disjoint/ExistPred.java index 1304ef94..0581100a 100644 --- a/Robust/src/Analysis/Disjoint/ExistPred.java +++ b/Robust/src/Analysis/Disjoint/ExistPred.java @@ -189,10 +189,20 @@ 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 = rg.td2vn.get( e_tdSrc ); - HeapRegionNode hrnSrc = rg.id2hrn.get( e_hrnSrcID ); + 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 ) { + hrnSrc = rg.id2hrn.get( e_hrnSrcID ); + } assert (vnSrc == null) || (hrnSrc == null); // the source is not present in graph @@ -221,6 +231,8 @@ public class ExistPred extends Canonical { } + System.out.println( " check the edge..." ); + // is there an edge between them with the given // type and field? // TODO: type OR a subtype? @@ -228,10 +240,12 @@ 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 07832de4..e695e570 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -1428,8 +1428,10 @@ public class ReachGraph { // 4. Global sweep it. - System.out.println( ); + if( writeDebugDOTs ) { + System.out.println( "doing call site, edges:"+callerEdgesCopiedToCallee ); + } // 1. mark what callee elements have satisfied predicates @@ -1454,7 +1456,9 @@ public class ReachGraph { - + if( writeDebugDOTs ) { + System.out.println( " node satissfied: "+hrnCallee ); + } } @@ -1472,12 +1476,56 @@ public class ReachGraph { } } + // test param -> HRN edges, also + for( int i = 0; i < fm.numParameters(); ++i ) { + + // parameter defined here is the symbol in the callee + TempDescriptor tdParam = fm.getParameter( i ); + VariableNode vnCallee = rgCallee.getVariableNodeFromTemp( tdParam ); + + Iterator reItr = vnCallee.iteratorToReferencees(); + while( reItr.hasNext() ) { + RefEdge reCallee = reItr.next(); + + + if( writeDebugDOTs ) { + System.out.println( " satisfied?: "+reCallee ); + } + + + if( reCallee.getPreds().isSatisfiedBy( this, + callerNodesCopiedToCallee, + callerEdgesCopiedToCallee + ) + ) { + calleeEdgesSatisfied.add( reCallee ); + + if( writeDebugDOTs ) { + System.out.println( " satisfied: "+reCallee ); + } + } + + else + if( writeDebugDOTs ) { + System.out.println( " NOT satisfied: "+reCallee ); + } + + + } + + } + + // 2. predicates tested, ok to wipe out caller part Iterator hrnItr = callerNodesCopiedToCallee.iterator(); while( hrnItr.hasNext() ) { HeapRegionNode hrnCaller = hrnItr.next(); wipeOut( hrnCaller ); + + if( writeDebugDOTs ) { + System.out.println( " wiping: "+hrnCaller ); + } } @@ -1509,6 +1557,10 @@ 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 ); @@ -1529,6 +1581,11 @@ 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 @@ -1536,6 +1593,10 @@ public class ReachGraph { } rsnCaller = this.getVariableNodeFromTemp( tdArg ); + + if( writeDebugDOTs ) { + System.out.println( " stitching in: "+rsnCaller ); + } } else { HeapRegionNode hrnSrcCallee = (HeapRegionNode) reCallee.getSrc(); diff --git a/Robust/src/Tests/disjoint/predicateTest2/makefile b/Robust/src/Tests/disjoint/predicateTest2/makefile index 0b6c6980..dac21d9c 100644 --- a/Robust/src/Tests/disjoint/predicateTest2/makefile +++ b/Robust/src/Tests/disjoint/predicateTest2/makefile @@ -3,6 +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= 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 @@ -16,7 +19,7 @@ PNGs: DOTs DOTs: $(PROGRAM).bin $(PROGRAM).bin: $(SOURCE_FILES) - $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES) + $(BUILDSCRIPT) $(BSFLAGS) $(DEBUGFLAGS) -o $(PROGRAM) $(SOURCE_FILES) OLDBSFLAGS= -mainclass Test -justanalyze -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions old: $(SOURCE_FILES) -- 2.34.1