debugging something else, but commiting this bug fix--mapping out-of-context nodes...
authorjjenista <jjenista>
Thu, 11 Mar 2010 23:38:53 +0000 (23:38 +0000)
committerjjenista <jjenista>
Thu, 11 Mar 2010 23:38:53 +0000 (23:38 +0000)
Robust/src/Analysis/Disjoint/ReachGraph.java
Robust/src/Analysis/Disjoint/VariableNode.java
Robust/src/Tests/disjoint/predicateTest2/makefile
Robust/src/Tests/disjoint/predicateTest2/test.java

index 283e0cd21433da8adbd1f64c1432c59031c84359..3afd0f8f88f7f0d7e5dff3fd86c1d73bd02bead9 100644 (file)
@@ -1264,7 +1264,7 @@ public class ReachGraph {
   // this reach graph
   public ReachGraph 
     makeCalleeView( FlatCall     fc,
-                    FlatMethod   fm,
+                    FlatMethod   fmCallee,
                     Set<Integer> callerNodeIDsCopiedToCallee,
                     boolean      writeDebugDOTs
                     ) {
@@ -1286,16 +1286,16 @@ public class ReachGraph {
     // mechanically-reachable-from-arguments graph
     // as opposed to using reachability information
     // to prune the graph further
-    for( int i = 0; i < fm.numParameters(); ++i ) {
+    for( int i = 0; i < fmCallee.numParameters(); ++i ) {
 
       // for each parameter index, get the symbol in the
       // caller view and callee view
       
       // argument defined here is the symbol in the caller
-      TempDescriptor tdArg = fc.getArgMatchingParamIndex( fm, i );
+      TempDescriptor tdArg = fc.getArgMatchingParamIndex( fmCallee, i );
 
       // parameter defined here is the symbol in the callee
-      TempDescriptor tdParam = fm.getParameter( i );
+      TempDescriptor tdParam = fmCallee.getParameter( i );
 
       // use these two VariableNode objects to translate
       // between caller and callee--its easy to compare
@@ -1528,6 +1528,7 @@ public class ReachGraph {
           // for consistency, map one out-of-context "identifier"
           // to one heap region node id, otherwise no convergence
           String oocid = "oocid"+
+            fmCallee+
             hrnCalleeAndInContext.getIDString()+
             oocNodeType+
             edgeMightCross.getType()+
@@ -1608,7 +1609,7 @@ public class ReachGraph {
 
   public void 
     resolveMethodCall( FlatCall     fc,        
-                       FlatMethod   fm,        
+                       FlatMethod   fmCallee,        
                        ReachGraph   rgCallee,
                        Set<Integer> callerNodeIDsCopiedToCallee,
                        boolean      writeDebugDOTs
@@ -1687,10 +1688,10 @@ public class ReachGraph {
     }
 
     // test param -> HRN edges, also
-    for( int i = 0; i < fm.numParameters(); ++i ) {
+    for( int i = 0; i < fmCallee.numParameters(); ++i ) {
 
       // parameter defined here is the symbol in the callee
-      TempDescriptor tdParam  = fm.getParameter( i );
+      TempDescriptor tdParam  = fmCallee.getParameter( i );
       VariableNode   vnCallee = rgCallee.getVariableNodeFromTemp( tdParam );
 
       Iterator<RefEdge> reItr = vnCallee.iteratorToReferencees();
@@ -1837,7 +1838,7 @@ public class ReachGraph {
         // come into the caller if its from a param var
         VariableNode   vnCallee = (VariableNode) rsnCallee;
         TempDescriptor tdParam  = vnCallee.getTempDescriptor();
-        TempDescriptor tdArg    = fc.getArgMatchingParam( fm,
+        TempDescriptor tdArg    = fc.getArgMatchingParam( fmCallee,
                                                           tdParam );
         if( tdArg == null ) {
           // this means the variable isn't a parameter, its local
@@ -1861,11 +1862,22 @@ public class ReachGraph {
           // for out-of-context sources we have to find all
           // caller sources that might match
           assert hrnDstCaller != null;
+
+          if( writeDebugDOTs ) {
+            System.out.println( "  looking for matches for OOC: "+reCallee );
+          }
           
           Iterator<RefEdge> reItr = hrnDstCaller.iteratorToReferencers();
           while( reItr.hasNext() ) {
             // the edge and field (either possibly null) must match
             RefEdge reCaller = reItr.next();
+
+
+            if( writeDebugDOTs ) {
+              System.out.println( "    considering: "+reCaller );
+            }
+
+
             if( !reCaller.typeEquals ( reCallee.getType()  ) ||
                 !reCaller.fieldEquals( reCallee.getField() ) 
                 ) {
@@ -1887,6 +1899,12 @@ public class ReachGraph {
               }
             }
 
+
+            if( writeDebugDOTs ) {
+              System.out.println( "    took it" );
+            }
+
+
             // it matches, add to sources of edges to make
             rsnCallers.add( rsnCaller );
           }
@@ -1991,12 +2009,12 @@ public class ReachGraph {
                                      hrnDstCallee.isSingleObject(), // single object?           
                                      hrnDstCallee.isNewSummary(),   // summary?         
                                      hrnDstCallee.isFlagged(),      // flagged?
-                                     false,                      // out-of-context?
+                                     false,                         // out-of-context?
                                      hrnDstCallee.getType(),        // type                             
                                      hrnDstCallee.getAllocSite(),   // allocation site                  
                                      hrnDstCallee.getInherent(),    // inherent reach
-                                     null,                       // current reach                 
-                                     predsTrue,                 // predicates
+                                     null,                          // current reach                 
+                                     predsTrue,                     // predicates
                                      hrnDstCallee.getDescription()  // description
                                      );                                        
         } else {
index 7e58ea79b5a5e28272e8bd2b78792ee9e9619c52..a2db14ca4d30af351466032f09d7cab422ffb85d 100644 (file)
@@ -7,7 +7,7 @@ import java.util.*;
 public class VariableNode extends RefSrcNode {
   protected TempDescriptor td;
 
-  public VariableNode(TempDescriptor td) {
+  public VariableNode( TempDescriptor td ) {
     this.td = td;
   }
 
@@ -15,18 +15,18 @@ public class VariableNode extends RefSrcNode {
     return td;
   }
 
-  public boolean equals(Object o) {
+  public boolean equals( Object o ) {
     if( o == null ) {
       return false;
     }
 
-    if( !( o instanceof VariableNode) ) {
+    if( !(o instanceof VariableNode) ) {
       return false;
     }
 
-    VariableNode ln = (VariableNode) o;
+    VariableNode vn = (VariableNode) o;
 
-    return td == ln.getTempDescriptor();
+    return td == vn.getTempDescriptor();
   }
 
   public int hashCode() {
@@ -38,6 +38,6 @@ public class VariableNode extends RefSrcNode {
   }
 
   public String toString() {
-    return "LN_"+getTempDescriptorString();
+    return "VN_"+getTempDescriptorString();
   }
 }
index 628bc7d514cdd08fb9bdc8da763ec48117ab9341..e80e242c3c572a92eedb5408dacfd53b4c4f65ad 100644 (file)
@@ -8,8 +8,8 @@ BUILDSCRIPT=~/research/Robust/src/buildscript
 #DEBUGFLAGS= -disjoint-debug-callsite Foo main 1
 
 #DEBUGFLAGS= -disjoint-debug-callsite main analysisEntryMethod 1
-#DEBUGFLAGS= -disjoint-debug-callsite addSomething main 1
-DEBUGFLAGS= -disjoint-debug-callsite addBar addSomething 1
+DEBUGFLAGS= -disjoint-debug-callsite addSomething main 1
+#DEBUGFLAGS= -disjoint-debug-callsite addBar addSomething 1
 #DEBUGFLAGS= -disjoint-debug-callsite Bar addBar 1
 #DEBUGFLAGS=
 
index ee4e9211fb88906d0bbd43c6d9e92a48007d49bd..1ee29c72aca5faece9490ed6d85e74a70ccbebc3 100644 (file)
@@ -13,29 +13,30 @@ public class Test {
   static public void main( String[] args ) {
 
     Foo f1 = new Foo();
-    Foo extraVar = f1;
+    //Foo extraVar = f1;
     addSomething( f1 );
     
-    Foo f2 = new Foo();
-    addSomething( f2 );    
+    //Foo f2 = new Foo();
+    //addSomething( f2 );    
 
+    /*
     Foo f3 = getAFoo();
     Foo f4 = getAFoo();
     f3.f = f4;
+    */
   }   
 
   public static void addSomething( Foo f ) {
+    f.b = new Bar();
     //addBar( f );
   }
 
-  public static void addBar( Foo g ) {
-    /*
+  public static void addBar( Foo g ) {    
     if( true ) {
       g.b = new Bar();
     } else {
       g.b = new Bar();
-    }
-    */
+    }    
   }
 
   public static Foo getAFoo() {