}
}
- protected void propagateTokens( HeapRegionNode nPrime,
- ChangeTupleSet c0,
- HashSet<HeapRegionNode> nodesWithNewAlpha,
- HashSet<ReferenceEdgeProperties> edgesWithNewBeta ) {
+ protected void propagateTokensOverNodes( HeapRegionNode nPrime,
+ ChangeTupleSet c0,
+ HashSet<HeapRegionNode> nodesWithNewAlpha,
+ HashSet<ReferenceEdgeProperties> edgesWithNewBeta ) {
HashSet<HeapRegionNode> todoNodes
= new HashSet<HeapRegionNode>();
}
}
+ propagateTokensOverEdges( todoEdges, edgePlannedChanges, nodesWithNewAlpha, edgesWithNewBeta );
+ }
+
+
+ protected void propagateTokensOverEdges(
+ HashSet<ReferenceEdgeProperties> todoEdges,
+ Hashtable<ReferenceEdgeProperties, ChangeTupleSet> edgePlannedChanges,
+ HashSet<HeapRegionNode> nodesWithNewAlpha,
+ HashSet<ReferenceEdgeProperties> edgesWithNewBeta ) {
+
while( !todoEdges.isEmpty() ) {
ReferenceEdgeProperties e = todoEdges.iterator().next();
todoEdges.remove( e );
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<ReferenceEdgeProperties> todoEdges =
+ new HashSet<ReferenceEdgeProperties>();
- propagateTokens( hrnSrc, Cy, nodesWithNewAlpha, edgesWithNewBeta );
+ Hashtable<ReferenceEdgeProperties, ChangeTupleSet> edgePlannedChanges =
+ new Hashtable<ReferenceEdgeProperties, ChangeTupleSet>();
+
+ 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 );
}
}