From 987770f3ac5905bea59315ae40d154a1ccb21179 Mon Sep 17 00:00:00 2001 From: jjenista Date: Tue, 17 Jan 2012 22:58:14 +0000 Subject: [PATCH] fix up summarize-per-class mode --- .../Analysis/Disjoint/DisjointAnalysis.java | 81 ++++++++++++++++--- Robust/src/Benchmarks/oooJava/master-makefile | 12 +-- 2 files changed, 74 insertions(+), 19 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 1e88751b..baa21e2e 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -507,6 +507,11 @@ public class DisjointAnalysis implements HeapAnalysis { protected Hashtable mapFlatNewToAllocSite; + // if using summarize-per-class then use this to keep + // one alloc site per Type (picks up primitives too) + protected Hashtable mapTypeToAllocSite; + protected HashSet typesToFlag; + // maps intergraph heap region IDs to intergraph // allocation sites that created them, a redundant // structure for efficiency in some operations @@ -730,6 +735,11 @@ public class DisjointAnalysis implements HeapAnalysis { new Hashtable(); fc2enclosing = new Hashtable(); + + if( summarizePerClass ) { + mapTypeToAllocSite = new Hashtable(); + typesToFlag = new HashSet(); + } } @@ -873,13 +883,20 @@ public class DisjointAnalysis implements HeapAnalysis { summarizePerClass = true; } - if( suppressOutput ) { System.out.println("* Running disjoint reachability analysis with output suppressed! *"); } allocateStructures(); + + + if( summarizePerClass && sitesToFlag != null ) { + for( FlatNew fnew : sitesToFlag ) { + typesToFlag.add( fnew.getType() ); + } + } + initImplicitStringsModel(); @@ -914,13 +931,13 @@ public class DisjointAnalysis implements HeapAnalysis { } String justtime = String.format("%.2f", dt); System.out.println(treport); - - + + try { if( writeFinalDOTs && !writeAllIncrementalDOTs ) { writeFinalGraphs(); } - + if( state.DISJOINTWRITEIHMS ) { writeFinalIHMs(); } @@ -932,7 +949,7 @@ public class DisjointAnalysis implements HeapAnalysis { if( state.DISJOINT_WRITE_ALL_NODE_FINAL_GRAPHS ) { writeFinalGraphsForEveryNode(); } - + if( state.DISJOINTALIASFILE != null && !suppressOutput ) { if( state.TASK ) { writeAllSharing(state.DISJOINTALIASFILE, treport, justtime, state.DISJOINTALIASTAB, state.lines); @@ -945,23 +962,23 @@ public class DisjointAnalysis implements HeapAnalysis { ); } } - + if( state.RCR ) { buildStateMachines.writeStateMachines(); } - + } catch( IOException e ) { throw new Error("IO Exception while writing disjointness analysis output."); } } - - + + protected boolean moreDescriptorsToVisit() { if( state.DISJOINTDVISITSTACK || state.DISJOINTDVISITSTACKEESONTOP ) { return !descriptorsToVisitStack.isEmpty(); - + } else if( state.DISJOINTDVISITPQUE ) { return !descriptorsToVisitQ.isEmpty(); } @@ -2184,7 +2201,12 @@ public class DisjointAnalysis implements HeapAnalysis { // return just the allocation site associated with one FlatNew node protected AllocSite getAllocSiteFromFlatNewPRIVATE(FlatNew fnew) { + return summarizePerClass ? + getAllocSiteFromFlatNewPRIVATEperClass( fnew ) : + getAllocSiteFromFlatNewPRIVATEperSite( fnew ); + } + protected AllocSite getAllocSiteFromFlatNewPRIVATEperSite(FlatNew fnew) { boolean flagProgrammatically = false; if( sitesToFlag != null && sitesToFlag.contains(fnew) ) { flagProgrammatically = true; @@ -2196,20 +2218,53 @@ public class DisjointAnalysis implements HeapAnalysis { fnew.getDisjointId(), flagProgrammatically ); - + // the newest nodes are single objects for( int i = 0; i < allocationDepth; ++i ) { Integer id = generateUniqueHeapRegionNodeID(); as.setIthOldest(i, id); mapHrnIdToAllocSite.put(id, as); } + + // the oldest node is a summary node + as.setSummary(generateUniqueHeapRegionNodeID() ); + + mapFlatNewToAllocSite.put(fnew, as); + } + return mapFlatNewToAllocSite.get(fnew); + } + + protected AllocSite getAllocSiteFromFlatNewPRIVATEperClass(FlatNew fnew) { + TypeDescriptor type = fnew.getType(); + + boolean flagProgrammatically = typesToFlag.contains( type ); + + if( !mapTypeToAllocSite.containsKey( type ) ) { + AllocSite as = AllocSite.factory(allocationDepth, + fnew, + fnew.getDisjointId(), + flagProgrammatically + ); + + // the newest nodes are single objects + for( int i = 0; i < allocationDepth; ++i ) { + Integer id = generateUniqueHeapRegionNodeID(); + as.setIthOldest(i, id); + mapHrnIdToAllocSite.put(id, as); + } + // the oldest node is a summary node as.setSummary(generateUniqueHeapRegionNodeID() ); - mapFlatNewToAllocSite.put(fnew, as); + mapTypeToAllocSite.put( type, as ); } - + + if( !mapFlatNewToAllocSite.containsKey( fnew ) ) { + AllocSite as = mapTypeToAllocSite.get( type ); + mapFlatNewToAllocSite.put( fnew, as ); + } + return mapFlatNewToAllocSite.get(fnew); } diff --git a/Robust/src/Benchmarks/oooJava/master-makefile b/Robust/src/Benchmarks/oooJava/master-makefile index 669f7a1b..85f3d089 100644 --- a/Robust/src/Benchmarks/oooJava/master-makefile +++ b/Robust/src/Benchmarks/oooJava/master-makefile @@ -78,12 +78,12 @@ DISJOINT= -disjoint -disjoint-k 1 -enable-assertions $(DRELEASEMODE) #-disjoint- # -disjoint-debug-snap-method Remove 10 3 true DISJOINTDEBUG= -disjoint -disjoint-k 1 -enable-assertions $(DRELEASEMODE) \ - -do-definite-reach-analysis \ - -disjoint-disable-global-sweep \ - -disjoint-disable-strong-update \ - -disjoint-disable-predicates \ - -disjoint-summarize-per-class \ - -disjoint-write-dots final + -disjoint-summarize-per-class +# -disjoint-write-dots final +# -do-definite-reach-analysis \ +# -disjoint-disable-global-sweep \ +# -disjoint-disable-strong-update \ +# -disjoint-disable-predicates \ # -disjoint-debug-scheduling # -disjoint-debug-callsite Barneshut.Insert Barneshut.run 50 500 true # -disjoint-debug-snap-method ArrayIndexedGraph.createNode 1 100 true \ -- 2.34.1