Skip to content

Commit

Permalink
8323616: [JVMCI] TestInvalidJVMCIOption.java fails intermittently wit…
Browse files Browse the repository at this point in the history
…h NPE

Reviewed-by: thartmann, never
  • Loading branch information
Doug Simon committed Jan 16, 2024
1 parent b533272 commit 19c9388
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
7 changes: 7 additions & 0 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
Expand Up @@ -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);
Expand Down
8 changes: 6 additions & 2 deletions test/hotspot/jtreg/compiler/jvmci/TestInvalidJVMCIOption.java
Expand Up @@ -48,9 +48,13 @@ public static void main(String[] args) throws Exception {
"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);
}
}

0 comments on commit 19c9388

Please sign in to comment.