Skip to content

Commit 7c7b961

Browse files
author
Doug Simon
committed
8329191: JVMCI compiler warning is truncated
Reviewed-by: never
1 parent 2b79c22 commit 7c7b961

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

src/hotspot/share/jvmci/jvmciCompiler.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,12 @@ void JVMCICompiler::on_upcall(const char* error, JVMCICompileState* compile_stat
229229
if (err > 10 && err * 10 > ok && !_disabled) {
230230
_disabled = true;
231231
int total = err + ok;
232-
const char* disable_msg = err_msg("JVMCI compiler disabled "
233-
"after %d of %d upcalls had errors (Last error: \"%s\"). "
234-
"Use -Xlog:jit+compilation for more detail.", err, total, error);
232+
// Using stringStream instead of err_msg to avoid truncation
233+
stringStream st;
234+
st.print("JVMCI compiler disabled "
235+
"after %d of %d upcalls had errors (Last error: \"%s\"). "
236+
"Use -Xlog:jit+compilation for more detail.", err, total, error);
237+
const char* disable_msg = st.freeze();
235238
log_warning(jit,compilation)("%s", disable_msg);
236239
if (compile_state != nullptr) {
237240
const char* disable_error = os::strdup(disable_msg);

src/hotspot/share/jvmci/jvmciEnv.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,10 @@ void JVMCIEnv::check_init(JVMCI_TRAPS) {
239239
if (_init_error == JNI_ENOMEM) {
240240
JVMCI_THROW_MSG(OutOfMemoryError, "JNI_ENOMEM creating or attaching to libjvmci");
241241
}
242-
JVMCI_THROW_MSG(InternalError, err_msg("Error creating or attaching to libjvmci (err: %d, description: %s)",
243-
_init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg));
242+
stringStream st;
243+
st.print("Error creating or attaching to libjvmci (err: %d, description: %s)",
244+
_init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg);
245+
JVMCI_THROW_MSG(InternalError, st.freeze());
244246
}
245247

246248
void JVMCIEnv::check_init(TRAPS) {
@@ -250,8 +252,10 @@ void JVMCIEnv::check_init(TRAPS) {
250252
if (_init_error == JNI_ENOMEM) {
251253
THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "JNI_ENOMEM creating or attaching to libjvmci");
252254
}
253-
THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), err_msg("Error creating or attaching to libjvmci (err: %d, description: %s)",
254-
_init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg));
255+
stringStream st;
256+
st.print("Error creating or attaching to libjvmci (err: %d, description: %s)",
257+
_init_error, _init_error_msg == nullptr ? "unknown" : _init_error_msg);
258+
THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), st.freeze());
255259
}
256260

257261
// Prints a pending exception (if any) and its stack trace to st.

src/hotspot/share/jvmci/jvmciRuntime.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,10 @@ static bool after_compiler_upcall(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, c
19731973
const char* pending_stack_trace = nullptr;
19741974
JVMCIENV->pending_exception_as_string(&pending_string, &pending_stack_trace);
19751975
if (pending_string == nullptr) pending_string = "null";
1976-
const char* failure_reason = os::strdup(err_msg("uncaught exception in %s [%s]", function, pending_string), mtJVMCI);
1976+
// Using stringStream instead of err_msg to avoid truncation
1977+
stringStream st;
1978+
st.print("uncaught exception in %s [%s]", function, pending_string);
1979+
const char* failure_reason = os::strdup(st.freeze(), mtJVMCI);
19771980
if (failure_reason == nullptr) {
19781981
failure_reason = "uncaught exception";
19791982
reason_on_C_heap = false;

0 commit comments

Comments
 (0)