changes.
authoryeom <yeom>
Tue, 12 Jul 2011 17:46:34 +0000 (17:46 +0000)
committeryeom <yeom>
Tue, 12 Jul 2011 17:46:34 +0000 (17:46 +0000)
Robust/src/Analysis/SSJava/DefinitelyWrittenCheck.java
Robust/src/Analysis/SSJava/SSJavaAnalysis.java
Robust/src/Analysis/SSJava/SharedStatus.java

index 93145be82aff921ea5f1c0f72ae5fe7815a9f262..b1f7029ed0fb0d42616f7f667095356ef0d96e95 100644 (file)
@@ -365,6 +365,18 @@ public class DefinitelyWrittenCheck {
       NTuple<Descriptor> fldHeapPath = new NTuple<Descriptor>(lhsHeapPath.getList());
       if (fld.getType().isImmutable()) {
         writeLocation(curr, fldHeapPath, fld);
+      } else {
+        // updates reference field case:
+        // 2. if there exists a tuple t in sharing summary that starts with
+        // hp(x) then, set flag of tuple t to 'true'
+        fldHeapPath.add(fld);
+        Set<NTuple<Descriptor>> hpKeySet = curr.keySet();
+        for (Iterator iterator = hpKeySet.iterator(); iterator.hasNext();) {
+          NTuple<Descriptor> hpKey = (NTuple<Descriptor>) iterator.next();
+          if (hpKey.startsWith(fldHeapPath)) {
+            curr.get(hpKey).updateFlag(true);
+          }
+        }
       }
 
     }
@@ -699,14 +711,14 @@ public class DefinitelyWrittenCheck {
   private void writeLocation(ClearingSummary curr, NTuple<Descriptor> hp, Descriptor d) {
     Location loc = getLocation(d);
     if (loc != null && hasReadingEffectOnSharedLocation(hp, loc, d)) {
+
+      // 1. add field x to the clearing set
       SharedStatus state = getState(curr, hp);
       state.addVar(loc, d);
 
-      // if the set v contains all of variables belonging to the shared
+      // 3. if the set v contains all of variables belonging to the shared
       // location, set flag to true
-
       Set<Descriptor> sharedVarSet = mapSharedLocation2DescriptorSet.get(loc);
-
       if (state.getVarSet(loc).containsAll(sharedVarSet)) {
         state.updateFlag(loc, true);
       }
index 1402a41f13e6b45e0c5f37413ade659790d1a482..7e804075c3e52476d4d510cbd5eb617ddffb3981 100644 (file)
@@ -153,6 +153,7 @@ public class SSJavaAnalysis {
                 if (value != null) {
                   maxIteration = Integer.parseInt(value);
                 }
+                System.out.println("###md=" + md);
                 skipLoopTerminate.put(md, new Integer(maxIteration));
               }
             }
@@ -286,7 +287,9 @@ public class SSJavaAnalysis {
 
   public void doLoopTerminationCheck(LoopOptimize lo, FlatMethod fm) {
     LoopTerminate lt = new LoopTerminate();
-    lt.terminateAnalysis(fm, lo.getLoopInvariant(fm));
+    if (needTobeAnnotated(fm.getMethod())) {
+      lt.terminateAnalysis(fm, lo.getLoopInvariant(fm));
+    }
   }
 
   public void doLoopTerminationCheck(LoopOptimize lo) {
index 8c6f9f51c49b678ccad5527d2a18fe6553c40531..dc3056ecf6ca493f4e1ea67ee2d39b07c621a9f6 100644 (file)
@@ -98,6 +98,17 @@ public class SharedStatus {
     }
   }
 
+  public void updateFlag(boolean b) {
+    Set<Location> locKeySet = mapLocation2Status.keySet();
+    for (Iterator iterator = locKeySet.iterator(); iterator.hasNext();) {
+      Location loc = (Location) iterator.next();
+      Pair<Set<Descriptor>, Boolean> pair = mapLocation2Status.get(loc);
+      mapLocation2Status.put(loc,
+          new Pair<Set<Descriptor>, Boolean>(pair.getFirst(), Boolean.valueOf(b)));
+    }
+
+  }
+
   public boolean getFlag(Location loc) {
     return mapLocation2Status.get(loc).getSecond().booleanValue();
   }