8232735: Convert PrintJNIResolving to Unified Logging

Converted the existing output at debug level because it is noisy

Reviewed-by: iklam, dholmes
This commit is contained in:
Coleen Phillimore 2019-11-11 12:11:34 -05:00
parent 6fa1bf99e2
commit b4d28f36fc
10 changed files with 31 additions and 47 deletions

View file

@ -2845,15 +2845,11 @@ void os::Bsd::install_signal_handlers() {
// and if UserSignalHandler is installed all bets are off // and if UserSignalHandler is installed all bets are off
if (CheckJNICalls) { if (CheckJNICalls) {
if (libjsig_is_loaded) { if (libjsig_is_loaded) {
if (PrintJNIResolving) { log_debug(jni, resolve)("Info: libjsig is activated, all active signal checking is disabled");
tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
}
check_signals = false; check_signals = false;
} }
if (AllowUserSignalHandlers) { if (AllowUserSignalHandlers) {
if (PrintJNIResolving) { log_debug(jni, resolve)("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
}
check_signals = false; check_signals = false;
} }
} }

View file

@ -4789,15 +4789,11 @@ void os::Linux::install_signal_handlers() {
// Log that signal checking is off only if -verbose:jni is specified. // Log that signal checking is off only if -verbose:jni is specified.
if (CheckJNICalls) { if (CheckJNICalls) {
if (libjsig_is_loaded) { if (libjsig_is_loaded) {
if (PrintJNIResolving) { log_debug(jni, resolve)("Info: libjsig is activated, all active signal checking is disabled");
tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
}
check_signals = false; check_signals = false;
} }
if (AllowUserSignalHandlers) { if (AllowUserSignalHandlers) {
if (PrintJNIResolving) { log_debug(jni, resolve)("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
}
check_signals = false; check_signals = false;
} }
} }

View file

@ -3684,15 +3684,11 @@ void os::Solaris::install_signal_handlers() {
// Log that signal checking is off only if -verbose:jni is specified. // Log that signal checking is off only if -verbose:jni is specified.
if (CheckJNICalls) { if (CheckJNICalls) {
if (libjsig_is_loaded) { if (libjsig_is_loaded) {
if (PrintJNIResolving) { log_debug(jni, resolve)("Info: libjsig is activated, all active signal checking is disabled");
tty->print_cr("Info: libjsig is activated, all active signal checking is disabled");
}
check_signals = false; check_signals = false;
} }
if (AllowUserSignalHandlers) { if (AllowUserSignalHandlers) {
if (PrintJNIResolving) { log_debug(jni, resolve)("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
tty->print_cr("Info: AllowUserSignalHandlers is activated, all active signal checking is disabled");
}
check_signals = false; check_signals = false;
} }
} }

View file

@ -34,6 +34,8 @@
#include "jvmci/jvmciCompilerToVM.hpp" #include "jvmci/jvmciCompilerToVM.hpp"
#include "jvmci/jvmciCodeInstaller.hpp" #include "jvmci/jvmciCodeInstaller.hpp"
#include "jvmci/jvmciRuntime.hpp" #include "jvmci/jvmciRuntime.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "memory/oopFactory.hpp" #include "memory/oopFactory.hpp"
#include "memory/universe.hpp" #include "memory/universe.hpp"
#include "oops/constantPool.inline.hpp" #include "oops/constantPool.inline.hpp"
@ -2296,11 +2298,9 @@ C2V_VMENTRY_NULL(jlongArray, registerNativeMethods, (JNIEnv* env, jobject, jclas
method->name_and_sig_as_C_string(), p2i(method->native_function()), p2i(entry))); method->name_and_sig_as_C_string(), p2i(method->native_function()), p2i(entry)));
} }
method->set_native_function(entry, Method::native_bind_event_is_interesting); method->set_native_function(entry, Method::native_bind_event_is_interesting);
if (PrintJNIResolving) { log_debug(jni, resolve)("[Dynamic-linking native method %s.%s ... JNI]",
tty->print_cr("[Dynamic-linking native method %s.%s ... JNI]", method->method_holder()->external_name(),
method->method_holder()->external_name(), method->name()->as_C_string());
method->name()->as_C_string());
}
} }
} }

View file

@ -36,6 +36,8 @@
#include "interpreter/bytecodes.hpp" #include "interpreter/bytecodes.hpp"
#include "interpreter/interpreter.hpp" #include "interpreter/interpreter.hpp"
#include "interpreter/oopMapCache.hpp" #include "interpreter/oopMapCache.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/heapInspection.hpp" #include "memory/heapInspection.hpp"
#include "memory/metadataFactory.hpp" #include "memory/metadataFactory.hpp"
@ -448,11 +450,11 @@ bool Method::register_native(Klass* k, Symbol* name, Symbol* signature, address
} else { } else {
method->clear_native_function(); method->clear_native_function();
} }
if (PrintJNIResolving) { if (log_is_enabled(Debug, jni, resolve)) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
tty->print_cr("[Registering JNI native method %s.%s]", log_debug(jni, resolve)("[Registering JNI native method %s.%s]",
method->method_holder()->external_name(), method->method_holder()->external_name(),
method->name()->as_C_string()); method->name()->as_C_string());
} }
return true; return true;
} }

View file

