From 7c7b961e732d1bef3c95a69758e283c8fb32fff6 Mon Sep 17 00:00:00 2001 From: Doug Simon Date: Thu, 28 Mar 2024 10:16:39 +0000 Subject: [PATCH] 8329191: JVMCI compiler warning is truncated Reviewed-by: never --- src/hotspot/share/jvmci/jvmciCompiler.cpp | 9 ++++++--- src/hotspot/share/jvmci/jvmciEnv.cpp | 12 ++++++++---- src/hotspot/share/jvmci/jvmciRuntime.cpp | 5 ++++- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/hotspot/share/jvmci/jvmciCompiler.cpp b/src/hotspot/share/jvmci/jvmciCompiler.cpp index f20a04b3ac3..5be065aadad 100644 --- a/src/hotspot/share/jvmci/jvmciCompiler.cpp +++ b/src/hotspot/share/jvmci/jvmciCompiler.cpp @@ -229,9 +229,12 @@ void JVMCICompiler::on_upcall(const char* error, JVMCICompileState* compile_stat if (err > 10 && err * 10 > ok && !_disabled) { _disabled = true; int total = err + ok; - const char* disable_msg = err_msg("JVMCI compiler disabled " - "after %d of %d upcalls had errors (Last error: \"%s\"). " - "Use -Xlog:jit+compilation for more detail.", err, total, error); + // Using stringStream instead of err_msg to avoid truncation + stringStream st; + st.print("JVMCI compiler disabled " + "after %d of %d upcalls had errors (Last error: \"%s\"). " + "Use -Xlog:jit+compilation for more detail.", err, total, error); + const char* disable_msg = st.freeze(); log_warning(jit,compilation)("%s", disable_msg); if (compile_state != nullptr) { const char* disable_error = os::strdup(disable_msg); diff --git a/src/hotspot/share/jvmci/jvmciEnv.cpp b/src/hotspot/share/jvmci/jvmciEnv.cpp index b060bd8479f..cf6e7b2a81a 100644 --- a/src/hotspot/share/jvmci/jvmciEnv.cpp +++ b/src/hotspot/share/jvmci/jvmciEnv.cpp @@ -239,8 +239,10 @@ void JVMCIEnv::check_init(JVMCI_TRAPS) { if (_init_error == JNI_ENOMEM) { JVMCI_THROW_MSG(OutOfMemoryError, "JNI_ENOMEM creating or attaching to libjvmci"); } - JVMCI_THROW_MSG(InternalError, err_msg("Error creating or attaching to libjvmci (err: %d, description: %s)", - _init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg)); + stringStream st; + st.print("Error creating or attaching to libjvmci (err: %d, description: %s)", + _init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg); + JVMCI_THROW_MSG(InternalError, st.freeze()); } void JVMCIEnv::check_init(TRAPS) { @@ -250,8 +252,10 @@ void JVMCIEnv::check_init(TRAPS) { if (_init_error == JNI_ENOMEM) { THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "JNI_ENOMEM creating or attaching to libjvmci"); } - THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), err_msg("Error creating or attaching to libjvmci (err: %d, description: %s)", - _init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg)); + stringStream st; + st.print("Error creating or attaching to libjvmci (err: %d, description: %s)", + _init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg); + THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), st.freeze()); } // Prints a pending exception (if any) and its stack trace to st. diff --git a/src/hotspot/share/jvmci/jvmciRuntime.cpp b/src/hotspot/share/jvmci/jvmciRuntime.cpp index 3a19745fe09..b095008fe0b 100644 --- a/src/hotspot/share/jvmci/jvmciRuntime.cpp +++ b/src/hotspot/share/jvmci/jvmciRuntime.cpp @@ -1973,7 +1973,10 @@ static bool after_compiler_upcall(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, c const char* pending_stack_trace = nullptr; JVMCIENV->pending_exception_as_string(&pending_string, &pending_stack_trace); if (pending_string == nullptr) pending_string = "null"; - const char* failure_reason = os::strdup(err_msg("uncaught exception in %s [%s]", function, pending_string), mtJVMCI); + // Using stringStream instead of err_msg to avoid truncation + stringStream st; + st.print("uncaught exception in %s [%s]", function, pending_string); + const char* failure_reason = os::strdup(st.freeze(), mtJVMCI); if (failure_reason == nullptr) { failure_reason = "uncaught exception"; reason_on_C_heap = false;