restate inaccessible vars for stall site so facts get joined properly
authorjjenista <jjenista>
Mon, 28 Jun 2010 22:21:43 +0000 (22:21 +0000)
committerjjenista <jjenista>
Mon, 28 Jun 2010 22:21:43 +0000 (22:21 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Analysis/OoOJava/RBlockStatusAnalysis.java
Robust/src/Tests/disjoint/taintTest1/makefile

index 6c7c2fde3fe0f851d66a7b9fc64f2251717e854c..cf02283affb8d8ed3080fe956a5f3634ade6fc3e 100644 (file)
@@ -1017,11 +1017,13 @@ public class DisjointAnalysis {
     // nullified in the graph to reduce edges
     //rg.nullifyDeadVars( liveness.getLiveInTemps( fmContaining, fn ) );
 
-    TempDescriptor  lhs;
-    TempDescriptor  rhs;
-    FieldDescriptor fld;
-    TypeDescriptor  tdElement;
-    FieldDescriptor fdElement;
+    TempDescriptor    lhs;
+    TempDescriptor    rhs;
+    FieldDescriptor   fld;
+    TypeDescriptor    tdElement;
+    FieldDescriptor   fdElement;
+    FlatSESEEnterNode sese;
+    FlatSESEExitNode  fsexn;
 
     // use node type to decide what transfer function
     // to apply to the reachability graph
@@ -1067,8 +1069,8 @@ public class DisjointAnalysis {
         if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
           if(rblockStatus.isInCriticalRegion(fmContaining, fn)){
             // x gets status of y
-            if(rg.isAccessible(rhs)){
-              rg.addAccessibleVar(lhs);
+            if(!rg.isAccessible(rhs)){
+              rg.makeInaccessible(lhs);
             }
           }    
         }
@@ -1085,7 +1087,18 @@ public class DisjointAnalysis {
 
       TypeDescriptor td = fcn.getType();
       assert td != null;
+
+      // before transfer, do effects analysis support
+      if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+        if(rblockStatus.isInCriticalRegion(fmContaining, fn)){
+          // x gets status of y
+          if(!rg.isAccessible(rhs)){
+            rg.makeInaccessible(lhs);
+          }
+        }    
+      }
       
+      // transfer func
       rg.assignTempXEqualToCastedTempY( lhs, rhs, td );
       break;
 
@@ -1108,8 +1121,8 @@ public class DisjointAnalysis {
           }
 
           // after this, x and y are accessbile. 
-          rg.addAccessibleVar(lhs);
-          rg.addAccessibleVar(rhs);            
+          rg.makeAccessible(lhs);
+          rg.makeAccessible(rhs);            
         }
       }
 
@@ -1150,8 +1163,8 @@ public class DisjointAnalysis {
           }
 
           // accessible status update
-          rg.addAccessibleVar(lhs);
-          rg.addAccessibleVar(rhs);            
+          rg.makeAccessible(lhs);
+          rg.makeAccessible(rhs);            
         }
       }
 
@@ -1190,8 +1203,8 @@ public class DisjointAnalysis {
             rg.taintStallSite(fn, rhs);
           }
 
-          rg.addAccessibleVar(lhs);
-          rg.addAccessibleVar(rhs);            
+          rg.makeAccessible(lhs);
+          rg.makeAccessible(rhs);            
         }
       }
 
@@ -1234,8 +1247,8 @@ public class DisjointAnalysis {
           }
             
           // accessible status update
-          rg.addAccessibleVar(lhs);
-          rg.addAccessibleVar(rhs);            
+          rg.makeAccessible(lhs);
+          rg.makeAccessible(rhs);            
         }
       }
 
@@ -1264,7 +1277,7 @@ public class DisjointAnalysis {
         if (doEffectsAnalysis && fmContaining != fmAnalysisEntry) {
           if (rblockStatus.isInCriticalRegion(fmContaining, fn)) {
             // after creating new object, lhs is accessible
-            rg.addAccessibleVar(lhs);
+            rg.makeAccessible(lhs);
           }
         } 
 
@@ -1274,30 +1287,33 @@ public class DisjointAnalysis {
       break;
 
     case FKind.FlatSESEEnterNode:
+      sese = (FlatSESEEnterNode) fn;
+
       if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
         
         // always remove ALL stall site taints at enter
         rg.removeAllStallSiteTaints();
 
-        // inject taints for in-set vars
-        FlatSESEEnterNode sese = (FlatSESEEnterNode) fn;
+        // inject taints for in-set vars      
         rg.taintInSetVars( sese );                         
       }
       break;
 
     case FKind.FlatSESEExitNode:
-      if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+      fsexn = (FlatSESEExitNode) fn;
+      sese  = fsexn.getFlatEnter();
 
-        // sese exit clears all mappings of accessible vars and stall sites
-        // need to wipe out stall site taints
-        rg.clearAccessibleVarSet();        
+      if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
 
+        // @ sese exit make all live variables
+        // inaccessible to later parent statements
+        rg.makeInaccessible( liveness.getLiveInTemps( fmContaining, fn ) );
+        
         // always remove ALL stall site taints at exit
         rg.removeAllStallSiteTaints();
         
-        // remove in-set vars for the exiting rblock
-        FlatSESEExitNode fsexn = (FlatSESEExitNode) fn;
-        rg.removeInContextTaints( fsexn.getFlatEnter() );
+        // remove in-set var taints for the exiting rblock
+        rg.removeInContextTaints( sese );
       }
       break;
 
