taints tested, propagate interprocedurally
authorjjenista <jjenista>
Thu, 24 Jun 2010 20:51:44 +0000 (20:51 +0000)
committerjjenista <jjenista>
Thu, 24 Jun 2010 20:51:44 +0000 (20:51 +0000)
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Analysis/Disjoint/Taint.java
Robust/src/Analysis/Disjoint/TaintSet.java
Robust/src/Tests/disjoint/taintTest1/makefile
Robust/src/Tests/disjoint/taintTest1/test.java

index cfe73e3921c749c892a510e0159168dca37ecbe3..7bcf73915ca5c7a913a3e25cfe8448ddbcd8deae 100644 (file)
@@ -1799,8 +1799,9 @@ public class ReachGraph {
       ExistPredSet preds = 
         ExistPredSet.factory( pred );
       
-      TaintSet taints =
-        TaintSet.factory();
+      TaintSet taints = TaintSet.factory( reArg.getTaints(),
+                                          preds
+                                          );
 
       RefEdge reCallee = 
         new RefEdge( vnCallee,
@@ -2183,6 +2184,8 @@ public class ReachGraph {
       
       // since the node is coming over, find out which reach
       // states on it should come over, too
+      assert calleeNode2calleeStatesSatisfied.get( hrnCallee ) == null;
+
       Iterator<ReachState> stateItr = hrnCallee.getAlpha().iterator();
       while( stateItr.hasNext() ) {
         ReachState stateCallee = stateItr.next();
@@ -2192,13 +2195,18 @@ public class ReachGraph {
                                                 callerNodeIDsCopiedToCallee
                                                 );
         if( predsIfSatis != null ) {          
-          assert calleeNode2calleeStatesSatisfied.get( hrnCallee ) == null;
-          
+      
           Hashtable<ReachState, ExistPredSet> calleeStatesSatisfied =
-            new Hashtable<ReachState, ExistPredSet>();
-          calleeStatesSatisfied.put( stateCallee, predsIfSatis );
+            calleeNode2calleeStatesSatisfied.get( hrnCallee ); 
+
+          if( calleeStatesSatisfied == null ) {
+            calleeStatesSatisfied = 
+              new Hashtable<ReachState, ExistPredSet>();
 
-          calleeNode2calleeStatesSatisfied.put( hrnCallee, calleeStatesSatisfied );            
+            calleeNode2calleeStatesSatisfied.put( hrnCallee, calleeStatesSatisfied );
+          }
+
+          calleeStatesSatisfied.put( stateCallee, predsIfSatis );
         } 
       }
 
@@ -2335,6 +2343,8 @@ public class ReachGraph {
 
           // since the edge is coming over, find out which reach
           // states on it should come over, too
+          assert calleeEdge2calleeStatesSatisfied.get( reCallee ) == null;
+
           stateItr = reCallee.getBeta().iterator();
           while( stateItr.hasNext() ) {
             ReachState stateCallee = stateItr.next();
@@ -2344,18 +2354,25 @@ public class ReachGraph {
                                                     callerNodeIDsCopiedToCallee
                                                     );
             if( predsIfSatis != null ) {
-              assert calleeEdge2calleeStatesSatisfied.get( reCallee ) == null;
               
               Hashtable<ReachState, ExistPredSet> calleeStatesSatisfied =
-                new Hashtable<ReachState, ExistPredSet>();
-              calleeStatesSatisfied.put( stateCallee, predsIfSatis );
-              
-              calleeEdge2calleeStatesSatisfied.put( reCallee, calleeStatesSatisfied );
+                calleeEdge2calleeStatesSatisfied.get( reCallee );
+
+              if( calleeStatesSatisfied == null ) {
+                calleeStatesSatisfied = 
+                  new Hashtable<ReachState, ExistPredSet>();
+
+                calleeEdge2calleeStatesSatisfied.put( reCallee, calleeStatesSatisfied );
+              }
+
+              calleeStatesSatisfied.put( stateCallee, predsIfSatis );             
             } 
           }
 
           // since the edge is coming over, find out which taints
           // on it should come over, too          
+          assert calleeEdge2calleeTaintsSatisfied.get( reCallee ) == null;
+
           Iterator<Taint> tItr = reCallee.getTaints().iterator();
           while( tItr.hasNext() ) {
             Taint tCallee = tItr.next();
@@ -2365,13 +2382,18 @@ public class ReachGraph {
                                                 callerNodeIDsCopiedToCallee
                                                 );
             if( predsIfSatis != null ) {
-              assert calleeEdge2calleeTaintsSatisfied.get( reCallee ) == null;
               
               Hashtable<Taint, ExistPredSet> calleeTaintsSatisfied =
-                new Hashtable<Taint, ExistPredSet>();
-              calleeTaintsSatisfied.put( tCallee, predsIfSatis );
-              
-              calleeEdge2calleeTaintsSatisfied.put( reCallee, calleeTaintsSatisfied );
+                calleeEdge2calleeTaintsSatisfied.get( reCallee );
+
+              if( calleeTaintsSatisfied == null ) {
+                calleeTaintsSatisfied = 
+                  new Hashtable<Taint, ExistPredSet>();
+
+                calleeEdge2calleeTaintsSatisfied.put( reCallee, calleeTaintsSatisfied );
+              }
+
+              calleeTaintsSatisfied.put( tCallee, predsIfSatis );              
             } 
           }
         }        
index cf275c97432513b87d5a39737275208484b69666..e5ab027ba569fbe044dfaa8ddb6eeabe24b78970 100644 (file)
@@ -59,20 +59,20 @@ public class Taint extends Canonical {
   }
 
   public static Taint factory( FlatNode       stallSite,
-                               TempDescriptor liveVar,
+                               TempDescriptor var,
                                AllocSite      as,
                                ExistPredSet   eps ) {
-    Taint out = new Taint( null, stallSite, liveVar, as, eps );
+    Taint out = new Taint( null, stallSite, var, as, eps );
     out = (Taint) Canonical.makeCanonical( out );
     return out;
   }
 
   public static Taint factory( FlatSESEEnterNode sese,
                                FlatNode          stallSite,
-                               TempDescriptor    liveVar,
+                               TempDescriptor    var,
                                AllocSite         as,
                                ExistPredSet      eps ) {
-    Taint out = new Taint( sese, stallSite, liveVar, as, eps );
+    Taint out = new Taint( sese, stallSite, var, as, eps );
     out = (Taint) Canonical.makeCanonical( out );
     return out;
   }
index 6631de37135926b130f9dd988475c916030aea43..b0005b3b5c5b82b4eb8015e6c9913f87bd9a48d4 100644 (file)
@@ -47,6 +47,28 @@ public class TaintSet extends Canonical {
     return out;
   }
 
+  public static TaintSet factory( TaintSet     ts,
+                                  ExistPredSet preds ) {
+    assert ts != null;
+    assert ts.isCanonical();
+
+    TaintSet out = new TaintSet();
+
+    Iterator<Taint> tItr = ts.iterator();
+    while( tItr.hasNext() ) {
+      Taint t    = tItr.next();
+      Taint tOut = Taint.factory( t.sese,
+                                  t.stallSite,
+                                  t.var,
+                                  t.allocSite,
+                                  preds );
+      out.taints.add( tOut );
+    }
+
+    out = (TaintSet) Canonical.makeCanonical( out );
+    return out;
+  }
+
   protected TaintSet() {
     taints = new HashSet<Taint>();
   }
index 56dcc005d6352bb8274edb56fbf585f3fdf82831..fa76629b1897b32d972b107a078932b4c70aaaa8 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-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
 
index 748edf401b1dfeeb3e88082728a78230545e74ab..c079e86d8e99142b4d60bf86aebe2243d6f77973 100644 (file)
@@ -9,38 +9,28 @@ public class Test {
   static public void main( String[] args ) {
 
     Foo a = new Foo();
-    Foo b = new Foo();
 
     if( false ) {
       a = new Foo();
     }
 
-    rblock p1 {
+    rblock r1 {
       a.f = new Foo();
-      a.g = new Foo();
-
-      Foo x = a.f;
+      doSomething( a );
     }
+   
+  }
 
-    rblock p2 {
-      a.f = new Foo();      
-      b.f = new Foo();
+  static void doSomething( Foo a ) {
 
-      rblock c1 {
-        Foo d = a;
-        d.g = new Foo();
-        Foo e = d.g;
-      }
+    a.g = new Foo();
 
-      Foo y = a.f;
-    }
+    a.f.f = a.g;
 
+    //Foo x = a.g;
 
-    
-    //doSomething( a );
-  }
-
-  static void doSomething( Foo a ) {
+    //    Foo y = new Foo();
+    //    y.f = x;
 
     //Foo f = doStuff( a, c );
   }