From 11fd8f37c8f688098163d3668789b4c267daa728 Mon Sep 17 00:00:00 2001 From: jjenista Date: Fri, 22 Feb 2008 00:15:12 +0000 Subject: [PATCH] Capture stable point. --- .../OwnershipAnalysis/OwnershipAnalysis.java | 38 +++++++++++++++++-- .../OwnershipAnalysis/OwnershipGraph.java | 20 +++++++++- .../OwnershipAnalysisTest/test01/makefile | 5 ++- .../OwnershipAnalysisTest/test01/test01.java | 10 +++++ 4 files changed, 66 insertions(+), 7 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java index d9d362cf..86eafa5d 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java @@ -50,12 +50,12 @@ public class OwnershipAnalysis { mapDescriptorToCompleteOwnershipGraph = new Hashtable(); - // initialize methods to visit as the set of - // all tasks + // initialize methods to visit as the set of all tasks descriptorsToVisit = new HashSet(); Iterator taskItr = state.getTaskSymbolTable().getDescriptorsIterator(); while( taskItr.hasNext() ) { - descriptorsToVisit.add( (Descriptor) taskItr.next() ); + Descriptor d = (Descriptor) taskItr.next(); + descriptorsToVisit.add( d ); } // as mentioned above, analyze methods one-by-one, possibly revisiting @@ -64,6 +64,38 @@ public class OwnershipAnalysis { } private void analyzeMethods() throws java.io.IOException { + + while( !descriptorsToVisit.isEmpty() ) { + Descriptor d = (Descriptor) descriptorsToVisit.iterator().next(); + descriptorsToVisit.remove( d ); + + System.out.println( "Analyzing " + d ); + + // because the task or method descriptor just extracted + // in the "to visit" set it either hasn't been analyzed + // yet, or some method that it depends on has been + // updated. Recompute a complete ownership graph for + // this task/method and compare it to any previous result. + // If there is a change detected, add any methods/tasks + // that depend on this one to the "to visit" set. + OwnershipGraph og = new OwnershipGraph( allocationDepth ); + + + OwnershipGraph ogPrev = mapDescriptorToCompleteOwnershipGraph.get( d ); + + if( !og.equals( ogPrev ) ) { + + mapDescriptorToCompleteOwnershipGraph.put( d, og ); + + // only methods have dependents, tasks cannot + // be invoked by any user program calls + if( d instanceof MethodDescriptor ) { + MethodDescriptor md = (MethodDescriptor) d; + Set dependents = callGraph.getCallerSet( md ); + descriptorsToVisit.addAll( dependents ); + } + } + } /* diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 069425ec..b936ce21 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -25,9 +25,11 @@ public class OwnershipGraph { protected int newDepthK; public Hashtable fn2nc; - + */ public OwnershipGraph( int newDepthK ) { + + /* id2hrn = new Hashtable(); heapRoots = new Hashtable(); @@ -39,9 +41,11 @@ public class OwnershipGraph { this.newDepthK = newDepthK; fn2nc = new Hashtable(); + */ } + /* protected void addReferenceEdge( OwnershipNode referencer, HeapRegionNode referencee, ReferenceEdgeProperties rep ) { @@ -313,6 +317,11 @@ public class OwnershipGraph { //////////////////////////////////////////////////// public void merge( OwnershipGraph og ) { + + if( og == null ) { + return; + } + mergeOwnershipNodes ( og ); mergeReferenceEdges ( og ); mergeHeapRoots ( og ); @@ -527,7 +536,7 @@ public class OwnershipGraph { } } } - + */ // it is necessary in the equals() member functions @@ -541,7 +550,12 @@ public class OwnershipGraph { // are equally present is to iterate over both data // structures and compare against the other graph. public boolean equals( OwnershipGraph og ) { + + if( og == null ) { + return false; + } + /* if( !areHeapRegionNodesEqual( og ) ) { return false; } @@ -569,10 +583,12 @@ public class OwnershipGraph { if( !areNewClustersEqual( og ) ) { return false; } + */ return true; } + /* protected boolean areHeapRegionNodesEqual( OwnershipGraph og ) { // check all nodes in A for presence in graph B Set sA = og.id2hrn.entrySet(); diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile b/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile index f2df2c13..63f284cc 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile @@ -3,9 +3,10 @@ PROGRAM=test01 SOURCE_FILES=test01.java BUILDSCRIPT=~/research/Robust/src/buildscript -BSFLAGS= -recover -flatirtasks -ownership -enable-assertions +#BSFLAGS= -recover -flatirtasks -ownership -enable-assertions +BSFLAGS= -recover -ownership -enable-assertions -all: $(PROGRAM).bin #view +all: $(PROGRAM).bin view: PNGs eog *flatIRGraph*.png & diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java index 9910cd5b..b08e4211 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java @@ -5,6 +5,8 @@ public class Parameter { public Parameter() { a = 0; b = 0; f = null; g = null; } + + public void foo() { a = 1; } } task Startup( StartupObject s{ initialstate } ) { @@ -13,6 +15,12 @@ task Startup( StartupObject s{ initialstate } ) { taskexit( s{ !initialstate } ); } +task DoStuff( Parameter p{!w} ) { + p.foo(); + + taskexit( p{w} ); +} + /* task aliasFromObjectAssignment ( Parameter p1{!w}, Parameter p2{!w} ) { @@ -118,6 +126,7 @@ task literalTest( Parameter p1{!w} ) { } */ +/* task newNoAlias ( Parameter p1{!w}, Parameter p2{!w} ) { @@ -146,3 +155,4 @@ task newPossibleAlias taskexit( p1{w}, p2{w} ); } +*/ -- 2.34.1