From 68709b7a908d8cadedeecb9ca23293d9aaf54b5e Mon Sep 17 00:00:00 2001 From: jjenista Date: Thu, 28 Apr 2011 22:58:29 +0000 Subject: [PATCH] improve call site debugging for disjoint --- .../Analysis/Disjoint/DisjointAnalysis.java | 70 +++++++++++++------ Robust/src/Benchmarks/oooJava/master-makefile | 2 +- Robust/src/Main/Main.java | 5 ++ 3 files changed, 54 insertions(+), 23 deletions(-) diff --git a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java index 37a54341..4a4ec001 100644 --- a/Robust/src/Analysis/Disjoint/DisjointAnalysis.java +++ b/Robust/src/Analysis/Disjoint/DisjointAnalysis.java @@ -1010,6 +1010,23 @@ public class DisjointAnalysis implements HeapAnalysis { // the final, conservative approximation of the entire method HashSet setReturns = new HashSet(); + + + 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; diff --git a/Robust/src/Benchmarks/oooJava/master-makefile b/Robust/src/Benchmarks/oooJava/master-makefile index 456c855e..5789c0bd 100644 --- a/Robust/src/Benchmarks/oooJava/master-makefile +++ b/Robust/src/Benchmarks/oooJava/master-makefile @@ -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 diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index 08b16f4c..b9934846 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -233,6 +233,11 @@ public class Main { throw new Error("disjoint-debug-callsite requires arguments:\n"+ " <# visit to start> <# visits to capture> "); } + 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]; -- 2.34.1