bug fix, now interprocedural seems cool, unitl the next bug HA
authorjjenista <jjenista>
Thu, 24 Jun 2010 21:19:46 +0000 (21:19 +0000)
committerjjenista <jjenista>
Thu, 24 Jun 2010 21:19:46 +0000 (21:19 +0000)
Robust/src/Analysis/Disjoint/Canonical.java
Robust/src/Analysis/Disjoint/CanonicalOp.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Tests/disjoint/taintTest1/test.java

index 40bd77a1f5947583518c83525eb4f359d778668e..4407e147aa9b583cab9d5752ced72db8a803e813 100644 (file)
@@ -1443,4 +1443,68 @@ abstract public class Canonical {
     //op2result.put( op, out ); CRY CRY
     return out;
   }
+
+
+  public static Taint makePredsTrue( Taint t ) {
+    assert t != null;
+    assert t.isCanonical();
+
+    // ops require two canonicals, in this case always supply
+    // the empty reach state as the second, it's never used,
+    // but makes the hashing happy
+    CanonicalOp op = 
+      new CanonicalOp( CanonicalOp.TAINT_MAKEPREDSTRUE,
+                       t, 
+                       t );
+    
+    Canonical result = op2result.get( op );
+    if( result != null ) {
+      return (Taint) result;
+    }
+    
+    // otherwise, no cached result...
+    Taint out = new Taint( t.sese,
+                           t.stallSite,
+                           t.var,
+                           t.allocSite,
+                           ExistPredSet.factory( ExistPred.factory() ) 
+                           );
+    
+    out = (Taint) makeCanonical( out );
+    op2result.put( op, out );
+    return out;
+  }
+
+
+  public static TaintSet makePredsTrue( TaintSet ts ) {
+    assert ts != null;
+    assert ts.isCanonical();
+
+    // ops require two canonicals, in this case always supply
+    // the empty reach set as the second, it's never used,
+    // but makes the hashing happy
+    CanonicalOp op = 
+      new CanonicalOp( CanonicalOp.TAINTSET_MAKEPREDSTRUE,
+                       ts,
+                       TaintSet.factory() );
+    
+    Canonical result = op2result.get( op );
+    if( result != null ) {
+      return (TaintSet) result;
+    }
+    
+    // otherwise, no cached result...
+    TaintSet out = TaintSet.factory();
+    Iterator<Taint> itr = ts.iterator();
+    while( itr.hasNext() ) {
+      Taint t = itr.next();
+      out = Canonical.add( out,
+                           Canonical.makePredsTrue( t )
+                           );
+    }
+    
+    out = (TaintSet) makeCanonical( out );
+    op2result.put( op, out );
+    return out;
+  }
 }
index 35afa5a93d575bebba51a6bf75328acf8c51509c..81ad56d7ce693e233a1aba7cd891f107ac6e8898 100644 (file)
@@ -38,6 +38,8 @@ public class CanonicalOp {
   public static final int TAINTSET_ADD_TAINT                   = 0xcd17;
   public static final int TAINTSET_UNION_TAINTSET              = 0xa835;
   public static final int TAINTSET_UNIONORPREDS_TAINTSET       = 0x204f;
+  public static final int TAINT_MAKEPREDSTRUE                  = 0x3ab4;
+  public static final int TAINTSET_MAKEPREDSTRUE               = 0x2ff1;
 
   protected int opCode;
   protected Canonical operand1;
index 7bcf73915ca5c7a913a3e25cfe8448ddbcd8deae..c2cab6890520a02f65222d0c78994f24c503e553 100644 (file)
@@ -642,7 +642,7 @@ public class ReachGraph {
                                                                   )
                                                ),
                        predsTrue,
-                       edgeY.getTaints()
+                       Canonical.makePredsTrue( edgeY.getTaints() )
                        );
 
         addEdgeOrMergeWithExisting( edgeNew );
@@ -686,6 +686,7 @@ public class ReachGraph {
       HeapRegionNode referencee = edgeX.getDst();
       RefEdge        edgeNew    = edgeX.copy();
       edgeNew.setSrc( lnR );
+      edgeNew.setTaints( Canonical.makePredsTrue( edgeNew.getTaints() ) );
 
       addRefEdge( lnR, referencee, edgeNew );
     }
index c079e86d8e99142b4d60bf86aebe2243d6f77973..4ec6d2ab2a8f9217564ae4b0aaaa473aca149f44 100644 (file)
@@ -9,34 +9,37 @@ public class Test {
   static public void main( String[] args ) {
 
     Foo a = new Foo();
+    Foo b = new Foo();
 
+    /*
     if( false ) {
       a = new Foo();
     }
+    */
 
     rblock r1 {
       a.f = new Foo();
-      doSomething( a );
+
+      b.f = new Foo();
+
+      doSomething( a, b );
     }
    
   }
 
-  static void doSomething( Foo a ) {
+  static void doSomething( Foo a, Foo b ) {
 
     a.g = new Foo();
 
     a.f.f = a.g;
 
-    //Foo x = a.g;
-
-    //    Foo y = new Foo();
-    //    y.f = x;
-
-    //Foo f = doStuff( a, c );
+    Foo f = doStuff( a, b );
   }   
 
   static Foo doStuff( Foo m, Foo n ) {
 
+    m.f.g = n.f;
+
     return new Foo();
   }
 }