getting effects analysis going, need a few more pieces before call site analysis...
authorjjenista <jjenista>
Fri, 25 Jun 2010 22:41:14 +0000 (22:41 +0000)
committerjjenista <jjenista>
Fri, 25 Jun 2010 22:41:14 +0000 (22:41 +0000)
Robust/src/Analysis/Disjoint/Canonical.java
Robust/src/Analysis/Disjoint/CanonicalOp.java
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/EffectsAnalysis.java
Robust/src/Analysis/Disjoint/ExistPred.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Tests/disjoint/taintTest1/makefile
Robust/src/Tests/disjoint/taintTest1/test.java

index 4407e147aa9b583cab9d5752ced72db8a803e813..f11ac4a8bf5d251d9bf6287ccbaa503229336b13 100644 (file)
@@ -1445,7 +1445,7 @@ abstract public class Canonical {
   }
 
 
-  public static Taint makePredsTrue( Taint t ) {
+  public static Taint changePredsTo( Taint t, ExistPredSet preds ) {
     assert t != null;
     assert t.isCanonical();
 
@@ -1453,7 +1453,7 @@ abstract public class Canonical {
     // the empty reach state as the second, it's never used,
     // but makes the hashing happy
     CanonicalOp op = 
-      new CanonicalOp( CanonicalOp.TAINT_MAKEPREDSTRUE,
+      new CanonicalOp( CanonicalOp.TAINT_CHANGEPREDSTO,
                        t, 
                        t );
     
@@ -1467,7 +1467,7 @@ abstract public class Canonical {
                            t.stallSite,
                            t.var,
                            t.allocSite,
-                           ExistPredSet.factory( ExistPred.factory() ) 
+                           preds
                            );
     
     out = (Taint) makeCanonical( out );
@@ -1476,7 +1476,7 @@ abstract public class Canonical {
   }
 
 
-  public static TaintSet makePredsTrue( TaintSet ts ) {
+  public static TaintSet changePredsTo( TaintSet ts, ExistPredSet preds ) {
     assert ts != null;
     assert ts.isCanonical();
 
@@ -1484,9 +1484,9 @@ abstract public class Canonical {
     // the empty reach set as the second, it's never used,
     // but makes the hashing happy
     CanonicalOp op = 
-      new CanonicalOp( CanonicalOp.TAINTSET_MAKEPREDSTRUE,
+      new CanonicalOp( CanonicalOp.TAINTSET_CHANGEPREDSTO,
                        ts,
-                       TaintSet.factory() );
+                       ts );
     
     Canonical result = op2result.get( op );
     if( result != null ) {
@@ -1499,7 +1499,7 @@ abstract public class Canonical {
     while( itr.hasNext() ) {
       Taint t = itr.next();
       out = Canonical.add( out,
-                           Canonical.makePredsTrue( t )
+                           Canonical.changePredsTo( t, preds )
                            );
     }
     
index 81ad56d7ce693e233a1aba7cd891f107ac6e8898..e280e33eaefa07c4e681b993d14f39d04736cc7b 100644 (file)
@@ -38,8 +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;
+  public static final int TAINT_CHANGEPREDSTO                  = 0x3ab4;
+  public static final int TAINTSET_CHANGEPREDSTO               = 0x2ff1;
 
   protected int opCode;
   protected Canonical operand1;
index 8cd77935add9b19f524dc0d509139719e2972229..21c80a58d4b28eb540e3cf6372ed4c638622fb21 100644 (file)
@@ -1089,7 +1089,7 @@ public class DisjointAnalysis {
         if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
           FlatSESEEnterNode seseContaining = 
             rblockRel.getRBlockStacks( fmContaining, fn ).peek();
-
+          
           effectsAnalysis.analyzeFlatFieldNode( fmContaining,
                                                 seseContaining,
                                                 rg, rhs, fld );          
@@ -1356,7 +1356,7 @@ public class DisjointAnalysis {
                                     );
 
           if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
-
+            
             FlatSESEEnterNode seseContaining = 
               rblockRel.getRBlockStacks( fmContaining, fn ).peek();
             
index 70cf0fb16ad8c3de6e78662df8fbefd735c34978..cf9eaf385485b1d86092c48c2407f7da852cd986 100644 (file)
@@ -40,7 +40,10 @@ public class EffectsAnalysis {
                                    ReachGraph rg, TempDescriptor rhs, FieldDescriptor fld) {
 
     VariableNode vn = rg.td2vn.get(rhs);
-    
+    if( vn == null ) {
+      return;
+    }
+
     for (Iterator<RefEdge> iterator = vn.iteratorToReferencees(); iterator.hasNext();) {
       RefEdge edge = iterator.next();
       TaintSet taintSet = edge.getTaints();
@@ -66,6 +69,9 @@ public class EffectsAnalysis {
                                       ReachGraph rg, TempDescriptor lhs, FieldDescriptor fld, boolean strongUpdate) {
 
     VariableNode vn = rg.td2vn.get(lhs);
+    if( vn == null ) {
+      return;
+    }
 
     for (Iterator<RefEdge> iterator = vn.iteratorToReferencees(); iterator.hasNext();) {
       RefEdge edge = iterator.next();
@@ -89,12 +95,7 @@ public class EffectsAnalysis {
 
   public void analyzeFlatCall(FlatMethod fmContaining, FlatSESEEnterNode seseContaining, 
                               FlatMethod fmCallee, Hashtable<Taint, TaintSet> tCallee2tsCaller) {
-    
-    EffectSet esCaller = getEffectSet(fmContaining);
-    if( esCaller == null ) {
-      esCaller = new EffectSet();
-    }
-    
+        
     EffectSet esCallee = getEffectSet(fmCallee);
     if( esCallee == null ) {
       esCallee = new EffectSet();
@@ -111,6 +112,8 @@ public class EffectsAnalysis {
         Iterator<Taint> tItr = tCallee2tsCaller.get( tCallee ).iterator();
         while( tItr.hasNext() ) {
           Taint tCaller = tItr.next();
+          
+          EffectSet esCaller = new EffectSet();
 
           Iterator<Effect> eItr = effects.iterator();
           while( eItr.hasNext() ) {
@@ -120,7 +123,7 @@ public class EffectsAnalysis {
           }
 
           add( fmContaining,   tCaller, esCaller );
-          add( seseContaining, tCaller, esCaller );
+          add( seseContaining, tCaller, esCaller );    
         }
       }
     }
index 8db8adfc449a4dec60fc15ffd2d993ad4a9b8f5a..604c0fb0e1c0b6f628b7fd87e1850db98f29bf00 100644 (file)
@@ -73,7 +73,7 @@ public class ExistPred extends Canonical {
   protected TypeDescriptor e_type;
   protected String         e_field;                    
 
-  // edge uses same ReachState ne_state as node type above
+  
 
 
 
index 702071cfb97629168d2133cf4b053f2994dd4775..adf3a4108d9b66e14e818fd43ddf8a31dd6ee298 100644 (file)
@@ -659,7 +659,8 @@ public class ReachGraph {
                                                                   )
                                                ),
                        predsTrue,
-                       Canonical.makePredsTrue( edgeY.getTaints() )
+                       Canonical.changePredsTo( edgeY.getTaints(),
+                                                predsTrue )
                        );
 
         addEdgeOrMergeWithExisting( edgeNew );
@@ -705,7 +706,10 @@ public class ReachGraph {
       HeapRegionNode referencee = edgeX.getDst();
       RefEdge        edgeNew    = edgeX.copy();
       edgeNew.setSrc( lnR );
-      edgeNew.setTaints( Canonical.makePredsTrue( edgeNew.getTaints() ) );
+      edgeNew.setTaints( Canonical.changePredsTo( edgeNew.getTaints(),
+                                                  predsTrue 
+                                                  )
+                         );
 
       addRefEdge( lnR, referencee, edgeNew );
     }
@@ -1299,8 +1303,8 @@ public class ReachGraph {
     Iterator<TempDescriptor> isvItr = sese.getInVarSet().iterator();
     while( isvItr.hasNext() ) {
       TempDescriptor isv = isvItr.next();
-      VariableNode   vn  = td2vn.get( isv );
-    
+      VariableNode   vn  = getVariableNodeFromTemp( isv );
+
       Iterator<RefEdge> reItr = vn.iteratorToReferencees();
       while( reItr.hasNext() ) {
         RefEdge re = reItr.next();
@@ -1329,7 +1333,7 @@ public class ReachGraph {
                          ExistPredSet   preds
                          ) {
     
-    VariableNode vn = td2vn.get( td );
+    VariableNode vn = getVariableNodeFromTemp( td );
     
     Iterator<RefEdge> reItr = vn.iteratorToReferencees();
     while( reItr.hasNext() ) {
@@ -2057,7 +2061,8 @@ public class ReachGraph {
                                                      oocHrnIdOoc2callee
                                                      ),
                                     preds,
-                                    TaintSet.factory() // no taints
+                                    Canonical.changePredsTo( reCaller.getTaints(),
+                                                             preds )
                                     )
                        );              
         
@@ -2434,7 +2439,7 @@ public class ReachGraph {
                 calleeEdge2calleeTaintsSatisfied.put( reCallee, calleeTaintsSatisfied );
               }
 
-              calleeTaintsSatisfied.put( tCallee, predsIfSatis );              
+              calleeTaintsSatisfied.put( tCallee, predsIfSatis );
             } 
           }
         }        
index b000dbb238bcbc3a1567017acfa2818cb7e8b991..ab015921eea6ecc10bb0ab2bba7f144a2c5afc16 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
 
index f0f9b02a3a4993c475d625979f5a0a82ec9e1d06..f573d4193fd3cbb652b8983aee384b023357f411 100644 (file)
@@ -18,25 +18,24 @@ public class Test {
     */
     
     rblock r1 {
-      a.f = new Foo();
-      b.f = new Foo();
-
       doSomething( a, b );
     }
   }
 
   static void doSomething( Foo a, Foo b ) {
+    
+    Foo x = b;
+    a.g = x; 
 
-    a.g = new Foo();
-
-    a.f.f = a.g;
+    a.f = new Foo();
+    b.f = new Foo();
 
-    Foo f = doStuff( a, b );
+    Foo f = doStuff( a.f, b.f );
   }   
 
   static Foo doStuff( Foo m, Foo n ) {
 
-    m.f.g = n.f;
+    m.g = n;
 
     return new Foo();
   }