stall site taints propagate awesomely, get cleared off also
authorjjenista <jjenista>
Mon, 28 Jun 2010 19:09:49 +0000 (19:09 +0000)
committerjjenista <jjenista>
Mon, 28 Jun 2010 19:09:49 +0000 (19:09 +0000)
Robust/src/Analysis/Disjoint/Canonical.java
Robust/src/Analysis/Disjoint/CanonicalOp.java
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Tests/disjoint/taintTest1/test.java

index dd97fd481e32c90003ace9b39a0a3994b797fedf..ff47436fa1e24238d8080fb6c6c621dfa1524bb1 100644 (file)
@@ -1442,6 +1442,38 @@ abstract public class Canonical {
     return out;
   }
 
+  public static TaintSet removeStallSiteTaints( TaintSet ts ) {
+    assert ts != null;
+    assert ts.isCanonical();
+
+    CanonicalOp op = 
+      new CanonicalOp( CanonicalOp.TAINTSET_REMOVESTALLSITETAINTS,
+                       ts, 
+                       ts );
+    
+    Canonical result = op2result.get( op );
+    if( result != null ) {
+      return (TaintSet) result;
+    }
+    
+    // otherwise, no cached result...
+    TaintSet out = new TaintSet();
+
+    Iterator<Taint> tItr = ts.iterator();
+    while( tItr.hasNext() ) {
+      Taint t = tItr.next();
+
+      // only take non-stall site taints onward
+      if( t.getStallSite() == null ) {
+        out.taints.add( t );
+      }
+    }
+    
+    out = (TaintSet) makeCanonical( out );
+    op2result.put( op, out );
+    return out;
+  }
+
 
   public static Taint changePredsTo( Taint        t, 
                                      ExistPredSet preds ) {
index 2a3c812df455871cccd493052ba105dc987065d6..7de780c60cc2d833cd030ce0bc92dc2eb8138c53 100644 (file)
@@ -40,6 +40,7 @@ public class CanonicalOp {
   public static final int TAINTSET_UNIONORPREDS_TAINTSET       = 0x204f;
   public static final int TAINT_CHANGEPREDSTO_EXISTPREDSET     = 0x3ab4;
   public static final int TAINTSET_CHANGEPREDSTO_EXISTPREDSET  = 0x2ff1;
+  public static final int TAINTSET_REMOVESTALLSITETAINTS       = 0xb69c;
 
   protected int opCode;
   protected Canonical operand1;
index a9e6178927baaa5dfe26f2b20fdec65f6cc91448..e43a39304b1b5b2826002e3aa30cfd3aa491c4d6 100644 (file)
@@ -1276,6 +1276,11 @@ public class DisjointAnalysis {
 
     case FKind.FlatSESEEnterNode:
       if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+        
+        // always remove ALL stall site taints at enter
+        rg.removeAllStallSiteTaints();
+
+        // inject taints for in-set vars
         FlatSESEEnterNode sese = (FlatSESEEnterNode) fn;
         rg.taintInSetVars( sese );                         
       }
@@ -1283,8 +1288,14 @@ public class DisjointAnalysis {
 
     case FKind.FlatSESEExitNode:
       if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+
+        // 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() );
+
         // sese exit clears all mappings of accessible vars and stall sites
         // need to wipe out stall site taints
         rg.clearAccessibleVarSet();        
index 824e6b3f369523edd20730c14ec9eb77621d2881..f458b38cd3c11b930a4515454bd5ac88ec92f68e 100644 (file)
@@ -1302,8 +1302,6 @@ public class ReachGraph {
   public void taintStallSite( FlatNode stallSite,
                               TempDescriptor var ) {
     
-    System.out.println( "Tainting stall site: "+stallSite+" and "+var );
-
     // stall site taint should propagate back into callers
     // so give it TRUE predicates
     taintTemp( null,
@@ -1362,6 +1360,25 @@ public class ReachGraph {
     }
   }
 
+  public void removeAllStallSiteTaints() {
+
+    Iterator meItr = id2hrn.entrySet().iterator();
+    while( meItr.hasNext() ) {
+      Map.Entry      me  = (Map.Entry)      meItr.next();
+      Integer        id  = (Integer)        me.getKey();
+      HeapRegionNode hrn = (HeapRegionNode) me.getValue();
+
+      Iterator<RefEdge> reItr = hrn.iteratorToReferencers();
+      while( reItr.hasNext() ) {
+        RefEdge re = reItr.next();
+        
+        re.setTaints( Canonical.removeStallSiteTaints( re.getTaints() 
+                                                       )
+                      );
+      }
+    }
+  }
+
 
   // used in makeCalleeView below to decide if there is
   // already an appropriate out-of-context edge in a callee
index 7c02d6b97d6a6a2836d3abf59d8a862c723d85d4..86b90c30280d38151d1893cd1dceea9ec9439a6d 100644 (file)
@@ -19,7 +19,13 @@ public class Test {
 
       Foo x = a.f;
 
-      x.g = new Foo();
+      doSomething( a, b );
+
+      //rblock c2 {
+      //  b.f = new Foo();
+      //}
+
+      //x.g = new Foo();
     }
 
 
@@ -30,10 +36,12 @@ public class Test {
     Foo x = b;
     a.g = x; 
 
-    a.f = new Foo();
-    b.f = new Foo();
+    rblock j {
+      a.f = new Foo();
+      b.f = new Foo();
+    }
 
-    Foo f = doStuff( a.f, b.f );
+    //Foo f = doStuff( a.f, b.f );
   }   
 
   static Foo doStuff( Foo m, Foo n ) {