collect last night's changes
authorjjenista <jjenista>
Fri, 26 Mar 2010 15:56:27 +0000 (15:56 +0000)
committerjjenista <jjenista>
Fri, 26 Mar 2010 15:56:27 +0000 (15:56 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Analysis/Disjoint/ReachState.java

index ab0fda06d8922f587303aa039d18b826ef7ffd81..87c0ab1f76192e5962463d2ddc3879ac4bd76c9a 100644 (file)
@@ -1046,7 +1046,7 @@ public class DisjointAnalysis {
     //rg.abstractGarbageCollect();
     //rg.globalSweep();
 
-
+    
     // at this point rg should be the correct update
     // by an above transfer function, or untouched if
     // the flat node type doesn't affect the heap
@@ -1633,7 +1633,7 @@ private Set<FieldDescriptor> getFieldSetTobeAnalyzed(TypeDescriptor typeDesc){
                                                           false, // out-of-context?
                                                           as.getType(), // type
                                                           as, // allocation site
-                                                          null, // inherent reach
+                                                          alpha, // inherent reach
                                                           alpha, // current reach
                                                           ExistPredSet.factory(rg.predTrue), // predicates
                                                           tempDesc.toString() // description
@@ -1691,7 +1691,7 @@ private Set<FieldDescriptor> getFieldSetTobeAnalyzed(TypeDescriptor typeDesc){
                                                           false, // out-of-context?
                                                           typeDesc, // type
                                                           as, // allocation site
-                                                          null, // inherent reach
+                                                          alpha, // inherent reach
                                                           alpha, // current reach
                                                           ExistPredSet.factory(rg.predTrue), // predicates
                                                           tempDesc.toString() // description
@@ -1750,6 +1750,7 @@ private ReachGraph createInitialTaskReachGraph(FlatMethod fm) {
        VariableNode lnX = rg.getVariableNodeFromTemp(tempDesc);
        Integer idNewest = as.getIthOldest(0);
        HeapRegionNode hrnNewest = rg.id2hrn.get(idNewest);
+
        // make a new reference to allocated node
        RefEdge edgeNew = new RefEdge(lnX, // source
                                      hrnNewest, // dest
@@ -1759,7 +1760,7 @@ private ReachGraph createInitialTaskReachGraph(FlatMethod fm) {
                                      ExistPredSet.factory(rg.predTrue) // predicates
                                      );
        rg.addRefEdge(lnX, hrnNewest, edgeNew);
-       
+
        // set-up a work set for class field
        ClassDescriptor classDesc = paramTypeDesc.getClassDesc();
        for (Iterator it = classDesc.getFields(); it.hasNext();) {
@@ -1814,7 +1815,7 @@ private ReachGraph createInitialTaskReachGraph(FlatMethod fm) {
                                                                   false, // out-of-context?
                                                                   allocSite.getType(), // type
                                                                   allocSite, // allocation site
-                                                                  null, // inherent reach
+                                                                  hrnNewest.getAlpha(), // inherent reach
                                                                   hrnNewest.getAlpha(), // current reach
                                                                   ExistPredSet.factory(rg.predTrue), // predicates
                                                                   strDesc // description
index 1ce537454ec1b5d67ad4a618db3c5dca561aab20..6f2c42bcd4a3ca298495f644031ef15fba4932d1 100644 (file)
@@ -1433,7 +1433,7 @@ public class ReachGraph {
                                stateCaller
                                );
         }
-      } 
+      }
     }    
 
     assert out.isCanonical();
@@ -2141,60 +2141,6 @@ public class ReachGraph {
         }        
       }
     }
-    /*
-    // test param -> HRN edges, also
-    for( int i = 0; i < fmCallee.numParameters(); ++i ) {
-
-      // parameter defined here is the symbol in the callee
-      TempDescriptor tdParam = fmCallee.getParameter( i );
-
-      if( !DisjointAnalysis.shouldAnalysisTrack( tdParam.getType() ) ) {
-        // skip primitive/immutable parameters
-        continue;
-      }
-
-      VariableNode vnCallee = rgCallee.getVariableNodeFromTemp( tdParam );
-
-      Iterator<RefEdge> reItr = vnCallee.iteratorToReferencees();
-      while( reItr.hasNext() ) {
-        RefEdge reCallee = reItr.next();
-        
-        ExistPredSet ifDst = 
-          reCallee.getDst().getPreds().isSatisfiedBy( this,
-                                                      callerNodeIDsCopiedToCallee
-                                                      );
-        if( ifDst == null ) {
-          continue;
-        }
-        
-        ExistPredSet predsIfSatis = 
-          reCallee.getPreds().isSatisfiedBy( this,
-                                             callerNodeIDsCopiedToCallee
-                                             );
-        if( predsIfSatis != null ) {
-          calleeEdgesSatisfied.put( reCallee, predsIfSatis );
-
-          // since the edge is coming over, find out which reach
-          // states on it should come over, too
-          Iterator<ReachState> stateItr = reCallee.getBeta().iterator();
-          while( stateItr.hasNext() ) {
-            ReachState stateCallee = stateItr.next();
-            
-            predsIfSatis = 
-              stateCallee.getPreds().isSatisfiedBy( this,
-                                                    callerNodeIDsCopiedToCallee
-                                                    );
-            if( predsIfSatis != null ) {
-              calleeStatesSatisfied.put( stateCallee, predsIfSatis );
-            } 
-          }
-
-        }        
-      }
-      }*/
-
-
-
 
     if( writeDebugDOTs ) {
       writeGraph( debugGraphPrefix+"caller20BeforeWipe", 
@@ -2230,6 +2176,8 @@ public class ReachGraph {
     }
 
 
+
+
     // 3. callee elements with satisfied preds come in, note that
     //    the mapping of elements satisfied to preds is like this:
     //    A callee element EE has preds EEp that are satisfied by
@@ -2287,6 +2235,8 @@ public class ReachGraph {
 
 
 
+
+
     if( writeDebugDOTs ) {
       writeGraph( debugGraphPrefix+"caller31BeforeAddingEdges", 
                   resolveMethodDebugDOTwriteLabels,    
@@ -2478,7 +2428,6 @@ public class ReachGraph {
 
 
 
-
     if( writeDebugDOTs ) {
       writeGraph( debugGraphPrefix+"caller35BeforeAssignReturnValue", 
                   resolveMethodDebugDOTwriteLabels,    
@@ -2591,6 +2540,7 @@ public class ReachGraph {
 
 
 
+
     if( writeDebugDOTs ) {
       writeGraph( debugGraphPrefix+"caller40BeforeShadowMerge", 
                   resolveMethodDebugDOTwriteLabels,    
@@ -2690,6 +2640,10 @@ public class ReachGraph {
     }
 
 
+
+
+
+
     if( writeDebugDOTs ) {
       writeGraph( debugGraphPrefix+"caller45BeforeUnshadow", 
                   resolveMethodDebugDOTwriteLabels,    
@@ -2716,6 +2670,7 @@ public class ReachGraph {
     
 
 
+
     if( writeDebugDOTs ) {
       writeGraph( debugGraphPrefix+"caller50BeforeGlobalSweep", 
                   resolveMethodDebugDOTwriteLabels,    
@@ -2733,6 +2688,8 @@ public class ReachGraph {
     
 
 
+
+
     if( writeDebugDOTs ) {
       writeGraph( debugGraphPrefix+"caller90AfterTransfer", 
                   resolveMethodDebugDOTwriteLabels,    
@@ -3290,6 +3247,7 @@ public class ReachGraph {
   // any node should name a node that is
   // part of the graph
   public boolean inContextTuplesInGraph() {
+
     Iterator hrnItr = id2hrn.entrySet().iterator();
     while( hrnItr.hasNext() ) {
       Map.Entry      me  = (Map.Entry)      hrnItr.next();
@@ -3341,6 +3299,74 @@ public class ReachGraph {
   }
 
 
+  // another useful assertion for debugging
+  public boolean noEmptyReachSetsInGraph() {
+    
+    Iterator hrnItr = id2hrn.entrySet().iterator();
+    while( hrnItr.hasNext() ) {
+      Map.Entry      me  = (Map.Entry)      hrnItr.next();
+      HeapRegionNode hrn = (HeapRegionNode) me.getValue();
+
+      if( !hrn.isOutOfContext() && 
+          !hrn.isWiped()        &&
+          hrn.getAlpha().isEmpty() 
+          ) {
+        System.out.println( "!!! "+hrn+" has an empty ReachSet !!!" );
+        return false;
+      }
+
+      Iterator<RefEdge> edgeItr = hrn.iteratorToReferencers();
+      while( edgeItr.hasNext() ) {
+        RefEdge edge = edgeItr.next();
+
+        if( edge.getBeta().isEmpty() ) {
+          System.out.println( "!!! "+edge+" has an empty ReachSet !!!" );
+          return false;
+        }
+      }
+    }
+    
+    return true;
+  }
+
+
+  public boolean everyReachStateWTrue() {
+
+    Iterator hrnItr = id2hrn.entrySet().iterator();
+    while( hrnItr.hasNext() ) {
+      Map.Entry      me  = (Map.Entry)      hrnItr.next();
+      HeapRegionNode hrn = (HeapRegionNode) me.getValue();
+
+      {
+        Iterator<ReachState> stateItr = hrn.getAlpha().iterator();
+        while( stateItr.hasNext() ) {
+          ReachState state = stateItr.next();
+          
+          if( !state.getPreds().equals( predsTrue ) ) {
+            return false;
+          }
+        }
+      }
+
+      Iterator<RefEdge> edgeItr = hrn.iteratorToReferencers();
+      while( edgeItr.hasNext() ) {
+        RefEdge edge = edgeItr.next();
+
+        Iterator<ReachState> stateItr = edge.getBeta().iterator();
+        while( stateItr.hasNext() ) {
+          ReachState state = stateItr.next();
+
+          if( !state.getPreds().equals( predsTrue ) ) {
+            return false;
+          }
+        }
+      }
+    }
+
+    return true;
+  }
+  
+
 
 
   ////////////////////////////////////////////////////
index 41b839a4bc10b2b8f8b12844ded9598c5745f722..6b8e14e4a2024c2a8f01db011740d87196d1ac9d 100644 (file)
@@ -152,8 +152,8 @@ public class ReachState extends Canonical {
 
 
   public String toString() {
-    //return reachTuples.toString();
-    return reachTuples+":"+preds;
+    return reachTuples.toString();
+    //return reachTuples+":"+preds;
   }
 
   public String toStringPreds() {