From 5a0a8a1484e94e37db913d6c816b1513a5abccad Mon Sep 17 00:00:00 2001 From: jjenista Date: Mon, 18 Aug 2008 19:46:54 +0000 Subject: [PATCH] Heap regions with no reachability token need to have the empty reachability set in order for other token operations to work. --- .../OwnershipAnalysis/OwnershipAnalysis.java | 2 +- .../OwnershipAnalysis/OwnershipGraph.java | 33 ++++++++++++------- .../OwnershipAnalysis/ReferenceEdge.java | 6 ++++ .../OwnershipAnalysisTest/test01/makefile | 2 +- .../OwnershipAnalysisTest/test01/test01.java | 29 +++++++++++++--- 5 files changed, 54 insertions(+), 18 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java index b9ca6096..ae271ff8 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java @@ -310,7 +310,7 @@ public class OwnershipAnalysis { boolean pruneGarbage, boolean writeReferencers */ - og.writeGraph( d, true, true, true, false ); + og.writeGraph( d, true, true, false, false ); // only methods have dependents, tasks cannot // be invoked by any user program calls diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 43e27528..334663ed 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -78,9 +78,11 @@ public class OwnershipGraph { if( isFlagged || isParameter ) { alpha = new ReachabilitySet( new TokenTuple( id, isNewSummary, - TokenTuple.ARITY_ONE ) ); + TokenTuple.ARITY_ONE ) + ).makeCanonical(); } else { - alpha = new ReachabilitySet(); + alpha = new ReachabilitySet( new TokenTupleSet() + ).makeCanonical(); } } @@ -451,11 +453,14 @@ public class OwnershipGraph { ); if( f != null ) { // we can do a strong update here if one of two cases holds + // SAVE FOR LATER, WITHOUT STILL CORRECT + /* if( (hrnX.getNumReferencers() == 1) || ( lnX.getNumReferencees() == 1 && hrnX.isSingleObject() ) ) { clearReferenceEdgesFrom( hrnX, f, false ); } + */ addReferenceEdge( hrnX, hrnY, edgeNew ); @@ -648,12 +653,17 @@ public class OwnershipGraph { // after tokens have been aged, reset newest node's reachability - hrn0.setAlpha( new ReachabilitySet( - new TokenTupleSet( - new TokenTuple( hrn0 ) - ) - ).makeCanonical() - ); + if( hrn0.isFlagged() ) { + hrn0.setAlpha( new ReachabilitySet( new TokenTupleSet( + new TokenTuple( hrn0 ) + ) + ).makeCanonical() + ); + } else { + hrn0.setAlpha( new ReachabilitySet( new TokenTupleSet() + ).makeCanonical() + ); + } } @@ -1467,12 +1477,11 @@ public class OwnershipGraph { // there is an edge in the right place with the right field, // but do they have the same attributes? - if( edgeA.isInitialParamReflexive() == edgeB.isInitialParamReflexive() && - edgeA.getBeta().equals( edgeB.getBeta() ) ) { + if( edgeA.getBeta().equals( edgeB.getBeta() ) ) { edgeFound = true; - } else { - return false; + //} else { + //return false; } } } diff --git a/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java b/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java index 81e557b0..68a38cd8 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java +++ b/Robust/src/Analysis/OwnershipAnalysis/ReferenceEdge.java @@ -76,6 +76,12 @@ public class ReferenceEdge { return true; } + + public boolean equalsIncludingBeta( ReferenceEdge edge ) { + return equals( edge ) && beta.equals( edge.beta ); + } + + public int hashCode() { int hash = 0; diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile b/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile index 65cc0bbd..6875fa03 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/makefile @@ -8,7 +8,7 @@ BSFLAGS= -recover -flatirtasks -ownership -enable-assertions all: $(PROGRAM).bin view: PNGs - eog *.png + eog *.png & PNGs: DOTs d2p *COMPLETE*.dot diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java index 0213b85a..e380fb52 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java @@ -2,7 +2,8 @@ public class Parameter { flag w; int a, b; Parameter f, g; - Penguin penguin; + Penguin p; + Foo h; public Parameter() { a = 0; b = 0; f = null; g = null; } @@ -12,6 +13,7 @@ public class Parameter { public class Penguin { int x, y; + Foo h; public Penguin() { x = 0; y = 0; } @@ -94,8 +96,10 @@ task NewObjectC( Foo a{ f }, Foo b{ f } ) { Foo c; while( false ) { - c = new Foo(); - c.x = new Foo(); + c = new Foo(); + Foo f = new Foo(); + c.x = f; + c.y = f; } taskexit( a{ !f }, b{ !f } ); @@ -103,7 +107,6 @@ task NewObjectC( Foo a{ f }, Foo b{ f } ) { - // this task allocates a new object, so there should // be a heap region for the parameter, and several // heap regions for the allocation site, but the label @@ -124,6 +127,24 @@ task ClobberInitParamReflex( Voo v{ f }, Voo w{ f } ) { } +task BackToItself( Parameter p0{ w } ) { + + Penguin p = new Penguin(); + p0.p = p; + p.h = p0.h; + + while( false ) { + Parameter p1 = new Parameter(); + p1.h = new Foo(); + Penguin q = new Penguin(); + p1.p = q; + q.h = p1.h; + } + + taskexit( p0{ !w } ); +} + + task SummaryNodeTokens( Foo p0{ f } ) { while( false ) { -- 2.34.1