getting closer, still major bugs in call site transfer function
authorjjenista <jjenista>
Thu, 4 Mar 2010 08:23:56 +0000 (08:23 +0000)
committerjjenista <jjenista>
Thu, 4 Mar 2010 08:23:56 +0000 (08:23 +0000)
Robust/src/Analysis/Disjoint/ExistPred.java
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Tests/disjoint/predicateTest2/makefile

index 1304ef9478d7623712617b7bd8d263c76c8da220..0581100a2657bb861b2b08b78fced328ddc4ca27 100644 (file)
@@ -189,10 +189,20 @@ public class ExistPred extends Canonical {
     }
     
     if( predType == TYPE_EDGE ) {
+
+      System.out.println( "    type==edge" );
+
       // first establish whether the source of the
       // reference edge exists
-      VariableNode   vnSrc  = rg.td2vn.get( e_tdSrc );
-      HeapRegionNode hrnSrc = rg.id2hrn.get( e_hrnSrcID );
+      VariableNode vnSrc = null;
+      if( e_tdSrc != null ) {
+        vnSrc = rg.td2vn.get( e_tdSrc );
+        System.out.println( "    vnSrc="+vnSrc );
+      }
+      HeapRegionNode hrnSrc = null;
+      if( e_hrnSrcID != null ) {
+        hrnSrc = rg.id2hrn.get( e_hrnSrcID );
+      }
       assert (vnSrc == null) || (hrnSrc == null);
     
       // the source is not present in graph
@@ -221,6 +231,8 @@ public class ExistPred extends Canonical {
       }
         
     
+      System.out.println( "    check the edge..." );
+
       // is there an edge between them with the given
       // type and field?
       // TODO: type OR a subtype?
@@ -228,10 +240,12 @@ public class ExistPred extends Canonical {
                                          e_type, 
                                          e_field );
       if( edge == null ) {
+        System.out.println( "    edge is null!" );
         return false;
       }
                                                 
       if( !calleeReachableEdges.contains( edge ) ) {
+        System.out.println( "    edge not reachable!" );
         return false;
       }
 
index 07832de4935020f5253c873a7cb8a71766283879..e695e57060fb7e40899aabb3f8fd055534738b04 100644 (file)
@@ -1428,8 +1428,10 @@ public class ReachGraph {
     // 4. Global sweep it.
 
 
-    System.out.println( );
 
+    if( writeDebugDOTs ) {
+      System.out.println( "doing call site, edges:"+callerEdgesCopiedToCallee );
+    }
 
 
     // 1. mark what callee elements have satisfied predicates
@@ -1454,7 +1456,9 @@ public class ReachGraph {
 
 
         
-
+        if( writeDebugDOTs ) {
+          System.out.println( "  node satissfied: "+hrnCallee );
+        }
 
       }
 
@@ -1472,12 +1476,56 @@ public class ReachGraph {
       }
     }
 
+    // test param -> HRN edges, also
+    for( int i = 0; i < fm.numParameters(); ++i ) {
+
+      // parameter defined here is the symbol in the callee
+      TempDescriptor tdParam  = fm.getParameter( i );
+      VariableNode   vnCallee = rgCallee.getVariableNodeFromTemp( tdParam );
+
+      Iterator<RefEdge> reItr = vnCallee.iteratorToReferencees();
+      while( reItr.hasNext() ) {
+        RefEdge reCallee = reItr.next();
+
+
+        if( writeDebugDOTs ) {
+          System.out.println( "  satisfied?: "+reCallee );
+        }
+
+        
+        if( reCallee.getPreds().isSatisfiedBy( this,
+                                               callerNodesCopiedToCallee,
+                                               callerEdgesCopiedToCallee
+                                               )
+            ) {
+          calleeEdgesSatisfied.add( reCallee );
+
+          if( writeDebugDOTs ) {
+            System.out.println( "  satisfied: "+reCallee );
+          }
+        }        
+
+        else 
+          if( writeDebugDOTs ) {
+            System.out.println( "  NOT satisfied: "+reCallee );
+          }
+
+
+      }
+
+    }
+
+
 
     // 2. predicates tested, ok to wipe out caller part
     Iterator<HeapRegionNode> hrnItr = callerNodesCopiedToCallee.iterator();
     while( hrnItr.hasNext() ) {
       HeapRegionNode hrnCaller = hrnItr.next();
       wipeOut( hrnCaller );
+
+      if( writeDebugDOTs ) {
+        System.out.println( "  wiping: "+hrnCaller );
+      }
     }
 
 
@@ -1509,6 +1557,10 @@ public class ReachGraph {
                                    );                                        
       }
 
+      if( writeDebugDOTs ) {
+        System.out.println( "  stitching in: "+hrnCaller );
+      }
+
       // TODO: alpha should be some rewritten version of callee in caller context
       hrnCaller.setAlpha( rsetEmpty );
 
@@ -1529,6 +1581,11 @@ public class ReachGraph {
         TempDescriptor tdParam  = vnCallee.getTempDescriptor();
         TempDescriptor tdArg    = fc.getArgMatchingParam( fm,
                                                           tdParam );
+
+        if( writeDebugDOTs ) {
+          System.out.println( "  considering: "+rsnCallee );
+        }
+
         if( tdArg == null ) {
           // this means the variable isn't a parameter, its local
           // to the callee so we ignore it in call site transfer
@@ -1536,6 +1593,10 @@ public class ReachGraph {
         }
         
         rsnCaller = this.getVariableNodeFromTemp( tdArg );
+
+        if( writeDebugDOTs ) {
+          System.out.println( "  stitching in: "+rsnCaller );
+        }
                   
       } else {
         HeapRegionNode hrnSrcCallee = (HeapRegionNode) reCallee.getSrc();
index 0b6c69805748075712e3dd4614b8e9ad7006ac57..dac21d9c386d0d7edb020b75723040a036b9e109 100644 (file)
@@ -3,6 +3,9 @@ PROGRAM=test
 SOURCE_FILES=$(PROGRAM).java
 
 BUILDSCRIPT=~/research/Robust/src/buildscript
+DEBUGFLAGS= -disjoint-debug-callsite Bar    addBar       1
+DEBUGFLAGS= -disjoint-debug-callsite addBar addSomething 1
+#DEBUGFLAGS=
 BSFLAGS= -mainclass Test -justanalyze -disjoint -disjoint-k 2 -disjoint-write-dots final -disjoint-write-ihms -disjoint-alias-file aliases.txt normal -enable-assertions
 
 all: $(PROGRAM).bin
@@ -16,7 +19,7 @@ PNGs: DOTs
 DOTs: $(PROGRAM).bin
 
 $(PROGRAM).bin: $(SOURCE_FILES)
-       $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES)
+       $(BUILDSCRIPT) $(BSFLAGS) $(DEBUGFLAGS) -o $(PROGRAM) $(SOURCE_FILES)
 
 OLDBSFLAGS= -mainclass Test -justanalyze -ownership -ownallocdepth 1 -ownwritedots final -enable-assertions
 old: $(SOURCE_FILES)