8149995: TraceClassLoadingPreorder has been converted to Unified Logging.
authormockner
Mon, 14 Mar 2016 15:06:49 -0400
changeset 37094 c12f414936a1
parent 37079 a92fc7ba87a2
child 37095 adfe20658079
8149995: TraceClassLoadingPreorder has been converted to Unified Logging. Summary: TraceClassLoadingPreorder has been converted to Unified Logging. Logging alias table now has extra columns to support multi-tag configurations. Reviewed-by: iklam, coleenp
hotspot/src/share/vm/classfile/classFileParser.cpp
hotspot/src/share/vm/logging/logTag.hpp
hotspot/src/share/vm/memory/metaspaceShared.cpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/arguments.hpp
hotspot/src/share/vm/runtime/globals.hpp
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Mar 11 17:02:04 2016 +0100
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Mon Mar 14 15:06:49 2016 -0400
@@ -5684,15 +5684,16 @@
   }
 
   if (!is_internal()) {
-    if (TraceClassLoadingPreorder) {
-      tty->print("[Loading %s",
-        _class_name->as_klass_external_name());
-
+    if (log_is_enabled(Debug, classload, preorder)){
+      ResourceMark rm(THREAD);
+      outputStream* log = LogHandle(classload, preorder)::debug_stream();
+      log->print("%s", _class_name->as_klass_external_name());
       if (stream->source() != NULL) {
-        tty->print(" from %s", stream->source());
+        log->print(" source: %s", stream->source());
       }
-      tty->print_cr("]");
+      log->cr();
     }
+
 #if INCLUDE_CDS
     if (DumpLoadedClassList != NULL && stream->source() != NULL && classlist_file->is_open()) {
       // Only dump the classes that can be stored into CDS archive
--- a/hotspot/src/share/vm/logging/logTag.hpp	Fri Mar 11 17:02:04 2016 +0100
+++ b/hotspot/src/share/vm/logging/logTag.hpp	Mon Mar 14 15:06:49 2016 -0400
@@ -68,6 +68,7 @@
   LOG_TAG(phases) \
   LOG_TAG(plab) \
   LOG_TAG(promotion) \
+  LOG_TAG(preorder) /* Trace all classes loaded in order referenced (not loaded) */ \
   LOG_TAG(protectiondomain) /* "Trace protection domain verification" */ \
   LOG_TAG(ref) \
   LOG_TAG(refine) \
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Fri Mar 11 17:02:04 2016 +0100
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Mon Mar 14 15:06:49 2016 -0400
@@ -879,7 +879,7 @@
 
         InstanceKlass* ik = InstanceKlass::cast(klass);
 
-        // Should be class load order as per -XX:+TraceClassLoadingPreorder
+        // Should be class load order as per -Xlog:classload+preorder
         class_promote_order->append(ik);
 
         // Link the class to cause the bytecodes to be rewritten and the
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Fri Mar 11 17:02:04 2016 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Mon Mar 14 15:06:49 2016 -0400
@@ -405,15 +405,16 @@
 };
 
 static AliasedLoggingFlag const aliased_logging_flags[] = {
-  { "TraceBiasedLocking",        LogLevel::Info,  true,  LogTag::_biasedlocking },
-  { "TraceClassLoading",         LogLevel::Info,  true,  LogTag::_classload },
-  { "TraceClassPaths",           LogLevel::Info,  true,  LogTag::_classpath },
-  { "TraceClassResolution",      LogLevel::Debug, true,  LogTag::_classresolve },
-  { "TraceClassUnloading",       LogLevel::Info,  true,  LogTag::_classunload },
-  { "TraceExceptions",           LogLevel::Info,  true,  LogTag::_exceptions },
-  { "TraceMonitorInflation",     LogLevel::Debug, true,  LogTag::_monitorinflation },
-  { "TraceSafepointCleanupTime", LogLevel::Info,  true,  LogTag::_safepointcleanup },
-  { NULL,                        LogLevel::Off,   false, LogTag::__NO_TAG }
+  { "TraceBiasedLocking",        LogLevel::Info,  true,  LOG_TAGS(biasedlocking) },
+  { "TraceClassLoading",         LogLevel::Info,  true,  LOG_TAGS(classload) },
+  { "TraceClassLoadingPreorder", LogLevel::Debug,  true,  LOG_TAGS(classload, preorder) },
+  { "TraceClassPaths",           LogLevel::Info,  true,  LOG_TAGS(classpath) },
+  { "TraceClassResolution",      LogLevel::Debug, true,  LOG_TAGS(classresolve) },
+  { "TraceClassUnloading",       LogLevel::Info,  true,  LOG_TAGS(classunload) },
+  { "TraceExceptions",           LogLevel::Info,  true,  LOG_TAGS(exceptions) },
+  { "TraceMonitorInflation",     LogLevel::Debug, true,  LOG_TAGS(monitorinflation) },
+  { "TraceSafepointCleanupTime", LogLevel::Info,  true,  LOG_TAGS(safepointcleanup) },
+  { NULL,                        LogLevel::Off,   false, LOG_TAGS(_NO_TAG) }
 };
 
 // Return true if "v" is less than "other", where "other" may be "undefined".
@@ -953,7 +954,7 @@
       return alf;
     }
   }
