From: jjenista <jjenista>
Date: Tue, 29 Jun 2010 00:15:15 +0000 (+0000)
Subject: stall site critical regions implemented, including method calls and return values
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=f4c0f0030b50b40f6abeec29bd2a9f84e273d44e;p=IRC.git

stall site critical regions implemented, including method calls and return values
---

diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java
index cf02283a..69492e21 100644
--- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java
+++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java
@@ -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;
 
diff --git a/Robust/src/Analysis/Disjoint/ReachGraph.java b/Robust/src/Analysis/Disjoint/ReachGraph.java
index c32826f3..f9fc18c8 100644
--- a/Robust/src/Analysis/Disjoint/ReachGraph.java
+++ b/Robust/src/Analysis/Disjoint/ReachGraph.java
@@ -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  >();
diff --git a/Robust/src/Tests/disjoint/taintTest1/makefile b/Robust/src/Tests/disjoint/taintTest1/makefile
index 5b0554bc..5139950e 100644
--- a/Robust/src/Tests/disjoint/taintTest1/makefile
+++ b/Robust/src/Tests/disjoint/taintTest1/makefile
@@ -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
 
diff --git a/Robust/src/Tests/disjoint/taintTest1/test.java b/Robust/src/Tests/disjoint/taintTest1/test.java
index d6efcf92..13fc494b 100644
--- a/Robust/src/Tests/disjoint/taintTest1/test.java
+++ b/Robust/src/Tests/disjoint/taintTest1/test.java
@@ -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 ) {