hotspot/src/share/vm/oops/generateOopMap.cpp
changeset 37203 90eabed33a6c
parent 37161 e881f320966e
child 37242 91e5f98fff6f
--- a/hotspot/src/share/vm/oops/generateOopMap.cpp	Thu Mar 24 15:19:06 2016 +0000
+++ b/hotspot/src/share/vm/oops/generateOopMap.cpp	Tue Mar 29 14:37:07 2016 -0400
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "interpreter/bytecodeStream.hpp"
+#include "logging/log.hpp"
 #include "oops/generateOopMap.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/symbol.hpp"
@@ -32,6 +33,7 @@
 #include "runtime/relocator.hpp"
 #include "runtime/timerTrace.hpp"
 #include "utilities/bitMap.inline.hpp"
+#include "utilities/ostream.hpp"
 #include "prims/methodHandles.hpp"
 
 //
@@ -787,7 +789,7 @@
         bb->set_changed(true);
       }
     } else {
-      if (TraceMonitorMismatch) {
+      if (log_is_enabled(Info, monitormismatch)) {
         report_monitor_mismatch("monitor stack height merge conflict");
       }
       // When the monitor stacks are not matched, we set _monitor_top to
@@ -856,7 +858,7 @@
     _monitor_safe = false;
      _monitor_top = bad_monitors;
 
-    if (TraceMonitorMismatch) {
+    if (log_is_enabled(Info, monitormismatch)) {
       report_monitor_mismatch("monitor stack underflow");
     }
     return CellTypeState::ref; // just to keep the analysis going.
@@ -872,7 +874,7 @@
     _monitor_safe = false;
     _monitor_top = bad_monitors;
 
-    if (TraceMonitorMismatch) {
+    if (log_is_enabled(Info, monitormismatch)) {
       report_monitor_mismatch("monitor stack overflow");
     }
     return;
@@ -1245,7 +1247,7 @@
   // We don't set _monitor_top to bad_monitors because there are no successors
   // to this exceptional exit.
 
-  if (TraceMonitorMismatch && _monitor_safe) {
+  if (log_is_enabled(Info, monitormismatch) && _monitor_safe) {
     // We check _monitor_safe so that we only report the first mismatched
     // exceptional exit.
     report_monitor_mismatch("non-empty monitor stack at exceptional exit");
@@ -1255,11 +1257,11 @@
 }
 
 void GenerateOopMap::report_monitor_mismatch(const char *msg) {
-#ifndef PRODUCT
-  tty->print("    Monitor mismatch in method ");
-  method()->print_short_name(tty);
-  tty->print_cr(": %s", msg);
-#endif
+  ResourceMark rm;
+  outputStream* out = LogHandle(monitormismatch)::info_stream();
+  out->print("Monitor mismatch in method ");
+  method()->print_short_name(out);
+  out->print_cr(": %s", msg);
 }
 
 void GenerateOopMap::print_states(outputStream *os,
@@ -1782,7 +1784,7 @@
     _monitor_top = bad_monitors;
     _monitor_safe = false;
 
-    if (TraceMonitorMismatch) {
+    if (log_is_enabled(Info, monitormismatch)) {
       report_monitor_mismatch("nested redundant lock -- bailout...");
     }
     return;
@@ -1820,7 +1822,7 @@
     bb->set_changed(true);
     bb->_monitor_top = bad_monitors;
 
-    if (TraceMonitorMismatch) {
+    if (log_is_enabled(Info, monitormismatch)) {
       report_monitor_mismatch("improper monitor pair");
     }
   } else {
@@ -1846,7 +1848,7 @@
     // Since there are no successors to the *return bytecode, it
     // isn't necessary to set _monitor_top to bad_monitors.
 
-    if (TraceMonitorMismatch) {
+    if (log_is_enabled(Info, monitormismatch)) {
       report_monitor_mismatch("non-empty monitor stack at return");
     }
   }