From 26e9287bfa433acdba9e81d28fa2057eee149270 Mon Sep 17 00:00:00 2001 From: jjenista Date: Mon, 18 Apr 2011 20:43:56 +0000 Subject: [PATCH] bug fix - during call site transfer func we temporarily double nodes per allocation site where nodes from the callee are called shadow nodes, and nodes that were in the caller before the call are named normal nodes. During the transfer we move the shadow newest, which are the newest, into the caller and merge normal nodes down to make room. The bug is that during the merge of normal nodes in this procedure there shoudl be a corresponding aging of reachability states, so when global sweep occurred after the node merging process some states look imprecise and get swept away --- .../Analysis/Disjoint/DisjointAnalysis.java | 2 +- Robust/src/Analysis/Disjoint/ReachGraph.java | 39 +++++++++++-------- .../Tests/disjoint/cc-paper-example/makefile | 14 ++++++- .../Tests/disjoint/cc-paper-example/test.java | 30 ++++++++++---- 4 files changed, 58 insertions(+), 27 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 34d41521..69abe98b 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -1166,7 +1166,7 @@ public class DisjointAnalysis implements HeapAnalysis { true, // selectively hide intermediate temp vars true, // prune unreachable heap regions false, // hide reachability altogether - false, // hide subset reachability states + true, // hide subset reachability states true, // hide predicates true ); // hide edge taints } break; diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index b17b3f01..8dea121d 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -791,7 +791,7 @@ public class ReachGraph { // retrieve the summary node, or make it // from scratch - HeapRegionNode hrnSummary = getSummaryNode( as, false ); + HeapRegionNode hrnSummary = getSummaryNode( as, false ); mergeIntoSummary( hrnK, hrnSummary ); } @@ -825,25 +825,14 @@ public class ReachGraph { wipeOut( hrn0, true ); // now tokens in reachability sets need to "age" also - Iterator itrAllVariableNodes = td2vn.entrySet().iterator(); - while( itrAllVariableNodes.hasNext() ) { - Map.Entry me = (Map.Entry) itrAllVariableNodes.next(); - VariableNode ln = (VariableNode) me.getValue(); - - Iterator itrEdges = ln.iteratorToReferencees(); - while( itrEdges.hasNext() ) { - ageTuplesFrom( as, itrEdges.next() ); - } - } - Iterator itrAllHRNodes = id2hrn.entrySet().iterator(); while( itrAllHRNodes.hasNext() ) { Map.Entry me = (Map.Entry) itrAllHRNodes.next(); HeapRegionNode hrnToAge = (HeapRegionNode) me.getValue(); - + ageTuplesFrom( as, hrnToAge ); - Iterator itrEdges = hrnToAge.iteratorToReferencees(); + Iterator itrEdges = hrnToAge.iteratorToReferencers(); while( itrEdges.hasNext() ) { ageTuplesFrom( as, itrEdges.next() ); } @@ -1007,10 +996,10 @@ public class ReachGraph { // then merge hrn reachability into hrnSummary hrnSummary.setAlpha( Canonical.unionORpreds( hrnSummary.getAlpha(), - hrn.getAlpha() - ) + hrn.getAlpha() + ) ); - + hrnSummary.setPreds( Canonical.join( hrnSummary.getPreds(), hrn.getPreds() @@ -2908,6 +2897,7 @@ public class ReachGraph { AllocSite as = asItr.next(); int ageNorm = 0; int ageShad = 0; + while( ageNorm < allocationDepth && ageShad < allocationDepth ) { @@ -2951,6 +2941,21 @@ public class ReachGraph { // yes, a normal node exists, so get the shadow summary HeapRegionNode summShad = getSummaryNode( as, true ); mergeIntoSummary( hrnNorm, summShad ); + + // now tokens in reachability sets need to age also + Iterator itrAllHRNodes = id2hrn.entrySet().iterator(); + while( itrAllHRNodes.hasNext() ) { + Map.Entry me = (Map.Entry) itrAllHRNodes.next(); + HeapRegionNode hrnToAge = (HeapRegionNode) me.getValue(); + + ageTuplesFrom( as, hrnToAge ); + + Iterator itrEdges = hrnToAge.iteratorToReferencers(); + while( itrEdges.hasNext() ) { + ageTuplesFrom( as, itrEdges.next() ); + } + } + ageNorm++; } diff --git a/Robust/src/Tests/disjoint/cc-paper-example/makefile b/Robust/src/Tests/disjoint/cc-paper-example/makefile index b36b083b..041896dc 100644 --- a/Robust/src/Tests/disjoint/cc-paper-example/makefile +++ b/Robust/src/Tests/disjoint/cc-paper-example/makefile @@ -3,7 +3,17 @@ PROGRAM=test SOURCE_FILES=$(PROGRAM).java BUILDSCRIPT=~/research/Robust/src/buildscript -BSFLAGS= -joptimize -flatirusermethods -mainclass Test -justanalyze -disjoint -disjoint-k 1 -disjoint-write-dots final -disjoint-alias-file aliases.txt normal -enable-assertions +BSFLAGS= -joptimize -mainclass Test -justanalyze -disjoint -disjoint-k 1 -disjoint-write-dots final -disjoint-alias-file aliases.txt normal -enable-assertions #-flatirusermethods + + +#DEBUGFLAGS= -disjoint-debug-callsite nodeFactory main 0 100 true + +#SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeatureTask 5 10 true +#SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeature 5 1 true + +#SNAPFLAGS= -disjoint-debug-snap-method t3 5 20 true + + all: $(PROGRAM).bin @@ -16,7 +26,7 @@ PNGs: DOTs DOTs: $(PROGRAM).bin $(PROGRAM).bin: $(SOURCE_FILES) - $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES) + $(BUILDSCRIPT) $(BSFLAGS) $(DEBUGFLAGS) -o $(PROGRAM) $(SOURCE_FILES) clean: rm -f $(PROGRAM).bin diff --git a/Robust/src/Tests/disjoint/cc-paper-example/test.java b/Robust/src/Tests/disjoint/cc-paper-example/test.java index f81af20e..976af63f 100644 --- a/Robust/src/Tests/disjoint/cc-paper-example/test.java +++ b/Robust/src/Tests/disjoint/cc-paper-example/test.java @@ -19,13 +19,17 @@ public class Test { } static public void main( String[] args ) { - //Graph[] a = new Graph[3]; + Graph[] a = new Graph[3]; for( int i = 0; i < 3; ++i ) { + Graph g = disjoint G new Graph(); + genreach p0BeforeUVgen; Node u = nodeFactory(); + genreach p1afterUgen; Node v = nodeFactory(); + genreach p2afterVgen; //Node u = disjoint U new Node(); //Node v = disjoint V new Node(); @@ -37,17 +41,29 @@ public class Test { // v = disjoint N new Node(); // } while(false); - genreach p0; - Config c = disjoint C new Config(); g.n = u; - u.n = v; u.c = c; - v.n = u; v.c = c; + genreach p3AfterConnectG2U; + + u.n = v; + genreach p4AfterConnectU2V; + + v.n = u; + genreach p5AfterConnectV2U; + + u.c = c; + v.c = c; + genreach p6AfterConfig; + + + + a[i] = g; - //a[i] = g; } - //System.out.println( a ); + genreach p7Last; + + System.out.println( a ); } } -- 2.34.1