8323616: [JVMCI] TestInvalidJVMCIOption.java fails intermittently with NPE

Reviewed-by: thartmann, never
This commit is contained in:
Doug Simon 2024-01-16 19:31:04 +00:00
parent b533272ecb
commit 19c9388c20
2 changed files with 13 additions and 2 deletions

View File

@ -3037,6 +3037,13 @@ C2V_VMENTRY_0(jboolean, addFailedSpeculation, (JNIEnv* env, jobject, jlong faile
C2V_END
C2V_VMENTRY(void, callSystemExit, (JNIEnv* env, jobject, jint status))
if (!JVMCIENV->is_hotspot()) {
// It's generally not safe to call Java code before the module system is initialized
if (!Universe::is_module_initialized()) {
JVMCI_event_1("callSystemExit(%d) before Universe::is_module_initialized() -> direct VM exit", status);
vm_exit_during_initialization();
}
}
CompilerThreadCanCallJava canCallJava(thread, true);
JavaValue result(T_VOID);
JavaCallArguments jargs(1);

View File

@ -48,9 +48,13 @@ public class TestInvalidJVMCIOption {
"Error parsing JVMCI options: Could not find option jvmci.XXXXXXXXX%n" +
"Error: A fatal exception has occurred. Program will exit.%n");
Asserts.assertEQ(expectStdout, output.getStdout());
output.stderrShouldBeEmpty();
// Test for containment instead of equality as -XX:+EagerJVMCI means
// the main thread and one or more libjvmci compiler threads
// may initialize libjvmci at the same time and thus the error
// message can appear multiple times.
output.stdoutShouldContain(expectStdout);
output.stderrShouldBeEmpty();
output.shouldHaveExitValue(1);
}
}