Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/hotspot/share/jvmci/jvmciCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 8 additions & 4 deletions src/hotspot/share/jvmci/jvmciEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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.
Expand Down
5 changes: 4 additions & 1 deletion src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down