trying to fix call site transfer bug, fixed caused other problems, still working...
authorjjenista <jjenista>
Sat, 20 Mar 2010 00:38:06 +0000 (00:38 +0000)
committerjjenista <jjenista>
Sat, 20 Mar 2010 00:38:06 +0000 (00:38 +0000)
Robust/src/Analysis/Disjoint/ExistPred.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Analysis/Disjoint/ReachSet.java
Robust/src/Analysis/Disjoint/RefEdge.java

index 88267e1df2abda3feaef4493f61b39a0b2d1f038..1bd58318191c9fca859ae4948cda721c264dac32 100644 (file)
@@ -194,7 +194,8 @@ public class ExistPred extends Canonical {
 
       // otherwise look for state too
       // TODO: contains OR containsSuperSet OR containsWithZeroes??
-      if( hrn.getAlpha().contains( ne_state ) ) {
+      if( hrn.getAlpha().containsIgnorePreds( ne_state ) 
+          == null ) {
         return hrn.getPreds();
       }
 
@@ -213,6 +214,10 @@ public class ExistPred extends Canonical {
         hrnSrc = rg.id2hrn.get( e_hrnSrcID );
       }
       assert (vnSrc == null) || (hrnSrc == null);
+
+      
+      System.out.println( "      checking if src in graph" );
+
     
       // the source is not present in graph
       if( vnSrc == null && hrnSrc == null ) {
@@ -223,15 +228,28 @@ public class ExistPred extends Canonical {
       if( vnSrc != null ) {
         rsn = vnSrc;
       } else {
-        if( !calleeReachableNodes.contains( e_hrnSrcID ) && !e_srcOutContext ) {
-          return null;
-        }
-        if( calleeReachableNodes.contains( e_hrnSrcID ) && e_srcOutContext ) {
-          return null;
+
+
+        System.out.println( "      doing this thing, reachable nodes: "+calleeReachableNodes );
+
+        if( e_srcOutContext ) {
+          if( !hrnSrc.isOutOfContext() ) {
+            return null;
+          }
+        } else {
+          if( hrnSrc.isOutOfContext() ) {
+            return null;
+          }
         }
+
         rsn = hrnSrc;
       }
 
+
+
+      System.out.println( "      checking if dst in graph" );
+
+
       // is the destination present?
       HeapRegionNode hrnDst = rg.id2hrn.get( e_hrnDstID );
       if( hrnDst == null ) {
@@ -242,6 +260,11 @@ public class ExistPred extends Canonical {
         return null;
       }
 
+
+
+      System.out.println( "      checking if edge/type/field matches" );
+
+
       // is there an edge between them with the given
       // type and field?
       // TODO: type OR a subtype?
@@ -258,9 +281,14 @@ public class ExistPred extends Canonical {
         return edge.getPreds();
       }
       
+
+      System.out.println( "      state not null, checking for existence" );
+
+
       // otherwise look for state too
       // TODO: contains OR containsSuperSet OR containsWithZeroes??
-      if( hrnDst.getAlpha().contains( ne_state ) ) {
+      if( hrnDst.getAlpha().containsIgnorePreds( ne_state ) 
+          == null ) {
         return edge.getPreds();
       }
 
index 7450222138155baeca34fd9f1b6c01c5a0052f91..661c43b9e0bbddc051b537df9cfe4b60c781e0f5 100644 (file)
@@ -1444,10 +1444,10 @@ public class ReachGraph {
                                           calleeStatesSatisfied.get( stateCallee )
                                           );        
           out = Canonical.add( out,
-                                 stateCaller
-                                 );
+                               stateCaller
+                               );
         }
-      }
+      } 
     }    
 
     assert out.isCanonical();
@@ -1748,19 +1748,22 @@ public class ReachGraph {
       ReachSet       oocReach;
       TempDescriptor oocPredSrcTemp = null;
       Integer        oocPredSrcID   = null;
+      boolean        oocooc;
 
       if( rsnCaller instanceof VariableNode ) {
         VariableNode vnCaller = (VariableNode) rsnCaller;
         oocNodeType    = null;
         oocReach       = rsetEmpty;
         oocPredSrcTemp = vnCaller.getTempDescriptor();
+        oocooc         = false;
 
       } else {
         HeapRegionNode hrnSrcCaller = (HeapRegionNode) rsnCaller;
         assert !callerNodeIDsCopiedToCallee.contains( hrnSrcCaller.getID() );
         oocNodeType  = hrnSrcCaller.getType();
         oocReach     = hrnSrcCaller.getAlpha(); 
-        oocPredSrcID = hrnSrcCaller.getID();        
+        oocPredSrcID = hrnSrcCaller.getID();
+        oocooc       = hrnSrcCaller.isOutOfContext();
       }
 
       ExistPred pred =
@@ -1770,7 +1773,7 @@ public class ReachGraph {
                            reCaller.getType(),
                            reCaller.getField(),
                            null,
-                           true ); // out-of-context
+                           oocooc ); // out-of-context
 
       ExistPredSet preds = 
         ExistPredSet.factory( pred );
@@ -2038,6 +2041,12 @@ public class ReachGraph {
           continue;
         }        
 
+
+        
+        System.out.println( "  preds satisfied? for "+reCallee+" "+reCallee.getPreds() );
+        
+
+
         // first see if the source is out-of-context, and only
         // proceed with this edge if we find some caller-context
         // matches
@@ -2118,8 +2127,14 @@ public class ReachGraph {
             } 
           }
 
+          System.out.println( "    YES" );
         }        
 
+
+        else {
+          System.out.println( "    NO" );
+        }
+
       }
     }
 
@@ -2421,6 +2436,7 @@ public class ReachGraph {
           }
         }
         
+
         // look to see if an edge with same field exists
         // and merge with it, otherwise just add the edge
         RefEdge edgeExisting = rsnCaller.getReferenceTo( hrnDstCaller,
@@ -3096,7 +3112,8 @@ public class ReachGraph {
             if( B != null ) {            
               ReachSet boldB_rtOld_incident = B.get( incidentEdge );
               if( boldB_rtOld_incident != null &&
-                  boldB_rtOld_incident.contains( stateOld ) ) {
+                  boldB_rtOld_incident.containsIgnorePreds( stateOld ) != null
+                  ) {
                 foundState = true;
               }
             }
index 49417732c2e1c199e2cb5c53595240a35169ea7b..c5cf394765c19b1cddaa07aff179ed4e35d14844 100644 (file)
@@ -62,11 +62,6 @@ public class ReachSet extends Canonical {
     return reachStates.isEmpty();
   }
 
-  public boolean contains( ReachState state ) {
-    assert state != null;
-    return reachStates.contains( state );
-  }
-
   // this should be a hash table so we can do this by key
   public ReachState containsIgnorePreds( ReachState state ) {
     assert state != null;
index 9883bfb1074df4d143dfbdc8f8d37446bc011cd6..c66b699d1a185fdba67a0f46742757918692aaa5 100644 (file)
@@ -238,4 +238,8 @@ public class RefEdge {
                        "->"+dst+")"
                        );
   }  
+
+  public String toStringAndBeta() {
+    return toString()+beta.toString();
+  }
 }