From: yeom Date: Fri, 25 Sep 2009 21:56:30 +0000 (+0000) Subject: fixes to handle non-static method properly. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=27c4de07142f58e6912be556d6ac51d892961b60;p=IRC.git fixes to handle non-static method properly. --- diff --git a/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java b/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java index 49c912f0..85b79cd2 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java +++ b/Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java @@ -171,8 +171,8 @@ public class MethodEffects { TempDescriptor[] tdArray = fc.readsTemps(); - for (int callerIdx = 0; callerIdx < tdArray.length; callerIdx++) { - TempDescriptor paramDesc = tdArray[callerIdx]; + for (int calleeParamIdx = 0; calleeParamIdx < tdArray.length; calleeParamIdx++) { + TempDescriptor paramDesc = tdArray[calleeParamIdx]; Set paramIDs = getReachableParamIndexSet(og, paramDesc); @@ -181,8 +181,8 @@ public class MethodEffects { while (paramIter.hasNext()) { Integer paramIdx = paramIter.next(); HashSet newSet = callee.getEffects().getReadTable() - .get(paramIdx); - effectsSet.addReadingEffectsSet(callerIdx, newSet); + .get(calleeParamIdx); + effectsSet.addReadingEffectsSet(paramIdx, newSet); } // handle write effects @@ -190,8 +190,8 @@ public class MethodEffects { while (paramIter.hasNext()) { Integer paramIdx = paramIter.next(); HashSet newSet = callee.getEffects() - .getWriteTable().get(paramIdx); - effectsSet.addWritingEffectsSet(callerIdx, newSet); + .getWriteTable().get(calleeParamIdx); + effectsSet.addWritingEffectsSet(paramIdx, newSet); } } diff --git a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java index 8ab0ef8c..75e3125b 100644 --- a/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java +++ b/Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java @@ -937,12 +937,13 @@ public class OwnershipAnalysis { } else { ogCopy.resolveMethodCall(fc, possibleMd.isStatic(), pflatm, ogPotentialCallee, mc, null); } - - MethodEffects meFlatCall=mapMethodContextToMethodEffects.get(mcNew); - meFlatCall.analyzeFlatCall(ogMergeOfAllPossibleCalleeResults,fc,mcNew,meFlatCall); ogMergeOfAllPossibleCalleeResults.merge(ogCopy); + + MethodEffects meFlatCall=mapMethodContextToMethodEffects.get(mcNew); + me.analyzeFlatCall(ogMergeOfAllPossibleCalleeResults,fc,mc,meFlatCall); } + } og = ogMergeOfAllPossibleCalleeResults; @@ -1059,14 +1060,19 @@ public class OwnershipAnalysis { while (mcIter.hasNext()) { MethodContext mc = mcIter.next(); MethodDescriptor md = (MethodDescriptor) mc.getDescriptor(); + + int startIdx=0; + if(!md.isStatic()){ + startIdx=1; + } MethodEffects me = mapMethodContextToMethodEffects.get(mc); EffectsSet effectsSet = me.getEffects(); - bw.write("Method " + mc +"::"+mc.hashCode() + " :\n"); - for (int i = 0; i < md.numParameters(); i++) { + bw.write("Method " + mc +" :\n"); + for (int i = startIdx; i < md.numParameters()+startIdx; i++) { - String paramName = md.getParamName(i); + String paramName = md.getParamName(i-startIdx); Set effectSet = effectsSet .getReadingSet(i);