hotspot/src/share/vm/opto/idealGraphPrinter.cpp
changeset 27147 ed83dc5777e6
parent 24424 2658d7834c6e
child 30591 b32fcc177417
--- a/hotspot/src/share/vm/opto/idealGraphPrinter.cpp	Mon Oct 13 12:30:37 2014 +0200
+++ b/hotspot/src/share/vm/opto/idealGraphPrinter.cpp	Wed Oct 15 10:51:43 2014 +0200
@@ -73,7 +73,9 @@
 int IdealGraphPrinter::_file_count = 0;
 
 IdealGraphPrinter *IdealGraphPrinter::printer() {
-  if (PrintIdealGraphLevel == 0) return NULL;
+  if (!PrintIdealGraph) {
+    return NULL;
+  }
 
   JavaThread *thread = JavaThread::current();
   if (!thread->is_Compiler_thread()) return NULL;
@@ -193,7 +195,6 @@
   }
 }
 
-
 void IdealGraphPrinter::begin_elem(const char *s) {
   _xml->begin_elem("%s", s);
 }
@@ -680,7 +681,7 @@
 // Print current ideal graph
 void IdealGraphPrinter::print(Compile* compile, const char *name, Node *node, int level, bool clear_nodes) {
 
-  if (!_current_method || !_should_send_method || level > PrintIdealGraphLevel) return;
+  if (!_current_method || !_should_send_method || !should_print(_current_method, level)) return;
 
   this->C = compile;
 
@@ -732,6 +733,13 @@
   output()->flush();
 }
 
+// Should method be printed?
+bool IdealGraphPrinter::should_print(ciMethod* method, int level) {
+  intx ideal_graph_level = PrintIdealGraphLevel;
+  method->has_option_value("PrintIdealGraphLevel", ideal_graph_level); // update value with per-method value (if available)
+  return ideal_graph_level >= level;
+}
+
 extern const char *NodeClassNames[];
 
 outputStream *IdealGraphPrinter::output() {