8222371: Use UL for TraceNMethodInstalls code
authorkvn
Thu, 06 Jun 2019 16:06:10 -0700
changeset 55273 64b76867851b
parent 55272 1b17d09e3e05
child 55274 8cd2d6dee328
8222371: Use UL for TraceNMethodInstalls code Reviewed-by: dholmes
src/hotspot/share/ci/ciEnv.cpp
src/hotspot/share/jvmci/jvmciRuntime.cpp
src/hotspot/share/logging/logTag.hpp
src/hotspot/share/runtime/arguments.cpp
--- a/src/hotspot/share/ci/ciEnv.cpp	Thu Jun 06 15:12:37 2019 -0700
+++ b/src/hotspot/share/ci/ciEnv.cpp	Thu Jun 06 16:06:10 2019 -0700
@@ -44,6 +44,7 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "interpreter/linkResolver.hpp"
 #include "jfr/jfrEvents.hpp"
+#include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/oopFactory.hpp"
 #include "memory/resourceArea.hpp"
@@ -1076,25 +1077,23 @@
             old->make_not_used();
           }
         }
-        if (TraceNMethodInstalls) {
+
+        LogTarget(Info, nmethod, install) lt;
+        if (lt.is_enabled()) {
           ResourceMark rm;
           char *method_name = method->name_and_sig_as_C_string();
-          ttyLocker ttyl;
-          tty->print_cr("Installing method (%d) %s ",
-                        task()->comp_level(),
-                        method_name);
+          lt.print("Installing method (%d) %s ",
+                    task()->comp_level(), method_name);
         }
         // Allow the code to be executed
         method->set_code(method, nm);
       } else {
-        if (TraceNMethodInstalls) {
+        LogTarget(Info, nmethod, install) lt;
+        if (lt.is_enabled()) {
           ResourceMark rm;
           char *method_name = method->name_and_sig_as_C_string();
-          ttyLocker ttyl;
-          tty->print_cr("Installing osr method (%d) %s @ %d",
-                        task()->comp_level(),
-                        method_name,
-                        entry_bci);
+          lt.print("Installing osr method (%d) %s @ %d",
+                    task()->comp_level(), method_name, entry_bci);
         }
         method->method_holder()->add_osr_nmethod(nm);
       }
--- a/src/hotspot/share/jvmci/jvmciRuntime.cpp	Thu Jun 06 15:12:37 2019 -0700
+++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp	Thu Jun 06 16:06:10 2019 -0700
@@ -1543,25 +1543,23 @@
                 old->make_not_entrant();
               }
             }
-            if (TraceNMethodInstalls) {
+
+            LogTarget(Info, nmethod, install) lt;
+            if (lt.is_enabled()) {
               ResourceMark rm;
               char *method_name = method->name_and_sig_as_C_string();
-              ttyLocker ttyl;
-              tty->print_cr("Installing method (%d) %s [entry point: %p]",
-                            comp_level,
-                            method_name, nm->entry_point());
+              lt.print("Installing method (%d) %s [entry point: %p]",
+                        comp_level, method_name, nm->entry_point());
             }
             // Allow the code to be executed
             method->set_code(method, nm);
           } else {
-            if (TraceNMethodInstalls ) {
+            LogTarget(Info, nmethod, install) lt;
+            if (lt.is_enabled()) {
               ResourceMark rm;
               char *method_name = method->name_and_sig_as_C_string();
-              ttyLocker ttyl;
-              tty->print_cr("Installing osr method (%d) %s @ %d",
-                            comp_level,
-                            method_name,
-                            entry_bci);
+              lt.print("Installing osr method (%d) %s @ %d",
+                        comp_level, method_name, entry_bci);
             }
             InstanceKlass::cast(method->method_holder())->add_osr_nmethod(nm);
           }
--- a/src/hotspot/share/logging/logTag.hpp	Thu Jun 06 15:12:37 2019 -0700
+++ b/src/hotspot/share/logging/logTag.hpp	Thu Jun 06 16:06:10 2019 -0700
@@ -83,6 +83,7 @@
   LOG_TAG(iklass) \
   LOG_TAG(init) \
   LOG_TAG(inlining) \
+  LOG_TAG(install) \
   LOG_TAG(interpreter) \
   LOG_TAG(itables) \
   LOG_TAG(jfr) \
--- a/src/hotspot/share/runtime/arguments.cpp	Thu Jun 06 15:12:37 2019 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Thu Jun 06 16:06:10 2019 -0700
@@ -604,6 +604,7 @@
   { "TraceSafepointCleanupTime", LogLevel::Info,  true,  LOG_TAGS(safepoint, cleanup) },
   { "TraceJVMTIObjectTagging",   LogLevel::Debug, true,  LOG_TAGS(jvmti, objecttagging) },
   { "TraceRedefineClasses",      LogLevel::Info,  false, LOG_TAGS(redefine, class) },
+  { "TraceNMethodInstalls",      LogLevel::Info,  true,  LOG_TAGS(nmethod, install) },
   { NULL,                        LogLevel::Off,   false, LOG_TAGS(_NO_TAG) }
 };