From 02a15ed947f300c85a40ab0f262af37162bf9996 Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 25 Mar 2010 01:26:34 +0000 Subject: [PATCH] bug fixes --- Robust/src/Analysis/Disjoint/AllocSite.java | 2 +- .../Analysis/Disjoint/DisjointAnalysis.java | 4 +- .../src/Analysis/Disjoint/ExistPredSet.java | 5 + Robust/src/Analysis/Disjoint/ReachGraph.java | 120 ++++++++++++++---- Robust/src/Benchmarks/Ownership/makefile | 3 +- Robust/src/Benchmarks/disjoint/makefile | 5 +- 6 files changed, 106 insertions(+), 33 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/AllocSite.java b/Robust/src/Analysis/Disjoint/AllocSite.java index c890f372..ee97eb52 100644 --- a/Robust/src/Analysis/Disjoint/AllocSite.java +++ b/Robust/src/Analysis/Disjoint/AllocSite.java @@ -227,7 +227,7 @@ public class AllocSite extends Canonical { } public String toStringWithIDs() { - String s = "allocSite "; + String s = "allocSite"+id+" "; for( int i = 0; i < ithOldest.size(); ++i ) { s += i+"("+ithOldest.get( i )+") "; } diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index d8faa20c..aac392ed 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -1124,7 +1124,7 @@ public class DisjointAnalysis { rg.writeGraph( d+"COMPLETE"+String.format( "%05d", n ), true, // write labels (variables) true, // selectively hide intermediate temp vars - true, // prune unreachable heap regions + false, // prune unreachable heap regions false, // hide subset reachability states true ); // hide edge taints @@ -1894,7 +1894,7 @@ getFlaggedAllocationSitesReachableFromTaskPRIVATE(TaskDescriptor td) { rg.writeGraph( graphName, true, // write labels (variables) true, // selectively hide intermediate temp vars - true, // prune unreachable heap regions + false, // prune unreachable heap regions false, // hide subset reachability states true );// hide edge taints } diff --git a/Robust/src/Analysis/Disjoint/ExistPredSet.java b/Robust/src/Analysis/Disjoint/ExistPredSet.java index 5f3757e4..3d9ae6be 100644 --- a/Robust/src/Analysis/Disjoint/ExistPredSet.java +++ b/Robust/src/Analysis/Disjoint/ExistPredSet.java @@ -84,6 +84,11 @@ public class ExistPredSet extends Canonical { } + public boolean isEmpty() { + return preds.isEmpty(); + } + + public boolean equals( Object o ) { if( o == null ) { return false; diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 9adbdad4..d1259c14 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -79,6 +79,8 @@ public class ReachGraph { return this.id2hrn.get( hrn.getID() ) == hrn; } + + // the reason for this method is to have the option @@ -140,7 +142,7 @@ public class ReachGraph { } assert preds != null; - + HeapRegionNode hrn = new HeapRegionNode( id, isSingleObject, markForAnalysis, @@ -1911,11 +1913,12 @@ public class ReachGraph { // useful since many graphs writes in the method call debug code private static boolean resolveMethodDebugDOTwriteLabels = true; private static boolean resolveMethodDebugDOTselectTemps = true; - private static boolean resolveMethodDebugDOTpruneGarbage = true; + private static boolean resolveMethodDebugDOTpruneGarbage = false; private static boolean resolveMethodDebugDOThideSubsetReach = false; private static boolean resolveMethodDebugDOThideEdgeTaints = true; static String debugGraphPrefix; + static int debugCallSiteVisits = 0; static int debugCallSiteVisitsUntilExit = 0; @@ -1928,7 +1931,7 @@ public class ReachGraph { ) { if( writeDebugDOTs ) { - debugGraphPrefix = String.format( "call%02d", debugCallSiteVisitsUntilExit ); + debugGraphPrefix = String.format( "call%02d", debugCallSiteVisits ); rgCallee.writeGraph( debugGraphPrefix+"callee", resolveMethodDebugDOTwriteLabels, @@ -1947,6 +1950,7 @@ public class ReachGraph { } + // method call transfer function steps: // 1. Use current callee-reachable heap (CRH) to test callee // predicates and mark what will be coming in. @@ -2033,7 +2037,21 @@ public class ReachGraph { HeapRegionNode hrnSrcCallee = (HeapRegionNode) rsnCallee; boolean matchedOutOfContext = false; - if( hrnSrcCallee.isOutOfContext() ) { + if( !hrnSrcCallee.isOutOfContext() ) { + + predsIfSatis = + hrnSrcCallee.getPreds().isSatisfiedBy( this, + callerNodeIDsCopiedToCallee + ); + if( predsIfSatis != null ) { + calleeNodesSatisfied.put( hrnSrcCallee, predsIfSatis ); + } else { + // otherwise forget this edge + continue; + } + + } else { + // hrnSrcCallee is out-of-context assert !calleeEdges2oocCallerSrcMatches.containsKey( reCallee ); @@ -2309,6 +2327,13 @@ public class ReachGraph { Set oocCallers = calleeEdges2oocCallerSrcMatches.get( reCallee ); + if( rsnCallee instanceof HeapRegionNode ) { + HeapRegionNode hrnCalleeSrc = (HeapRegionNode) rsnCallee; + if( hrnCalleeSrc.isOutOfContext() ) { + assert oocCallers != null; + } + } + if( oocCallers == null ) { // there are no out-of-context matches, so it's @@ -2331,6 +2356,7 @@ public class ReachGraph { } else { // otherwise source is in context, one region + HeapRegionNode hrnSrcCallee = (HeapRegionNode) rsnCallee; // translate an in-context node to shadow @@ -2343,23 +2369,7 @@ public class ReachGraph { HeapRegionNode hrnSrcCallerShadow = this.id2hrn.get( hrnIDSrcShadow ); - if( hrnSrcCallerShadow == null ) { - hrnSrcCallerShadow = - createNewHeapRegionNode( hrnIDSrcShadow, // id or null to generate a new one - hrnSrcCallee.isSingleObject(), // single object? - hrnSrcCallee.isNewSummary(), // summary? - hrnSrcCallee.isFlagged(), // flagged? - false, // out-of-context? - hrnSrcCallee.getType(), // type - hrnSrcCallee.getAllocSite(), // allocation site - toCallerContext( hrnSrcCallee.getInherent(), - calleeStatesSatisfied ), // inherent reach - toCallerContext( hrnSrcCallee.getAlpha(), - calleeStatesSatisfied ), // current reach - predsEmpty, // predicates - hrnSrcCallee.getDescription() // description - ); - } + assert hrnSrcCallerShadow != null; rsnCallers.add( hrnSrcCallerShadow ); } @@ -2725,8 +2735,8 @@ public class ReachGraph { resolveMethodDebugDOThideSubsetReach, resolveMethodDebugDOThideEdgeTaints ); - --debugCallSiteVisitsUntilExit; - if( debugCallSiteVisitsUntilExit <= 0 ) { + ++debugCallSiteVisits; + if( debugCallSiteVisits >= debugCallSiteVisitsUntilExit ) { System.out.println( "!!! Exiting after requested visits to call site. !!!" ); System.exit( 0 ); } @@ -3091,14 +3101,11 @@ public class ReachGraph { B = boldBooc.get( rtOld.getHrnID() ); } else { - if( !id2hrn.containsKey( rtOld.getHrnID() ) ) { - System.out.println( "\nLooking for "+rtOld ); - writeGraph( "dbgz" ); + // let symbols not in the graph get pruned + break; } - - assert id2hrn.containsKey( rtOld.getHrnID() ); B = boldBic.get( rtOld.getHrnID() ); } @@ -3272,6 +3279,63 @@ public class ReachGraph { } + // a useful assertion for debugging: + // every in-context tuple on any edge or + // 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(); + HeapRegionNode hrn = (HeapRegionNode) me.getValue(); + + { + Iterator stateItr = hrn.getAlpha().iterator(); + while( stateItr.hasNext() ) { + ReachState state = stateItr.next(); + + Iterator rtItr = state.iterator(); + while( rtItr.hasNext() ) { + ReachTuple rt = rtItr.next(); + + if( !rt.isOutOfContext() ) { + if( !id2hrn.containsKey( rt.getHrnID() ) ) { + System.out.println( rt.getHrnID()+" is missing" ); + 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(); + + Iterator rtItr = state.iterator(); + while( rtItr.hasNext() ) { + ReachTuple rt = rtItr.next(); + + if( !rt.isOutOfContext() ) { + if( !id2hrn.containsKey( rt.getHrnID() ) ) { + System.out.println( rt.getHrnID()+" is missing" ); + return false; + } + } + } + } + } + } + + return true; + } + + + //////////////////////////////////////////////////// // high-level merge operations diff --git a/Robust/src/Benchmarks/Ownership/makefile b/Robust/src/Benchmarks/Ownership/makefile index 0efaf50e..0a4bf1e7 100644 --- a/Robust/src/Benchmarks/Ownership/makefile +++ b/Robust/src/Benchmarks/Ownership/makefile @@ -1,5 +1,6 @@ BUILDSCRIPT=~/research/Robust/src/buildscript -BSFLAGS= -recover -justanalyze -ownership -ownaliasfiletab aliases.txt -enable-assertions #-ownwritedots final #-flatirtasks +#BSFLAGS= -recover -justanalyze -ownership -ownaliasfiletab aliases.txt -enable-assertions #-ownwritedots final #-flatirtasks +BSFLAGS= -recover -justanalyze -ownership -ownaliasfile aliases.txt -enable-assertions #-ownwritedots final #-flatirtasks AD1= -ownallocdepth 1 AD3= -ownallocdepth 3 AD5= -ownallocdepth 5 diff --git a/Robust/src/Benchmarks/disjoint/makefile b/Robust/src/Benchmarks/disjoint/makefile index ba99f112..5d223bfa 100644 --- a/Robust/src/Benchmarks/disjoint/makefile +++ b/Robust/src/Benchmarks/disjoint/makefile @@ -3,11 +3,14 @@ BUILDSCRIPT=~/research/Robust/src/buildscript #DEBUGFLAGS= -disjoint-debug-callsite MDRunner t3 100 #DEBUGFLAGS= -disjoint-debug-callsite calcGoodFeature calcGoodFeatureTask 100 #DEBUGFLAGS= -disjoint-debug-callsite getRows calcGoodFeature 4 +#DEBUGFLAGS= -disjoint-debug-callsite setKMeans t3 500 #SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeatureTask 5 10 true #SNAPFLAGS= -disjoint-debug-snap-method calcGoodFeature 5 1 true -BSFLAGS= -recover -justanalyze -disjoint -disjoint-k 1 -disjoint-write-dots final -disjoint-alias-file aliases.txt normal -enable-assertions +#SNAPFLAGS= -disjoint-debug-snap-method t3 5 20 true + +BSFLAGS= -recover -justanalyze -disjoint -disjoint-k 1 -disjoint-write-dots all -disjoint-alias-file aliases.txt normal -enable-assertions all: $(BUILDSCRIPT) $(BSFLAGS) $(DEBUGFLAGS) $(SNAPFLAGS) *.java -- 2.34.1