From: jjenista Date: Mon, 25 Aug 2008 20:05:04 +0000 (+0000) Subject: for method calls, all reachability sets brought into the caller need to have a callee... X-Git-Tag: buildscript^6~81 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=13259bcd0608e093a8653d206689ea0c52e3485a;p=IRC.git for method calls, all reachability sets brought into the caller need to have a callee-allocation-tokens-to-shadow-tokens pass --- diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java index 96a85dc9..82fde788 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipGraph.java @@ -860,14 +860,6 @@ public class OwnershipGraph { 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, @@ -935,11 +927,15 @@ public class OwnershipGraph { 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; @@ -947,7 +943,9 @@ public class OwnershipGraph { 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, @@ -1164,7 +1162,7 @@ public class OwnershipGraph { // 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 @@ -1191,6 +1189,8 @@ public class OwnershipGraph { assert hrnIthShadow.getNumReferencees() == 0; transferOnto( hrnIth, hrnIthShadow ); + + hrnIthShadow.setAlpha( toShadowTokens( ogCallee, hrnIthShadow.getAlpha() ) ); rewriteCallerNodeAlpha( fm.numParameters(), bogusIndex, @@ -1235,7 +1235,8 @@ public class OwnershipGraph { null, edgeCallee.getFieldDesc(), false, - edgeCallee.getBeta() ); + toShadowTokens( ogCallee, edgeCallee.getBeta() ) + ); rewriteCallerEdgeBeta( fm.numParameters(), bogusIndex, edgeNewInCallerTemplate, @@ -1294,6 +1295,22 @@ public class OwnershipGraph { } + private ReachabilitySet toShadowTokens( OwnershipGraph ogCallee, + ReachabilitySet rsIn ) { + + ReachabilitySet rsOut = new ReachabilitySet( rsIn ); + + Iterator 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, @@ -1541,6 +1558,15 @@ public class OwnershipGraph { } + 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 diff --git a/Robust/src/Analysis/OwnershipAnalysis/ReachabilitySet.java b/Robust/src/Analysis/OwnershipAnalysis/ReachabilitySet.java index 2f45849f..9e4a338e 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/ReachabilitySet.java +++ b/Robust/src/Analysis/OwnershipAnalysis/ReachabilitySet.java @@ -174,7 +174,22 @@ public class ReachabilitySet extends Canonical { Iterator itrS = this.iterator(); while( itrS.hasNext() ) { TokenTupleSet tts = (TokenTupleSet) itrS.next(); - rsOut.possibleReachabilities.add(tts.ageTokens(as) ); + rsOut.possibleReachabilities.add( tts.ageTokens(as) ); + } + + return rsOut.makeCanonical(); + } + + + public ReachabilitySet toShadowTokens(AllocationSite as) { + assert as != null; + + ReachabilitySet rsOut = new ReachabilitySet(); + + Iterator itrS = this.iterator(); + while( itrS.hasNext() ) { + TokenTupleSet tts = (TokenTupleSet) itrS.next(); + rsOut.possibleReachabilities.add( tts.toShadowTokens(as) ); } return rsOut.makeCanonical(); diff --git a/Robust/src/Analysis/OwnershipAnalysis/TokenTuple.java b/Robust/src/Analysis/OwnershipAnalysis/TokenTuple.java index c875bd7d..b48d5bd8 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/TokenTuple.java +++ b/Robust/src/Analysis/OwnershipAnalysis/TokenTuple.java @@ -70,7 +70,6 @@ public class TokenTuple extends Canonical { public TokenTuple changeTokenTo(Integer tokenToChangeTo) { assert tokenToChangeTo != null; - assert isNewSummary == false; return new TokenTuple(tokenToChangeTo, isNewSummary, diff --git a/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java b/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java index 8dbe4886..b11d90b3 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java +++ b/Robust/src/Analysis/OwnershipAnalysis/TokenTupleSet.java @@ -208,6 +208,38 @@ public class TokenTupleSet extends Canonical { } + 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,