improve call site debugging for disjoint
authorjjenista <jjenista>
Thu, 28 Apr 2011 22:58:29 +0000 (22:58 +0000)
committerjjenista <jjenista>
Thu, 28 Apr 2011 22:58:29 +0000 (22:58 +0000)
Robust/src/Analysis/Disjoint/DisjointAnalysis.java
Robust/src/Benchmarks/oooJava/master-makefile
Robust/src/Main/Main.java

index 37a5434187c43d4faf91027e829bd9c7a144029a..4a4ec001cad5efaa74c482dd0f6897cc5b37a282 100644 (file)
@@ -1010,6 +1010,23 @@ public class DisjointAnalysis implements HeapAnalysis {
     // the final, conservative approximation of the entire method
     HashSet<FlatReturnNode> setReturns = new HashSet<FlatReturnNode>();
 
+
+
+    boolean snapThisMethod = false;
+    if( takeDebugSnapshots && d instanceof MethodDescriptor ) {
+      MethodDescriptor mdThisMethod = (MethodDescriptor)d;
+      ClassDescriptor  cdThisMethod = mdThisMethod.getClassDesc();
+      if( cdThisMethod != null ) {
+        snapThisMethod = 
+          descSymbolDebug.equals( cdThisMethod.getSymbol()+
+                                  "."+
+                                  mdThisMethod.getSymbol()
+                                  );
+      }
+    }
+
+
+
     while( !flatNodesToVisit.isEmpty() ) {
 
       FlatNode fn;
@@ -1049,9 +1066,7 @@ public class DisjointAnalysis implements HeapAnalysis {
       }
 
 
-      if( takeDebugSnapshots &&
-          d.getSymbol().equals(descSymbolDebug)
-          ) {
+      if( snapThisMethod ) {
         debugSnapshot(rg, fn, true);
       }
 
@@ -1060,9 +1075,7 @@ public class DisjointAnalysis implements HeapAnalysis {
       rg = analyzeFlatNode(d, fm, fn, setReturns, rg);
 
 
-      if( takeDebugSnapshots &&
-          d.getSymbol().equals(descSymbolDebug)
-          ) {
+      if( snapThisMethod ) {
         debugSnapshot(rg, fn, false);
         ++snapNodeCounter;
       }
@@ -1104,9 +1117,7 @@ public class DisjointAnalysis implements HeapAnalysis {
     }
 
 
-    if( takeDebugSnapshots &&
-        d.getSymbol().equals(descSymbolDebug)
-        ) {
+    if( snapThisMethod ) {
       // increment that we've visited the debug snap
       // method, and reset the node counter
       System.out.println("    @@@ debug snap at visit "+snapVisitCounter);
@@ -1481,23 +1492,38 @@ public class DisjointAnalysis implements HeapAnalysis {
       FlatMethod fmCallee = state.getMethodFlat(mdCallee);
 
 
-      if( mdCallee.getSymbol().equals("genReach") ) {
-        rg.writeGraph("genReach"+d,
-                      true,     // write labels (variables)
-                      true,     // selectively hide intermediate temp vars
-                      true,     // prune unreachable heap regions
-                      false,    // hide reachability altogether
-                      true,     // hide subset reachability states
-                      true,     // hide predicates
-                      true);    // hide edge taints
-        break;
+
+      // all this jimma jamma to debug call sites is WELL WORTH the
+      // effort, so many bugs or buggy info goes crazy through call
+      // sites
+      boolean debugCalleeMatches = false;
+      ClassDescriptor cdCallee = mdCallee.getClassDesc();
+      if( cdCallee != null ) {
+        debugCalleeMatches = 
+          state.DISJOINTDEBUGCALLEE.equals( cdCallee.getSymbol()+
+                                            "."+
+                                            mdCallee.getSymbol()
+                                            );
       }
 
+      boolean debugCallerMatches = false;
+      if( mdCaller instanceof MethodDescriptor ) {
+        ClassDescriptor cdCaller = ((MethodDescriptor)mdCaller).getClassDesc();
+        if( cdCaller != null ) {
+          debugCallerMatches = 
+            state.DISJOINTDEBUGCALLER.equals( cdCaller.getSymbol()+
+                                              "."+
+                                              mdCaller.getSymbol()
+                                              );
+        }        
+      } else {
+        // for bristlecone style tasks
+        debugCallerMatches =
+          state.DISJOINTDEBUGCALLER.equals( mdCaller.getSymbol() );
+      }
 
+      boolean debugCallSite = debugCalleeMatches && debugCallerMatches;
 
-      boolean debugCallSite =
-        mdCaller.getSymbol().equals(state.DISJOINTDEBUGCALLER) &&
-        mdCallee.getSymbol().equals(state.DISJOINTDEBUGCALLEE);
 
       boolean writeDebugDOTs = false;
       boolean stopAfter      = false;
index 456c855e041253ce3e1db73cc7351459a3b55f03..5789c0bd2f4d98e0837d95ca7e5a6142bffebf02 100644 (file)
@@ -74,7 +74,7 @@ DISJOINT= -disjoint -disjoint-k 1 -enable-assertions $(DRELEASEMODE) #-disjoint-
 # -disjoint-debug-snap-method Remove 10 3 true
 
 DISJOINTDEBUG= -justanalyze -disjoint -disjoint-k 1 -enable-assertions \
-       -disjoint-debug-callsite createNode run 100 50 false
+       -disjoint-debug-callsite Demand.add Lateral.compute 35 1000 true
 #      -disjoint-desire-determinism
 #      -disjoint-debug-snap-method ComputeCenterOfMass 6 2 true
 #      -disjoint-debug-scheduling
index 08b16f4ccd05f068bb48e8e68dd09dab849f6670..b99348464b1a04d0cfd9c376a803cb0d037970e2 100644 (file)
@@ -233,6 +233,11 @@ public class Main {
           throw new Error("disjoint-debug-callsite requires arguments:\n"+
                           "  <callee symbol> <caller symbol> <# visit to start> <# visits to capture> <T/F stop after>");
         }
+        System.out.println( "Disjoint analysis is debugging when "+
+                            state.DISJOINTDEBUGCALLER+" calls "+
+                            state.DISJOINTDEBUGCALLEE+" starting after "+
+                            state.DISJOINTDEBUGCALLVISITTOSTART+" visits and running for "+
+                            state.DISJOINTDEBUGCALLNUMVISITS+ " visits." );
 
       } else if (option.equals("-disjoint-debug-snap-method")) {
         state.DISJOINTSNAPSYMBOL=args[++i];