From 5ec64af0746f56ae01862fd2da6eceee4cfd51d7 Mon Sep 17 00:00:00 2001 From: stephey Date: Tue, 4 Jan 2011 02:41:05 +0000 Subject: [PATCH] Made the option for showing RCR compile-time debug printout accessible in makefile --- Robust/src/Benchmarks/oooJava/master-makefile | 12 +++- .../src/IR/Flat/RuntimeConflictResolver.java | 68 +++++++++---------- Robust/src/IR/State.java | 2 + Robust/src/Main/Main.java | 10 ++- Robust/src/buildscript | 14 ++++ 5 files changed, 63 insertions(+), 43 deletions(-) diff --git a/Robust/src/Benchmarks/oooJava/master-makefile b/Robust/src/Benchmarks/oooJava/master-makefile index a58e111d..32d9d9c8 100644 --- a/Robust/src/Benchmarks/oooJava/master-makefile +++ b/Robust/src/Benchmarks/oooJava/master-makefile @@ -34,6 +34,8 @@ USECOREPROF= #-coreprof $(COREPROFOVERFLOW) \ USEOOO= -ooojava $(NUM_OOO_WORKERS) 2 -ooodebug -squeue #-ooodebug-disable-task-mem-pool USERCR= -ooojava $(NUM_RCR_WORKERS) 2 -rcr -ooodebug -squeue +RCRDEBUG= -rcr_debug +RCRDEBUGV= -rcr_debug_verbose BSFLAGS= -64bit -mainclass $(PROGRAM) -heapsize-mb 8000 -garbagestats -joptimize -noloop -optimize -debug #-nooptimize #src-after-pp #-debug DRELEASEMODE=-disjoint-release-mode -disjoint-dvisit-stack-callees-on-top -disjoint-alias-file aliases.txt tabbed @@ -58,11 +60,15 @@ ooo: $(PROGRAM)p.bin $(PROGRAM)p.bin: $(SOURCE_FILES) ../master-makefile $(BUILDSCRIPT) $(BSFLAGS) $(USECOREPROF) $(USEOOO) $(DISJOINT) -o $(PROGRAM)p -builddir par $(SOURCE_FILES) -rcr: $(PROGRAM)r.bin - -$(PROGRAM)r.bin: $(SOURCE_FILES) ../master-makefile +rcr: $(SOURCE_FILES) ../master-makefile $(BUILDSCRIPT) $(BMFLAGS) $(BSFLAGS) $(USECOREPROF) $(USERCR) $(DISJOINT) -o $(PROGRAM)r -builddir rcr $(SOURCE_FILES) +rcr-debug: $(SOURCE_FILES) ../master-makefile + $(BUILDSCRIPT) $(BMFLAGS) $(BSFLAGS) $(USECOREPROF) $(USERCR) $(RCRDEBUG) $(DISJOINT) -o $(PROGRAM)r -builddir rcr $(SOURCE_FILES) + +rcr-debug-v: $(SOURCE_FILES) ../master-makefile + $(BUILDSCRIPT) $(BMFLAGS) $(BSFLAGS) $(USECOREPROF) $(USERCR) $(RCRDEBUGV) $(DISJOINT) -o $(PROGRAM)r -builddir rcr $(SOURCE_FILES) + clean: rm -f $(PROGRAM)p.bin $(PROGRAM)s.bin $(PROGRAM)r.bin rm -fr par sing rcr diff --git a/Robust/src/IR/Flat/RuntimeConflictResolver.java b/Robust/src/IR/Flat/RuntimeConflictResolver.java index 5dae22a1..1d16fa31 100644 --- a/Robust/src/IR/Flat/RuntimeConflictResolver.java +++ b/Robust/src/IR/Flat/RuntimeConflictResolver.java @@ -32,14 +32,11 @@ import Util.CodePrinter; * Note: All computation is done upon closing the object. Steps 1-3 only input data */ public class RuntimeConflictResolver { - public static final boolean generalDebug = true; - public static final boolean cSideDebug = false; - - //Prints out effects and data structure used to steer RCR traversals - public static final boolean printEffectsAndEffectsTable = false; - - //Prints steps taken to build internal representation of pruned reach graph - public static final boolean traceDataStructureBuild = false; + //Shows weakly connected heaproots and which allocation sites were considered for traversal + private boolean generalDebug = false; + + //Prints out effects passed in, internal representation of effects, and internal representation of reach graph + private boolean verboseDebug = false; private PrintWriter cFile; private PrintWriter headerFile; @@ -104,12 +101,15 @@ public class RuntimeConflictResolver { toTraverse = new ArrayList(); globalConflicts = new Hashtable>(); //Note: globalEffects is not instantiated since it'll be passed in whole while conflicts comes in chunks + + generalDebug = state.RCR_DEBUG || state.RCR_DEBUG_VERBOSE; + verboseDebug = state.RCR_DEBUG_VERBOSE; } public void setGlobalEffects(Hashtable> effects) { globalEffects = effects; - if(printEffectsAndEffectsTable) { + if(verboseDebug) { System.out.println("============EFFECTS LIST AS PASSED IN============"); for(Taint t: globalEffects.keySet()) { System.out.println("For Taint " + t); @@ -123,21 +123,24 @@ public class RuntimeConflictResolver { public void init() { // Go through the SESE's + printDebug(generalDebug, "======================SESE's======================"); for (Iterator seseit = oooa.getAllSESEs().iterator(); seseit.hasNext();) { FlatSESEEnterNode fsen = seseit.next(); Analysis.OoOJava.ConflictGraph conflictGraph; Hashtable> conflicts; - System.out.println("-------"); - System.out.println(fsen); - System.out.println(fsen.getIsCallerSESEplaceholder()); - System.out.println(fsen.getParent()); // if (fsen.getParent() != null) { FlatSESEEnterNode parentSESE = null; if (fsen.getSESEParent().size() > 0) { parentSESE = (FlatSESEEnterNode) fsen.getSESEParent().iterator().next(); conflictGraph = oooa.getConflictGraph(parentSESE); - System.out.println("CG=" + conflictGraph); + + if(generalDebug) { + System.out.println(fsen); + System.out.println(fsen.getIsCallerSESEplaceholder()); + System.out.println(fsen.getParent()); + System.out.println("CG=" + conflictGraph); + } } // if (!fsen.getIsCallerSESEplaceholder() && fsen.getParent() != null @@ -148,12 +151,14 @@ public class RuntimeConflictResolver { && (conflicts = conflictGraph.getConflictEffectSet(fsen)) != null ){ FlatMethod fm = fsen.getfmEnclosing(); ReachGraph rg = oooa.getDisjointAnalysis().getReachGraph(fm.getMethod()); - if (cSideDebug) + if (generalDebug) rg.writeGraph("RCR_RG_SESE_DEBUG"); addToTraverseToDoList(fsen, rg, conflicts); } } + printDebug(generalDebug, "====================END LIST===================="); + // Go through the stall sites for (Iterator codeit = oooa.getNodesWithPlans().iterator(); codeit.hasNext();) { FlatNode fn = codeit.next(); @@ -180,7 +185,7 @@ public class RuntimeConflictResolver { Analysis.OoOJava.ConflictGraph conflictGraph = graph; Hashtable> conflicts; ReachGraph rg = oooa.getDisjointAnalysis().getReachGraph(currentSESE.getmdEnclosing()); - if (cSideDebug) { + if (generalDebug) { rg.writeGraph("RCR_RG_STALLSITE_DEBUG"); } if ((conflictGraph != null) && (conflicts = graph.getConflictEffectSet(fn)) != null @@ -242,8 +247,6 @@ public class RuntimeConflictResolver { if (inVars.size() == 0) return; - System.out.println("RBLOCK:"+rblock); - System.out.println("["+inVars+"]"); // For every non-primitive variable, generate unique method for (TempDescriptor invar : inVars) { @@ -251,7 +254,7 @@ public class RuntimeConflictResolver { if(isReallyAPrimitive(type)) { continue; } - System.out.println(invar); + //"created" stores nodes with specific alloc sites that have been traversed while building //internal data structure. Created is later traversed sequentially to find inset variables and //build output code. @@ -512,11 +515,7 @@ public class RuntimeConflictResolver { cFile.println(" break;"); } - if(RuntimeConflictResolver.cSideDebug) { - cFile.println(" default:\n printf(\"Invalid traverser ID %u was passed in.\\n\", traverserID);\n break;"); - } else { - cFile.println(" default:\n break;"); - } + cFile.println(" default:\n break;"); cFile.println(" }"); cFile.println("}"); @@ -717,11 +716,6 @@ public class RuntimeConflictResolver { cFile.println(methodName + " {"); headerFile.println(methodName + ";"); - if(cSideDebug) { - cFile.println("printf(\"The traverser ran for " + methodName + "\\n\");"); - } - - if(cases.size() == 0) { cFile.println(" return;"); } else { @@ -1322,7 +1316,7 @@ public class RuntimeConflictResolver { } public void addObjChild(String field, ConcreteRuntimeObjNode child, CombinedObjEffects ce) { - printDebug(traceDataStructureBuild,this.allocSite.getUniqueAllocSiteID() + " added child at " + child.getAllocationSite()); + printDebug(verboseDebug,this.allocSite.getUniqueAllocSiteID() + " added child at " + child.getAllocationSite()); hasDirectObjConflict |= ce.hasConflict(); ObjRef ref = new ObjRef(field, child, ce); @@ -1332,14 +1326,14 @@ public class RuntimeConflictResolver { if(array.contains(ref)) { ObjRef other = array.get(array.indexOf(ref)); other.mergeWith(ref); - printDebug(traceDataStructureBuild," Merged with old"); - printDebug(traceDataStructureBuild," Old="+ other.child.original + "\n new="+ref.child.original); + printDebug(verboseDebug," Merged with old"); + printDebug(verboseDebug," Old="+ other.child.original + "\n new="+ref.child.original); } else { array.add(ref); - printDebug(traceDataStructureBuild," Just added new;\n Field: " + field); - printDebug(traceDataStructureBuild," AllocSite: " + child.getAllocationSite()); - printDebug(traceDataStructureBuild," Child: "+child.original); + printDebug(verboseDebug," Just added new;\n Field: " + field); + printDebug(verboseDebug," AllocSite: " + child.getAllocationSite()); + printDebug(verboseDebug," Child: "+child.original); } } else { @@ -1415,7 +1409,7 @@ public class RuntimeConflictResolver { bucket = new BucketOfEffects(); table.put(e.getAffectedAllocSite(), bucket); } - printDebug(printEffectsAndEffectsTable, "Added Taint" + t + " Effect " + e + "Conflict Status = " + (localConflicts!=null?localConflicts.contains(e):false)+" localConflicts = "+localConflicts); + printDebug(verboseDebug, "Added Taint" + t + " Effect " + e + "Conflict Status = " + (localConflicts!=null?localConflicts.contains(e):false)+" localConflicts = "+localConflicts); bucket.add(t, e, localConflicts!=null?localConflicts.contains(e):false); } } @@ -1435,7 +1429,7 @@ public class RuntimeConflictResolver { // Run Analysis will walk the data structure and figure out the weakly // connected heap roots. public void runAnalysis() { - if(printEffectsAndEffectsTable) { + if(verboseDebug) { printoutTable(this); } diff --git a/Robust/src/IR/State.java b/Robust/src/IR/State.java index c9ac058a..a54f2e49 100644 --- a/Robust/src/IR/State.java +++ b/Robust/src/IR/State.java @@ -105,6 +105,8 @@ public class State { public boolean OOOJAVA=false; public boolean OOODEBUG=false; public boolean RCR=false; + public boolean RCR_DEBUG=false; + public boolean RCR_DEBUG_VERBOSE=false; public boolean NOSTALLTR=false; diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java index d6eb421d..9e9dada1 100644 --- a/Robust/src/Main/Main.java +++ b/Robust/src/Main/Main.java @@ -336,11 +336,15 @@ public class Main { state.MLP_MAXSESEAGE = Integer.parseInt( args[++i] ); } else if (option.equals("-ooodebug") ){ - state.OOODEBUG = true; + state.OOODEBUG = true; } else if (option.equals("-rcr")){ - state.RCR = true; + state.RCR = true; + } else if (option.equals("-rcr_debug")){ + state.RCR_DEBUG = true; + } else if (option.equals("-rcr_debug_verbose")){ + state.RCR_DEBUG_VERBOSE = true; } else if (option.equals("-nostalltr")){ - state.NOSTALLTR = true; + state.NOSTALLTR = true; }else if (option.equals("-help")) { System.out.println("-classlibrary classlibrarydirectory -- directory where classlibrary is located"); System.out.println("-selfloop task -- this task doesn't self loop its parameters forever"); diff --git a/Robust/src/buildscript b/Robust/src/buildscript index 6c6c78ee..ef24f374 100755 --- a/Robust/src/buildscript +++ b/Robust/src/buildscript @@ -27,6 +27,8 @@ echo -ooodebug general OOOJava debugging messages echo -ooodebug-disable-task-mem-pool this is a tricky module, disable for simpler runtime echo -mempool-detect-misuse turn on to find code misusing pool-allocated records echo -rcr turn on runtime conflict resolver +echo -rcr_debug Shows weakly connected heaproots and which allocation sites were considered for traversal +echo -rcr_debug_verbose in addition to above, also prints out effects passed in, internal representation of effects, and internal representation of reach graph echo -squeue use single queue echo -corepin use core pinning echo -nostalltr turn off RCR traversers that only handle conflicts between task and stallsite @@ -169,6 +171,8 @@ CHECKFLAG=false RECOVERFLAG=false MLP_ON=false RCR=false +RCR_DEBUG=false +RCR_DEBUG_VERBOSE=false MLPDEBUG=false MULTICOREFLAG=false RAWFLAG=false @@ -590,6 +594,16 @@ JAVAOPTS="$JAVAOPTS -rcr" RCR=true EXTRAOPTIONS="$EXTRAOPTIONS -DRCR -I$ROBUSTROOT/Runtime/oooJava" +elif [[ $1 = '-rcr_debug' ]] +then +JAVAOPTS="$JAVAOPTS -rcr_debug" +RCR_DEBUG=true + +elif [[ $1 = '-rcr_debug_verbose' ]] +then +JAVAOPTS="$JAVAOPTS -rcr_debug_verbose" +RCR_DEBUG_VERBOSE=true + elif [[ $1 = '-debug-deque' ]] then EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG_DEQUE" -- 2.34.1