hrn.setAlpha(hrn.getAlpha().ageTokens(as) );
}
- protected void majorAgeTokens(AllocationSite as, ReferenceEdge edge) {
- //edge.setBeta( edge.getBeta().majorAgeTokens( as ) );
- }
-
- protected void majorAgeTokens(AllocationSite as, HeapRegionNode hrn) {
- //hrn.setAlpha( hrn.getAlpha().majorAgeTokens( as ) );
- }
-
public void resolveMethodCall(FlatCall fc,
boolean isStatic,
assert ogCallee.id2hrn.containsKey( idParam );
HeapRegionNode hrnParam = ogCallee.id2hrn.get( idParam );
assert hrnParam != null;
- paramIndex2rewriteH.put( paramIndex, hrnParam.getAlpha() );
+ paramIndex2rewriteH.put( paramIndex,
+ toShadowTokens( ogCallee, hrnParam.getAlpha() )
+ );
ReferenceEdge edgeReflexive_i = hrnParam.getReferenceTo( hrnParam, null );
assert edgeReflexive_i != null;
- paramIndex2rewriteJ.put( paramIndex, edgeReflexive_i.getBeta() );
+ paramIndex2rewriteJ.put( paramIndex,
+ toShadowTokens( ogCallee, edgeReflexive_i.getBeta() )
+ );
TempDescriptor tdParamQ = ogCallee.paramIndex2tdQ.get( paramIndex );
assert tdParamQ != null;
assert lnParamQ != null;
ReferenceEdge edgeSpecialQ_i = lnParamQ.getReferenceTo( hrnParam, null );
assert edgeSpecialQ_i != null;
- paramIndex2rewriteK.put( paramIndex, edgeSpecialQ_i.getBeta() );
+ paramIndex2rewriteK.put( paramIndex,
+ toShadowTokens( ogCallee, edgeSpecialQ_i.getBeta() )
+ );
TokenTuple p_i = new TokenTuple( hrnParam.getID(),
true,
// then bring g_ij onto g'_ij and rewrite
transferOnto( hrnSummary, hrnShadowSummary );
- // TODO REPLACE NORMAL TOKEN WITH SHADOW TOKEN BEFORE PROCEEDING!!
+ hrnShadowSummary.setAlpha( toShadowTokens( ogCallee, hrnShadowSummary.getAlpha() ) );
// shadow nodes only are touched by a rewrite one time,
// so rewrite and immediately commit--and they don't belong
assert hrnIthShadow.getNumReferencees() == 0;
transferOnto( hrnIth, hrnIthShadow );
+
+ hrnIthShadow.setAlpha( toShadowTokens( ogCallee, hrnIthShadow.getAlpha() ) );
rewriteCallerNodeAlpha( fm.numParameters(),
bogusIndex,
null,
edgeCallee.getFieldDesc(),
false,
- edgeCallee.getBeta() );
+ toShadowTokens( ogCallee, edgeCallee.getBeta() )
+ );
rewriteCallerEdgeBeta( fm.numParameters(),
bogusIndex,
edgeNewInCallerTemplate,
}
+ private ReachabilitySet toShadowTokens( OwnershipGraph ogCallee,
+ ReachabilitySet rsIn ) {
+
+ ReachabilitySet rsOut = new ReachabilitySet( rsIn );
+
+ Iterator<AllocationSite> allocItr = ogCallee.allocationSites.iterator();
+ while( allocItr.hasNext() ) {
+ AllocationSite as = allocItr.next();
+
+ rsOut = rsOut.toShadowTokens( as );
+ }
+
+ return rsOut.makeCanonical();
+ }
+
+
private void rewriteCallerNodeAlpha( int numParameters,
Integer paramIndex,
HeapRegionNode hrn,
}
+ protected void majorAgeTokens(AllocationSite as, ReferenceEdge edge) {
+ //edge.setBeta( edge.getBeta().majorAgeTokens( as ) );
+ }
+
+ protected void majorAgeTokens(AllocationSite as, HeapRegionNode hrn) {
+ //hrn.setAlpha( hrn.getAlpha().majorAgeTokens( as ) );
+ }
+
+
////////////////////////////////////////////////////
// in merge() and equals() methods the suffix A
}
+ public TokenTupleSet toShadowTokens(AllocationSite as) {
+ assert as != null;
+
+ TokenTupleSet ttsOut = new TokenTupleSet();
+
+ Iterator itrT = this.iterator();
+ while( itrT.hasNext() ) {
+ TokenTuple tt = (TokenTuple) itrT.next();
+
+ Integer token = tt.getToken();
+ int age = as.getAge(token);
+
+ // summary tokens and tokens not associated with
+ // the site should be left alone
+ if( age == AllocationSite.AGE_notInThisSite ) {
+ ttsOut.tokenTuples.add(tt);
+
+ } else if( age == AllocationSite.AGE_summary ) {
+ ttsOut.tokenTuples.add(tt.changeTokenTo( as.getSummaryShadow() ));
+
+ } else if( age == AllocationSite.AGE_oldest ) {
+ ttsOut.tokenTuples.add(tt.changeTokenTo( as.getOldestShadow() ));
+
+ } else {
+ ttsOut.tokenTuples.add(tt.changeTokenTo( as.getIthOldestShadow( age ) ));
+ }
+ }
+
+ return ttsOut.makeCanonical();
+ }
+
+
public ReachabilitySet rewriteToken( TokenTuple tokenToRewrite,
ReachabilitySet replacements,
boolean makeChangeSet,