stall site critical regions implemented, including method calls and return values
authorjjenista <jjenista>
Tue, 29 Jun 2010 00:15:15 +0000 (00:15 +0000)
committerjjenista <jjenista>
Tue, 29 Jun 2010 00:15:15 +0000 (00:15 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Tests/disjoint/taintTest1/makefile
Robust/src/Tests/disjoint/taintTest1/test.java

index cf02283affb8d8ed3080fe956a5f3634ade6fc3e..69492e216e88c7283c11703c3748d960650cc96c 100644 (file)
@@ -934,10 +934,18 @@ public class DisjointAnalysis {
       }
 
 
+      //System.out.println( "At "+fn );
+      //System.out.println( "  inacc-in:  "+rg.getInaccessibleVars() );
+
+
       // modify rg with appropriate transfer function
       rg = analyzeFlatNode( d, fm, fn, setReturns, rg );
 
 
+      //System.out.println( "  inacc-out: "+rg.getInaccessibleVars() );
+      //System.out.println( "\n" );
+
+
       if( takeDebugSnapshots && 
          d.getSymbol().equals( descSymbolDebug ) 
           ) {
@@ -1426,7 +1434,7 @@ public class DisjointAnalysis {
                                    );
       }
 
-      ReachGraph rgMergeOfEffects = new ReachGraph();
+      ReachGraph rgMergeOfPossibleCallers = new ReachGraph();
 
       Iterator<MethodDescriptor> mdItr = setPossibleCallees.iterator();
       while( mdItr.hasNext() ) {
@@ -1439,12 +1447,12 @@ public class DisjointAnalysis {
         // don't alter the working graph (rg) until we compute a 
         // result for every possible callee, merge them all together,
         // then set rg to that
-        ReachGraph rgCopy = new ReachGraph();
-        rgCopy.merge( rg );            
+        ReachGraph rgPossibleCaller = new ReachGraph();
+        rgPossibleCaller.merge( rg );          
                 
-        ReachGraph rgEffect = getPartial( mdPossible );
+        ReachGraph rgPossibleCallee = getPartial( mdPossible );
 
-        if( rgEffect == null ) {
+        if( rgPossibleCallee == null ) {
           // if this method has never been analyzed just schedule it 
           // for analysis and skip over this call site for now
           if( state.DISJOINTDVISITSTACKEESONTOP ) {
@@ -1460,15 +1468,22 @@ public class DisjointAnalysis {
 
         } else {
           // calculate the method call transform         
-          rgCopy.resolveMethodCall( fc, 
-                                    fmPossible, 
-                                    rgEffect,
-                                    callerNodeIDsCopiedToCallee,
-                                    writeDebugDOTs
-                                    );
+          rgPossibleCaller.resolveMethodCall( fc, 
+                                              fmPossible, 
+                                              rgPossibleCallee,
+                                              callerNodeIDsCopiedToCallee,
+                                              writeDebugDOTs
+                                              );
+
+          if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+            if( !rgPossibleCallee.isAccessible( ReachGraph.tdReturn ) ) {
+              rgPossibleCaller.makeInaccessible( fc.getReturnTemp() );
+            }
+          }
+
         }
         
-        rgMergeOfEffects.merge( rgCopy );        
+        rgMergeOfPossibleCallers.merge( rgPossibleCaller );        
       }
 
 
@@ -1480,16 +1495,25 @@ public class DisjointAnalysis {
 
       // now that we've taken care of building heap models for
       // callee analysis, finish this transformation
-      rg = rgMergeOfEffects;
+      rg = rgMergeOfPossibleCallers;
     } break;
       
 
     case FKind.FlatReturnNode:
       FlatReturnNode frn = (FlatReturnNode) fn;
       rhs = frn.getReturnTemp();
+
+      // before transfer, do effects analysis support
+      if( doEffectsAnalysis && fmContaining != fmAnalysisEntry ) {
+        if(!rg.isAccessible(rhs)){
+          rg.makeInaccessible(ReachGraph.tdReturn);
+        }
+      }
+
       if( rhs != null && shouldAnalysisTrack( rhs.getType() ) ) {
        rg.assignReturnEqualToTemp( rhs );
       }
+
       setRetNodes.add( frn );
       break;
 
index c32826f3f8e9dfd79e476ad46c2bb2d831fada27..f9fc18c8f6a700918004044a821d2ab7465877c0 100644 (file)
@@ -43,6 +43,7 @@ public class ReachGraph {
   // with respect to stall-site analysis
   public Set<TempDescriptor> inaccessibleVars;
 
+
   public ReachGraph() {
     id2hrn           = new Hashtable<Integer,        HeapRegionNode>();
     td2vn            = new Hashtable<TempDescriptor, VariableNode  >();
index 5b0554bcfd4012953fd830f96a397e31b4e84eb6..5139950eb2bd4628414d1bb26a3fc993a73cb3f5 100644 (file)
@@ -4,8 +4,8 @@ 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
+BSFLAGS= -mainclass Test -joptimize -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
 
 all: $(PROGRAM).bin
 
index d6efcf9230ad705e64b05df90ea4584197503a5a..13fc494b383bc25dc9e6db3669b43c30599d274b 100644 (file)
@@ -11,42 +11,29 @@ public class Test {
 
     Foo a = new Foo();
     Foo b = new Foo();
-    Foo bbb = new Foo();
-    
-    bbb.f=new Foo();
+
     rblock r1 {
-       
-       a.f=new Foo();
-       a.a=2;
-       /*
-       while(1==1){    
-           Foo yyy = b.f; 
-           rblock rr1{
-               b.f=new Foo();
-           }
-           
-           rblock rr2{
-               b.f=new Foo();
-           }
-           
-       }    
-       */
-    }
-    Foo xxx = a.f;
-    //xxx.a=100;
-    xxx.f=new Foo();
-    Foo zzz=xxx.f;
-    zzz.a=100;
+      Foo x = doSomething( a, b );
 
+      // 1 - STALL
+      // 2 - NO STALL
+      b.f = x.g;
+    }
   }
    
-  static void doSomething( Foo a, Foo b ) {
+  static Foo doSomething( Foo a, Foo b ) {
+
+    Foo z = new Foo();
+
+    rblock c1 {
+      z.g = new Foo();
+    }
 
-    a.g = new Foo();
-    
-    a.f.f = a.g;
+    // 1 (this line commented)
+    // 2 (STALL HERE!)
+    //z.g = b;
 
-    Foo f = doStuff( a, b );
+    return z;
   }   
 
   static Foo doStuff( Foo m, Foo n ) {