8329191: JVMCI compiler warning is truncated

Reviewed-by: never
This commit is contained in:
Doug Simon 2024-03-28 10:16:39 +00:00
parent 2b79c22c43
commit 7c7b961e73
3 changed files with 18 additions and 8 deletions

View File

@ -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);

View File

@ -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.

View File

@ -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;