index f458b38cd3c11b930a4515454bd5ac88ec92f68e..c32826f3f8e9dfd79e476ad46c2bb2d831fada27 100644 (file)
@@ -37,17 +37,17 @@ public class ReachGraph {
 
   // convenient set of alloc sites for all heap regions
   // present in the graph without having to search
-  public HashSet<AllocSite> allocSites;  
+  public Set<AllocSite> allocSites;  
   
-  // set of accessible variables for current program statement
-  // if not contains, it is an inaccessible variable
-  public HashSet<TempDescriptor> accessibleVars;
+  // set of inaccessible variables for current program statement
+  // with respect to stall-site analysis
+  public Set<TempDescriptor> inaccessibleVars;
 
   public ReachGraph() {
-    id2hrn     = new Hashtable<Integer,        HeapRegionNode>();
-    td2vn      = new Hashtable<TempDescriptor, VariableNode  >();
-    allocSites = new HashSet<AllocSite>();
-    accessibleVars = new HashSet<TempDescriptor>();
+    id2hrn           = new Hashtable<Integer,        HeapRegionNode>();
+    td2vn            = new Hashtable<TempDescriptor, VariableNode  >();
+    allocSites       = new HashSet<AllocSite>();
+    inaccessibleVars = new HashSet<TempDescriptor>();
   }
 
   
@@ -732,11 +732,7 @@ public class ReachGraph {
                    TaintSet.factory()    // taints
                    );
 
-    addRefEdge( lnX, hrnNewest, edgeNew );
-    
-    // after x=new , x is accessible
-    // if (isInRegion()) {
-    //accessibleVars.add(x);
+    addRefEdge( lnX, hrnNewest, edgeNew );    
   }
 
 
@@ -3687,10 +3683,10 @@ public class ReachGraph {
       return;
     }
 
-    mergeNodes     ( rg );
-    mergeRefEdges  ( rg );
-    mergeAllocSites( rg );
-    mergeAccessibleSet( rg );
+    mergeNodes           ( rg );
+    mergeRefEdges        ( rg );
+    mergeAllocSites      ( rg );
+    mergeInaccessibleVars( rg );
   }
   
   protected void mergeNodes( ReachGraph rg ) {
@@ -3898,21 +3894,8 @@ public class ReachGraph {
     allocSites.addAll( rg.allocSites );
   }
   
-  protected void mergeAccessibleSet( ReachGraph rg ){
-    // inaccesible status is prior to accessible status
-    
-    Set<TempDescriptor> varsToMerge=rg.getAccessibleVar();    
-    Set<TempDescriptor> varsRemoved=new HashSet<TempDescriptor>();
-    
-    for (Iterator iterator = accessibleVars.iterator(); iterator.hasNext();) {
-      TempDescriptor accessibleVar = (TempDescriptor) iterator.next();
-      if(!varsToMerge.contains(accessibleVar)){
-        varsRemoved.add(accessibleVar);
-      }
-    }
-    
-    accessibleVars.removeAll(varsRemoved);
-        
+  protected void mergeInaccessibleVars( ReachGraph rg ){
+    inaccessibleVars.addAll(rg.inaccessibleVars);
   }
 
 
@@ -3960,7 +3943,7 @@ public class ReachGraph {
       return false;
     }
     
-    if( !accessibleVars.equals( rg.accessibleVars) ){
+    if( !inaccessibleVars.equals(rg.inaccessibleVars) ){
       return false;
     }
 
@@ -4975,20 +4958,23 @@ public class ReachGraph {
     return common;
   }
   
-  public void addAccessibleVar(TempDescriptor td){
-    accessibleVars.add(td);
+  public void makeInaccessible( Set<TempDescriptor> vars ) {
+    inaccessibleVars.addAll( vars );
   }
-  
-  public Set<TempDescriptor> getAccessibleVar(){
-    return accessibleVars;
+
+  public void makeInaccessible( TempDescriptor td ) {
+    inaccessibleVars.add( td );
+  }
+
+  public void makeAccessible( TempDescriptor td ) {
+    inaccessibleVars.remove( td );
   }
   
   public boolean isAccessible(TempDescriptor td) {
-    return accessibleVars.contains(td);
+    return !inaccessibleVars.contains(td);
   }
 
-  public void clearAccessibleVarSet(){
-    accessibleVars.clear();
-  }  
-  
+  public Set<TempDescriptor> getInaccessibleVars() {
+    return inaccessibleVars;
+  }
 }
index 35693823da595ac57689a21222000428d4bc7eee..d11c5b2b4ee5dfbd59fca889721f028fb63e9972 100644 (file)
@@ -140,7 +140,7 @@ public class RBlockStatusAnalysis {
     Hashtable<FlatSESEEnterNode, Boolean> status = statusMap.get(fn);
     
     if(status.get(seseContaining).booleanValue()==true){
-      System.out.println(fn+" is in the critical region in according to "+seseContaining);
+      //System.out.println(fn+" is in the critical region in according to "+seseContaining);
     }
     
     return status.get(seseContaining).booleanValue();
index e373614466ac3bebf6d872e2b4cb879ff2d93159..5b0554bcfd4012953fd830f96a397e31b4e84eb6 100644 (file)
@@ -5,7 +5,7 @@ SOURCE_FILES=$(PROGRAM).java
 BUILDSCRIPT=~/research/Robust/src/buildscript
 
 BSFLAGS= -mainclass Test -justanalyze -ooojava -disjoint -disjoint-k 1 -enable-assertions
-DEBUGFLAGS= -disjoint-write-dots final -disjoint-write-initial-contexts -disjoint-write-ihms -disjoint-debug-snap-method main 0 10 true
+DEBUGFLAGS= -disjoint-write-dots final -disjoint-write-initial-contexts -disjoint-write-ihms #-disjoint-debug-snap-method main 0 10 true
 
 all: $(PROGRAM).bin