From 39d2b28e9cb30532d734b381002a10d3e4416adb Mon Sep 17 00:00:00 2001 From: jjenista Date: Wed, 30 Dec 2009 19:07:38 +0000 Subject: [PATCH] working on new implementation --- .../Analysis/Disjoint/DisjointAnalysis.java | 88 +++++++++++-------- Robust/src/Analysis/Disjoint/ReachGraph.java | 25 +++--- Robust/src/Tests/disjoint/simple/test.java | 2 +- 3 files changed, 63 insertions(+), 52 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 94224b13..c6750d08 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -161,7 +161,7 @@ public class DisjointAnalysis { System.out.println( treport ); if( writeFinalDOTs && !writeAllIncrementalDOTs ) { - //writeFinalContextGraphs(); + writeFinalGraphs(); } if( state.DISJOINTALIASFILE != null ) { @@ -350,11 +350,14 @@ public class DisjointAnalysis { // states after the flat method returns ReachGraph completeGraph = new ReachGraph(); + assert !setReturns.isEmpty(); Iterator retItr = setReturns.iterator(); while( retItr.hasNext() ) { FlatReturnNode frn = (FlatReturnNode) retItr.next(); + assert mapFlatNodeToReachGraph.containsKey( frn ); ReachGraph rgRet = mapFlatNodeToReachGraph.get( frn ); + completeGraph.merge( rgRet ); } @@ -363,11 +366,11 @@ public class DisjointAnalysis { protected void - analyzeFlatNode( Descriptor d, - FlatMethod fmContaining, - FlatNode fn, + analyzeFlatNode( Descriptor d, + FlatMethod fmContaining, + FlatNode fn, HashSet setRetNodes, - ReachGraph rg + ReachGraph rg ) throws java.io.IOException { @@ -379,8 +382,8 @@ public class DisjointAnalysis { // rg.nullifyDeadVars( liveness.getLiveInTemps( fmContaining, fn ) ); - TempDescriptor lhs; - TempDescriptor rhs; + TempDescriptor lhs; + TempDescriptor rhs; FieldDescriptor fld; // use node type to decide what transfer function @@ -617,29 +620,27 @@ public class DisjointAnalysis { } - /* - private void writeFinalContextGraphs() { - Set entrySet = mapDescriptorToCompleteReachabilityGraph.entrySet(); + + private void writeFinalGraphs() { + Set entrySet = mapDescriptorToCompleteReachGraph.entrySet(); Iterator itr = entrySet.iterator(); while( itr.hasNext() ) { - Map.Entry me = (Map.Entry) itr.next(); - Descriptor mc = (Descriptor) me.getKey(); - ReachabilityGraph og = (ReachabilityGraph) me.getValue(); - - try { - og.writeGraph(mc+"COMPLETE", - true, // write labels (variables) - true, // selectively hide intermediate temp vars - true, // prune unreachable heap regions - false, // show back edges to confirm graph validity - false, // show parameter indices (unmaintained!) - true, // hide subset reachability states - true); // hide edge taints + Map.Entry me = (Map.Entry) itr.next(); + Descriptor d = (Descriptor) me.getKey(); + ReachGraph rg = (ReachGraph) me.getValue(); + + try { + rg.writeGraph( d+"COMPLETE", + true, // write labels (variables) + true, // selectively hide intermediate temp vars + true, // prune unreachable heap regions + false, // show back edges to confirm graph validity + true, // hide subset reachability states + true ); // hide edge taints } catch( IOException e ) {} } } - - */ + // return just the allocation site associated with one FlatNew node protected AllocSite getAllocSiteFromFlatNewPRIVATE( FlatNew fnew ) { @@ -933,29 +934,40 @@ public class DisjointAnalysis { "analysisEntryMethod" ); - TempDescriptor cmdLineArgs = new TempDescriptor( "args" ); - - FlatNew fn = new FlatNew( mdSourceEntry.getParamType( 0 ), - cmdLineArgs, - false // is global - ); + TempDescriptor cmdLineArgs = + new TempDescriptor( "args", + mdSourceEntry.getParamType( 0 ) + ); + + FlatNew fn = + new FlatNew( mdSourceEntry.getParamType( 0 ), + cmdLineArgs, + false // is global + ); TempDescriptor[] sourceEntryArgs = new TempDescriptor[1]; sourceEntryArgs[0] = cmdLineArgs; - FlatCall fc = new FlatCall( mdSourceEntry, - null, // dst temp - null, // this temp - sourceEntryArgs - ); + FlatCall fc = + new FlatCall( mdSourceEntry, + null, // dst temp + null, // this temp + sourceEntryArgs + ); + + FlatReturnNode frn = new FlatReturnNode( null ); FlatExit fe = new FlatExit(); - this.fmAnalysisEntry = new FlatMethod( mdAnalysisEntry, fe ); + this.fmAnalysisEntry = + new FlatMethod( mdAnalysisEntry, + fe + ); this.fmAnalysisEntry.addNext( fn ); fn.addNext( fc ); - fc.addNext( fe ); + fc.addNext( frn ); + frn.addNext( fe ); } diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java index 7a8bd5e8..6c6c5fdc 100644 --- a/Robust/src/Analysis/Disjoint/ReachGraph.java +++ b/Robust/src/Analysis/Disjoint/ReachGraph.java @@ -127,7 +127,7 @@ public class ReachGraph { // Low-level referencee and referencer methods // // These methods provide the lowest level for - // creating references between ownership nodes + // creating references between reachability nodes // and handling the details of maintaining both // list of referencers and referencees. // @@ -573,7 +573,7 @@ public class ReachGraph { public void assignTempEqualToNewAlloc( TempDescriptor x, - AllocSite as ) { + AllocSite as ) { assert x != null; assert as != null; @@ -607,15 +607,15 @@ public class ReachGraph { // use the allocation site (unique to entire analysis) to - // locate the heap region nodes in this ownership graph + // locate the heap region nodes in this reachability graph // that should be aged. The process models the allocation // of new objects and collects all the oldest allocations // in a summary node to allow for a finite analysis // // There is an additional property of this method. After - // running it on a particular ownership graph (many graphs + // running it on a particular reachability graph (many graphs // may have heap regions related to the same allocation site) - // the heap region node objects in this ownership graph will be + // the heap region node objects in this reachability graph will be // allocated. Therefore, after aging a graph for an allocation // site, attempts to retrieve the heap region nodes using the // integer id's contained in the allocation site should always @@ -628,7 +628,7 @@ public class ReachGraph { allocSites.add( as ); // get the summary node for the allocation site in the context - // of this particular ownership graph + // of this particular reachability graph HeapRegionNode hrnSummary = getSummaryNode( as ); // merge oldest node into summary @@ -713,11 +713,11 @@ public class ReachGraph { HeapRegionNode hrnSummary = id2hrn.get( idSummary ); // If this is null then we haven't touched this allocation site - // in the context of the current ownership graph, so allocate + // in the context of the current reachability graph, so allocate // heap region nodes appropriate for the entire allocation site. - // This should only happen once per ownership graph per allocation site, + // This should only happen once per reachability graph per allocation site, // and a particular integer id can be used to locate the heap region - // in different ownership graphs that represents the same part of an + // in different reachability graphs that represents the same part of an // allocation site. if( hrnSummary == null ) { @@ -1076,7 +1076,7 @@ public class ReachGraph { public void resolveMethodCall(FlatCall fc, // call site in caller method boolean isStatic, // whether it is a static method FlatMethod fm, // the callee method (when virtual, can be many) - ReachGraph ogCallee, // the callee's current ownership graph + ReachGraph ogCallee, // the callee's current reachability graph MethodContext mc, // the aliasing context for this call ParameterDecomposition pd // if this is not null, we're calling after analysis ) { @@ -1942,12 +1942,12 @@ public class ReachGraph { // only address this edge if it is not a special initial edge if( !edgeCallee.isInitialParam() ) { - // now we know that in the callee method's ownership graph + // now we know that in the callee method's reachability graph // there is a heap region->heap region reference edge given // by heap region pointers: // hrnCallee -> heapChildCallee // - // or by the ownership-graph independent ID's: + // or by the reachability-graph independent ID's: // idCallee -> idChildCallee // make the edge with src and dst so beta info is @@ -3362,7 +3362,6 @@ public class ReachGraph { boolean labelSelect, boolean pruneGarbage, boolean writeReferencers, - boolean writeParamMappings, boolean hideSubsetReachability, boolean hideEdgeTaints ) throws java.io.IOException { diff --git a/Robust/src/Tests/disjoint/simple/test.java b/Robust/src/Tests/disjoint/simple/test.java index 3d271637..df62d233 100644 --- a/Robust/src/Tests/disjoint/simple/test.java +++ b/Robust/src/Tests/disjoint/simple/test.java @@ -2,7 +2,7 @@ public class Test { static public void main( String[] args ) { f1(); } - + static public void f1() { } } -- 2.34.1