fixes -nostalltr flag: if it is valid to prune heap examiners, turning off both of...
authoryeom <yeom>
Fri, 8 Apr 2011 03:45:29 +0000 (03:45 +0000)
committeryeom <yeom>
Fri, 8 Apr 2011 03:45:29 +0000 (03:45 +0000)
Robust/src/Analysis/OoOJava/ConflictNode.java
Robust/src/IR/Flat/RuntimeConflictResolver.java

index a83ecbe755e3f1db3e91c5e773163fbea63f3cf9..3b6c30197e78f5f7a840a3972601ea5edcdeb870 100644 (file)
@@ -29,6 +29,15 @@ public class ConflictNode {
   protected FlatNode stallSite;
   protected TempDescriptor var;
   protected FlatSESEEnterNode fsen;
+  protected boolean toBePruned = false;
+
+  public boolean isTobePruned() {
+    return toBePruned;
+  }
+
+  public void setToBePruned(boolean toBePruned) {
+    this.toBePruned = toBePruned;
+  }
 
   public static final int FINE_READ = 0;
   public static final int FINE_WRITE = 1;
@@ -40,7 +49,7 @@ public class ConflictNode {
 
   public static final int INVAR = 0;
   public static final int STALLSITE = 1;
-  
+
   public ConflictNode(String id, int nodeType, TempDescriptor var, FlatNode stallSite) {
     this(id, var, nodeType);
     this.stallSite = stallSite;
@@ -223,7 +232,7 @@ public class ConflictNode {
   public String toString() {
     return id;
   }
-  
+
   public boolean IsValidToPrune() {
 
     for (Iterator iterator = edgeSet.iterator(); iterator.hasNext();) {
@@ -245,12 +254,9 @@ public class ConflictNode {
             return false;
           }
         }
-
       }
-
     }
     return true;
   }
-  
 
 }
index 7b446681bd93e226142b6dfb6052f5ca5c65c5f8..cd6278674871640d8ff8739478d02345f0f9ee95 100644 (file)
@@ -1,4 +1,5 @@
 package IR.Flat;
+
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.util.ArrayList;
@@ -13,6 +14,7 @@ import Analysis.Pointer.*;
 import Analysis.Pointer.AllocFactory.AllocNode;
 import IR.State;
 import IR.TypeDescriptor;
+import Analysis.OoOJava.ConflictEdge;
 import Analysis.OoOJava.ConflictGraph;
 import Analysis.OoOJava.ConflictNode;
 import Analysis.OoOJava.OoOJavaAnalysis;
@@ -448,6 +450,30 @@ public class RuntimeConflictResolver {
          ConflictNode      node       = graph.getId2cn().get(id);
          isValidToPrune &= node.IsValidToPrune();
        }
+       
+       if(isValidToPrune){
+         // if node is valid to prune examiner, 
+         // also needs to turn off stall site examiners connected to this node
+         for( FlatSESEEnterNode parentSESE: fsen.getParents() ) {
+           ConflictGraph     graph      = oooa.getConflictGraph(parentSESE);
+           String            id         = tmp + "_sese" + fsen.getPrettyIdentifier();
+           ConflictNode      node       = graph.getId2cn().get(id);
+           
+           for (Iterator iterator = node.getEdgeSet().iterator(); iterator.hasNext();) {
+        ConflictEdge edge = (ConflictEdge) iterator.next();
+        if (edge.getVertexU() == node) {
+          if (edge.getVertexV().isStallSiteNode()) {
+            edge.getVertexV().setToBePruned(true);
+          }
+        } else {
+          if (edge.getVertexU().isStallSiteNode()) {
+            edge.getVertexU().setToBePruned(true);
+          }
+        }        
+      }
+         }
+       }
+               
        if (i!=0) {
          cFile.println("      if (record->rcrstatus!=0)");
        }
@@ -469,11 +495,25 @@ public class RuntimeConflictResolver {
     }
     
     for(FlatNode stallsite: processedStallSites.keySet()) {
+      
       TempDescriptor var = processedStallSites.get(stallsite);
+      Set<FlatSESEEnterNode> seseSet=oooa.getPossibleExecutingRBlocks(stallsite);
+      boolean isValidToPrune=true;
+      for (Iterator iterator = seseSet.iterator(); iterator.hasNext();) {
+        FlatSESEEnterNode sese = (FlatSESEEnterNode) iterator.next();
+        ConflictGraph     graph      = oooa.getConflictGraph(sese);
+        String id = var + "_fn" + stallsite.hashCode();
+        ConflictNode      node       = graph.getId2cn().get(id);
+        isValidToPrune &= node.isTobePruned();
+      }
       
       cFile.println(    "    case -" + getTraverserID(var, stallsite)+ ": {");
       cFile.println(    "      SESEstall * rec=(SESEstall*) record;");
-      cFile.println(    "      " + getTraverserInvocation(var, "rec->___obj___, rec", stallsite)+";");
+      if(globalState.NOSTALLTR && isValidToPrune){
+        cFile.println(    "     /*" + getTraverserInvocation(var, "rec->___obj___, rec", stallsite)+";*/");
+      }else{
+        cFile.println(    "      " + getTraverserInvocation(var, "rec->___obj___, rec", stallsite)+";");
+      }      
       cFile.println(    "     record->rcrstatus=0;");
       cFile.println(    "    }");
       cFile.println("    break;");