}
}
- 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 );
- ChangeTupleSet Cy = O.unionUpArityToChangeSet( R );
- //ChangeTupleSet Cx = R.unionUpArityToChangeSet( O );
+ HashSet<ReferenceEdgeProperties> todoEdges =
+ new HashSet<ReferenceEdgeProperties>();
- propagateTokens( hrnSrc, Cy, nodesWithNewAlpha, edgesWithNewBeta );
- //propagateTokens( hrn, Cx, nodesWithNewAlpha, edgesWithNewBeta );
+ Hashtable<ReferenceEdgeProperties, ChangeTupleSet> edgePlannedChanges =
+ new Hashtable<ReferenceEdgeProperties, ChangeTupleSet>();
- /*
- // note that this picks up the beta after the propogation has
- // been applied
+ 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 );
- */
}
}
Map.Entry me = (Map.Entry) itrReferencee.next();
hrnReferencee = (HeapRegionNode) me.getKey();
ReferenceEdgeProperties rep = (ReferenceEdgeProperties) me.getValue();
-
- // determine if another summary node is already referencing this referencee
- /*
- boolean hasSummaryReferencer = false;
- OwnershipNode onReferencer = null;
- Iterator itrReferencer = hrnReferencee.iteratorToReferencers();
- while( itrReferencer.hasNext() ) {
- onReferencer = (OwnershipNode) itrReferencer.next();
- if( onReferencer instanceof HeapRegionNode ) {
- HeapRegionNode hrnPossibleSummary = (HeapRegionNode) onReferencer;
- if( hrnPossibleSummary.isNewSummary() ) {
- hasSummaryReferencer = true;
- }
- }
- }
-
- addReferenceEdge( hrnSummary,
- hrnReferencee,
- new ReferenceEdgeProperties( !hasSummaryReferencer ) );
- */
ReferenceEdgeProperties repSummary = hrnSummary.getReferenceTo( hrnReferencee );
ReferenceEdgeProperties repMerged = rep.copy();
addReferenceEdge( onReferencer, hrnSummary, repMerged );
}
+ // then merge alpha_k reachability into alpha_s
+ hrnSummary.setAlpha( hrnSummary.getAlpha().union( hrnK.getAlpha() ) );
+
// then move down the line of heap region nodes
// clobbering the ith and transferring all references
addReferenceEdge( onReferencer, hrnI, rep.copy() );
}
+
+ // replace hrnI reachability with hrnImin1
+ hrnI.setAlpha( hrnImin1.getAlpha() );
}
// as stated above, the newest node alpha_0 should have had its
// have touched this node, therefore assert it is non-null
assert hrn0 != null;
+
// clear all references in and out of newest node
clearReferenceEdgesFrom( hrn0 );
clearReferenceEdgesTo ( hrn0 );
+
- /*
// now tokens in reachability sets need to "age" as well
ReferenceEdgeProperties repToAge = null;
Iterator itrAllLabelNodes = td2ln.entrySet().iterator();
ageTokens( as, repToAge );
}
}
-
HeapRegionNode hrnToAge = null;
Iterator itrAllHRNodes = id2hrn.entrySet().iterator();
while( itrAllHRNodes.hasNext() ) {
ageTokens( as, repToAge );
}
}
- */
-
+
+
+ // after tokens have been aged, reset newest node's reachability
+ hrn0.setAlpha( new ReachabilitySet(
+ new TokenTupleSet(
+ new TokenTuple( hrn0 )
+ )
+ ).makeCanonical()
+ );
}
protected void ageTokens( AllocationSite as, ReferenceEdgeProperties rep ) {
//System.out.println( "idCallee is "+idCallee );
//System.out.println( "idChildCallee is "+idChildCallee );
- try {
- writeGraph( "caller", false, false );
- ogCallee.writeGraph( "callee", false, false );
+ try {
+ writeGraph( "caller", false, false, false );
+ ogCallee.writeGraph( "callee", false, false, false );
} catch( IOException e ) {}
}
public void writeGraph( Descriptor methodDesc,
FlatNode fn,
boolean writeLabels,
+ boolean labelSelect,
boolean writeReferencers
) throws java.io.IOException {
writeGraph(
methodDesc.getNum() +
fn.toString(),
writeLabels,
+ labelSelect,
writeReferencers
);
}
+ public void writeGraph( Descriptor methodDesc,
+ FlatNode fn,
+ boolean writeLabels,
+ boolean writeReferencers
+ ) throws java.io.IOException {
+ writeGraph(
+ methodDesc.getSymbol() +
+ methodDesc.getNum() +
+ fn.toString(),
+ writeLabels,
+ false,
+ writeReferencers
+ );
+ }
+
+ public void writeGraph( Descriptor methodDesc,
+ boolean writeLabels,
+ boolean writeReferencers
+ ) throws java.io.IOException {
+ writeGraph(
+ methodDesc.getSymbol() +
+ methodDesc.getNum() +
+ "COMPLETE",
+ writeLabels,
+ false,
+ writeReferencers
+ );
+ }
+
public void writeGraph( Descriptor methodDesc,
boolean writeLabels,
+ boolean labelSelect,
boolean writeReferencers
) throws java.io.IOException {
writeGraph(
methodDesc.getNum() +
"COMPLETE",
writeLabels,
+ labelSelect,
writeReferencers
);
}
public void writeGraph( String graphName,
boolean writeLabels,
+ boolean labelSelect,
boolean writeReferencers
) throws java.io.IOException {
Map.Entry me = (Map.Entry) i.next();
LabelNode ln = (LabelNode) me.getValue();
+ if( labelSelect ) {
+ String labelStr = ln.getTempDescriptorString();
+ if( labelStr.startsWith( "___temp" ) ||
+ labelStr.startsWith( "___dst" ) ||
+ labelStr.startsWith( "___srctmp" ) ||
+ labelStr.startsWith( "___neverused" ) ) {
+ continue;
+ }
+ }
+
HeapRegionNode hrn = null;
Iterator heapRegionsItr = ln.setIteratorToReferencedRegions();
while( heapRegionsItr.hasNext() ) {