From f18e9cf1a3699c2ac42d2454546bb930262372b9 Mon Sep 17 00:00:00 2001 From: jjenista Date: Mon, 4 Aug 2008 23:09:09 +0000 Subject: [PATCH] Fixed x.f = y operation --- .../OwnershipAnalysis/OwnershipGraph.java | 55 ++++++++++++++++--- .../OwnershipAnalysisTest/test01/test01.java | 27 +++++---- 2 files changed, 63 insertions(+), 19 deletions(-) diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 7010de5b..69db25c2 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -157,10 +157,10 @@ public class OwnershipGraph { } } - protected void propagateTokens( HeapRegionNode nPrime, - ChangeTupleSet c0, - HashSet nodesWithNewAlpha, - HashSet edgesWithNewBeta ) { + protected void propagateTokensOverNodes( HeapRegionNode nPrime, + ChangeTupleSet c0, + HashSet nodesWithNewAlpha, + HashSet edgesWithNewBeta ) { HashSet todoNodes = new HashSet(); @@ -249,7 +249,17 @@ public class OwnershipGraph { } } + propagateTokensOverEdges( todoEdges, edgePlannedChanges, nodesWithNewAlpha, edgesWithNewBeta ); + } + + + protected void propagateTokensOverEdges( + HashSet todoEdges, + Hashtable edgePlannedChanges, + HashSet nodesWithNewAlpha, + HashSet edgesWithNewBeta ) { + while( !todoEdges.isEmpty() ) { ReferenceEdgeProperties e = todoEdges.iterator().next(); todoEdges.remove( e ); @@ -400,14 +410,41 @@ public class OwnershipGraph { ReachabilitySet O = srcln.getReferenceTo( hrnSrc ).getBeta(); - ReferenceEdgeProperties repNew - = new ReferenceEdgeProperties( false, false, repSrc.getBeta() ); - - addReferenceEdge( hrn, hrnSrc, repNew ); + // propagate tokens over nodes starting from hrnSrc, and it will + // take care of propagating back up edges from any touched nodes ChangeTupleSet Cy = O.unionUpArityToChangeSet( R ); + propagateTokensOverNodes( hrnSrc, Cy, nodesWithNewAlpha, edgesWithNewBeta ); + + + // then propagate back just up the edges from hrn + ChangeTupleSet Cx = R.unionUpArityToChangeSet( O ); + + HashSet todoEdges = + new HashSet(); - propagateTokens( hrnSrc, Cy, nodesWithNewAlpha, edgesWithNewBeta ); + Hashtable edgePlannedChanges = + new Hashtable(); + + Iterator referItr = hrn.iteratorToReferencers(); + while( referItr.hasNext() ) { + OwnershipNode onRef = (OwnershipNode) referItr.next(); + ReferenceEdgeProperties repUpstream = onRef.getReferenceTo( hrn ); + + todoEdges.add( repUpstream ); + edgePlannedChanges.put( repUpstream, Cx ); + } + + propagateTokensOverEdges( todoEdges, + edgePlannedChanges, + nodesWithNewAlpha, + edgesWithNewBeta ); + + // finally, create the actual reference edge hrn->hrnSrc + ReferenceEdgeProperties repNew + = new ReferenceEdgeProperties( false, false, repSrc.getBetaNew() ); + + addReferenceEdge( hrn, hrnSrc, repNew ); } } diff --git a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java index c616953a..b71138e1 100644 --- a/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java +++ b/Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java @@ -57,18 +57,12 @@ task Startup( StartupObject s{ initialstate } ) { while( false ) { Foo a = new Foo(); a.x = new Foo(); - a.x.x = new Foo(); - } - - - Foo b; - while( false ) { - Foo c = new Foo(); - c.x = b; - b = c; + a.x.x = new Foo(); + + //Foo z = a.x; + //z.x = new Foo(); } - Foo d = new Foo(); Foo e = new Foo(); Foo f = new Foo(); @@ -76,6 +70,19 @@ task Startup( StartupObject s{ initialstate } ) { d.x = e; e.x = f; + // to look like Foo a above + //d.x.x = f; + + + /* + Foo b; + while( false ) { + Foo c = new Foo(); + c.x = b; + b = c; + } + */ + taskexit( s{ !initialstate } ); } -- 2.34.1