@ -28,6 +28,8 @@
#include "classfile/javaClasses.inline.hpp" #include "classfile/javaClasses.inline.hpp"
#include "classfile/systemDictionary.hpp" #include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp" #include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "memory/allocation.inline.hpp" #include "memory/allocation.inline.hpp"
#include "memory/guardedMemory.hpp" #include "memory/guardedMemory.hpp"
#include "oops/instanceKlass.hpp" #include "oops/instanceKlass.hpp"
@ -2303,10 +2305,7 @@ struct JNINativeInterface_* jni_functions_check() {
"Mismatched JNINativeInterface tables, check for new entries"); "Mismatched JNINativeInterface tables, check for new entries");
// with -verbose:jni this message will print // with -verbose:jni this message will print
if (PrintJNIResolving) { log_debug(jni, resolve)("Checked JNI functions are being used to validate JNI usage");
tty->print_cr("Checked JNI functions are being used to " \
"validate JNI usage");
}
return &checked_jni_NativeInterface; return &checked_jni_NativeInterface;
} }

View file

@ -809,14 +809,11 @@ JvmtiEnv::SetVerboseFlag(jvmtiVerboseFlag flag, jboolean value) {
LogConfiguration::configure_stdout(level, false, LOG_TAGS(class, load)); LogConfiguration::configure_stdout(level, false, LOG_TAGS(class, load));
break; break;
case JVMTI_VERBOSE_GC: case JVMTI_VERBOSE_GC:
if (value == 0) { LogConfiguration::configure_stdout(level, true, LOG_TAGS(gc));
LogConfiguration::configure_stdout(LogLevel::Off, true, LOG_TAGS(gc));
} else {
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc));
}
break; break;
case JVMTI_VERBOSE_JNI: case JVMTI_VERBOSE_JNI:
PrintJNIResolving = value != 0; level = value == 0 ? LogLevel::Off : LogLevel::Debug;
LogConfiguration::configure_stdout(level, true, LOG_TAGS(jni, resolve));
break; break;
default: default:
return JVMTI_ERROR_ILLEGAL_ARGUMENT; return JVMTI_ERROR_ILLEGAL_ARGUMENT;

View file

@ -27,6 +27,8 @@
#include "classfile/symbolTable.hpp" #include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp" #include "classfile/systemDictionary.hpp"
#include "classfile/vmSymbols.hpp" #include "classfile/vmSymbols.hpp"
#include "logging/log.hpp"
#include "logging/logTag.hpp"
#include "memory/oopFactory.hpp" #include "memory/oopFactory.hpp"
#include "memory/resourceArea.hpp" #include "memory/resourceArea.hpp"
#include "oops/instanceKlass.hpp" #include "oops/instanceKlass.hpp"
@ -413,11 +415,11 @@ address NativeLookup::lookup(const methodHandle& method, bool& in_base_library,
method->set_native_function(entry, method->set_native_function(entry,
Method::native_bind_event_is_interesting); Method::native_bind_event_is_interesting);
// -verbose:jni printing // -verbose:jni printing
if (PrintJNIResolving) { if (log_is_enabled(Debug, jni, resolve)) {
ResourceMark rm(THREAD); ResourceMark rm(THREAD);
tty->print_cr("[Dynamic-linking native method %s.%s ... JNI]", log_debug(jni, resolve)("[Dynamic-linking native method %s.%s ... JNI]",
method->method_holder()->external_name(), method->method_holder()->external_name(),
method->name()->as_C_string()); method->name()->as_C_string());
} }
} }
return method->native_function(); return method->native_function();

View file

@ -588,6 +588,7 @@ static AliasedLoggingFlag const aliased_logging_flags[] = {
{ "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepoint, cleanup) }, { "TraceSafepointCleanupTime", LogLevel::Info, true, LOG_TAGS(safepoint, cleanup) },
{ "TraceJVMTIObjectTagging", LogLevel::Debug, true, LOG_TAGS(jvmti, objecttagging) }, { "TraceJVMTIObjectTagging", LogLevel::Debug, true, LOG_TAGS(jvmti, objecttagging) },
{ "TraceRedefineClasses", LogLevel::Info, false, LOG_TAGS(redefine, class) }, { "TraceRedefineClasses", LogLevel::Info, false, LOG_TAGS(redefine, class) },
{ "PrintJNIResolving", LogLevel::Debug, true, LOG_TAGS(jni, resolve) },
{ NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG) } { NULL, LogLevel::Off, false, LOG_TAGS(_NO_TAG) }
}; };
@ -2400,9 +2401,7 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args, bool* patch_m
} else if (!strcmp(tail, ":gc")) { } else if (!strcmp(tail, ":gc")) {
LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc)); LogConfiguration::configure_stdout(LogLevel::Info, true, LOG_TAGS(gc));
} else if (!strcmp(tail, ":jni")) { } else if (!strcmp(tail, ":jni")) {
if (FLAG_SET_CMDLINE(PrintJNIResolving, true) != JVMFlag::SUCCESS) { LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(jni, resolve));
return JNI_EINVAL;
}
} }
// -da / -ea / -disableassertions / -enableassertions // -da / -ea / -disableassertions / -enableassertions
// These accept an optional class/package name separated by a colon, e.g., // These accept an optional class/package name separated by a colon, e.g.,

View file

@ -305,9 +305,6 @@ const size_t minimumSymbolTableSize = 1024;
notproduct(bool, TraceCodeBlobStacks, false, \ notproduct(bool, TraceCodeBlobStacks, false, \
"Trace stack-walk of codeblobs") \ "Trace stack-walk of codeblobs") \
\ \
product(bool, PrintJNIResolving, false, \
"Used to implement -v:jni") \
\
notproduct(bool, PrintRewrites, false, \ notproduct(bool, PrintRewrites, false, \
"Print methods that are being rewritten") \ "Print methods that are being rewritten") \
\ \