-  AliasedLoggingFlag a = {NULL, LogLevel::Off, false, LogTag::__NO_TAG};
+  AliasedLoggingFlag a = {NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG)};
   return a;
 }
 
@@ -966,12 +967,11 @@
   char dummy;
   const char* real_name;
   bool warn_if_deprecated = true;
-  AliasedLoggingFlag alf;
 
   if (sscanf(arg, "-%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
-    alf = catch_logging_aliases(name);
+    AliasedLoggingFlag alf = catch_logging_aliases(name);
     if (alf.alias_name != NULL){
-      LogConfiguration::configure_stdout(LogLevel::Off, alf.exactMatch, alf.tag, LogTag::__NO_TAG);
+      LogConfiguration::configure_stdout(LogLevel::Off, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5);
       return true;
     }
     real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
@@ -981,9 +981,9 @@
     return set_bool_flag(real_name, false, origin);
   }
   if (sscanf(arg, "+%" XSTR(BUFLEN) NAME_RANGE "%c", name, &dummy) == 1) {
-    alf = catch_logging_aliases(name);
+    AliasedLoggingFlag alf = catch_logging_aliases(name);
     if (alf.alias_name != NULL){
-      LogConfiguration::configure_stdout(alf.level, alf.exactMatch, alf.tag, LogTag::__NO_TAG);
+      LogConfiguration::configure_stdout(alf.level, alf.exactMatch, alf.tag0, alf.tag1, alf.tag2, alf.tag3, alf.tag4, alf.tag5);
       return true;
     }
     real_name = handle_aliases_and_deprecation(name, warn_if_deprecated);
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Fri Mar 11 17:02:04 2016 +0100
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Mon Mar 14 15:06:49 2016 -0400
@@ -230,7 +230,12 @@
   const char* alias_name;
   LogLevelType level;
   bool exactMatch;
-  LogTagType tag;
+  LogTagType tag0;
+  LogTagType tag1;
+  LogTagType tag2;
+  LogTagType tag3;
+  LogTagType tag4;
+  LogTagType tag5;
 } AliasedLoggingFlag;
 
 class Arguments : AllStatic {
--- a/hotspot/src/share/vm/runtime/globals.hpp	Fri Mar 11 17:02:04 2016 +0100
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Mon Mar 14 15:06:49 2016 -0400
@@ -2382,9 +2382,6 @@
   product(bool, IgnoreEmptyClassPaths, false,                               \
           "Ignore empty path elements in -classpath")                       \
                                                                             \
-  product(bool, TraceClassLoadingPreorder, false,                           \
-          "Trace all classes loaded in order referenced (not loaded)")      \
-                                                                            \
   product_rw(bool, TraceLoaderConstraints, false,                           \
           "Trace loader constraints")                                       \
                                                                             \