fixes to handle non-static method properly.
authoryeom <yeom>
Fri, 25 Sep 2009 21:56:30 +0000 (21:56 +0000)
committeryeom <yeom>
Fri, 25 Sep 2009 21:56:30 +0000 (21:56 +0000)
Robust/src/Analysis/OwnershipAnalysis/MethodEffects.java
Robust/src/Analysis/OwnershipAnalysis/OwnershipAnalysis.java

index 49c912f03d91301b9d9899f6f314b0e66dfd7132..85b79cd2b6808be6173f3ec8ae73bd737c7ccd5b 100644 (file)
@@ -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<Integer> paramIDs = getReachableParamIndexSet(og, paramDesc);
 
@@ -181,8 +181,8 @@ public class MethodEffects {
                        while (paramIter.hasNext()) {
                                Integer paramIdx = paramIter.next();
                                HashSet<EffectsKey> 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<EffectsKey> newSet = callee.getEffects()
-                                               .getWriteTable().get(paramIdx);
-                               effectsSet.addWritingEffectsSet(callerIdx, newSet);
+                                               .getWriteTable().get(calleeParamIdx);
+                               effectsSet.addWritingEffectsSet(paramIdx, newSet);
                        }
 
                }
index 8ab0ef8c81d45e9d764ac0bb85bae012d78037ab..75e3125becf367a61ee75f7dcd5a6ed39a0205ed 100644 (file)
@@ -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<EffectsKey> effectSet = effectsSet
                                                        .getReadingSet(i);