import java.util.*;
public class LabelNode extends OwnershipNode {
+ protected TempDescriptor td;
public LabelNode( TempDescriptor td ) {
this.td = td;
}
-
- /////////////////
- // equality
- /////////////////
- protected TempDescriptor td;
-
public TempDescriptor getTempDescriptor() {
return td;
}
- public boolean equals( LabelNode ln ) {
- assert ln != null;
+ public boolean equals( Object o ) {
+
+ if( !( o instanceof LabelNode) ) {
+ return false;
+ }
+
+ LabelNode ln = (LabelNode) o;
+
return td == ln.getTempDescriptor();
}
- /////////////////
- // end equality
- /////////////////
+ public int hashCode() {
+ return td.getNum();
+ }
- // for writing out
public String getTempDescriptorString() {
return td.toString();
}
}
}
+
protected void propagateTokensOverNodes( HeapRegionNode nPrime,
ChangeTupleSet c0,
HashSet<HeapRegionNode> nodesWithNewAlpha,
- HashSet<ReferenceEdgeProperties> edgesWithNewBeta ) {
+ HashSet<ReferenceEdgeProperties> edgesWithNewBeta ) {
HashSet<HeapRegionNode> todoNodes
= new HashSet<HeapRegionNode>();
Hashtable<ReferenceEdgeProperties, ChangeTupleSet> edgePlannedChanges
= new Hashtable<ReferenceEdgeProperties, ChangeTupleSet>();
- Hashtable<HeapRegionNode, ChangeTupleSet> nodeChangesMade
- = new Hashtable<HeapRegionNode, ChangeTupleSet>();
while( !todoNodes.isEmpty() ) {
- HeapRegionNode n = todoNodes.iterator().next();
- todoNodes.remove( n );
-
+ HeapRegionNode n = todoNodes.iterator().next();
ChangeTupleSet C = nodePlannedChanges.get( n );
- if( !nodeChangesMade.containsKey( n ) ) {
- nodeChangesMade.put( n, new ChangeTupleSet().makeCanonical() );
- }
-
Iterator itrC = C.iterator();
while( itrC.hasNext() ) {
ChangeTuple c = (ChangeTuple) itrC.next();
ReachabilitySet withChange = n.getAlpha().union( c.getSetToAdd() );
n.setAlphaNew( n.getAlphaNew().union( withChange ) );
nodesWithNewAlpha.add( n );
- nodeChangesMade.put( n, nodeChangesMade.get( n ).union( c ) );
}
}
- ChangeTupleSet Cprime = nodeChangesMade.get( n );
-
Iterator referItr = n.iteratorToReferencers();
while( referItr.hasNext() ) {
OwnershipNode on = (OwnershipNode) referItr.next();
edgePlannedChanges.put( rep, new ChangeTupleSet().makeCanonical() );
}
- edgePlannedChanges.put( rep, edgePlannedChanges.get( rep ).union( Cprime ) );
+ edgePlannedChanges.put( rep, edgePlannedChanges.get( rep ).union( C ) );
}
HeapRegionNode m = null;
ChangeTupleSet changesToPass = new ChangeTupleSet().makeCanonical();
- Iterator itrCprime = Cprime.iterator();
+ Iterator itrCprime = C.iterator();
while( itrCprime.hasNext() ) {
ChangeTuple c = (ChangeTuple) itrCprime.next();
if( f.getBeta().contains( c.getSetToMatch() ) ) {
ChangeTupleSet currentChanges = nodePlannedChanges.get( m );
if( !changesToPass.isSubset( currentChanges ) ) {
- todoNodes.add( m );
+
nodePlannedChanges.put( m, currentChanges.union( changesToPass ) );
+ todoNodes.add( m );
}
}
}
+
+ todoNodes.remove( n );
}
propagateTokensOverEdges( todoEdges, edgePlannedChanges, nodesWithNewAlpha, edgesWithNewBeta );