Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
replace JVMCICompileMethodExceptionIsFatal VM flag with test.jvmci.co…
…mpileMethodExceptionIsFatal system property
  • Loading branch information
dougxc committed May 16, 2023
commit 90f4346b3c8737fd0fee25a7ed0c32a1bd506c88
11 changes: 7 additions & 4 deletions src/hotspot/share/jvmci/jvmciRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include "oops/typeArrayOop.inline.hpp"
#include "prims/jvmtiExport.hpp"
#include "prims/methodHandles.hpp"
#include "runtime/arguments.hpp"
#include "runtime/atomic.hpp"
#include "runtime/deoptimization.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
Expand Down Expand Up @@ -2043,11 +2044,13 @@ void JVMCIRuntime::compile_method(JVMCIEnv* JVMCIENV, JVMCICompiler* compiler, c

JVMCIObject result_object = JVMCIENV->call_HotSpotJVMCIRuntime_compileMethod(receiver, jvmci_method, entry_bci,
(jlong) compile_state, compile_state->task()->compile_id());
#ifdef ASSERT
if (JVMCIENV->has_pending_exception() && JVMCICompileMethodExceptionIsFatal) {
fatal_exception(JVMCIENV, "testing JVMCI fatal exception handling");
if (JVMCIENV->has_pending_exception()) {
const char* val = Arguments::PropertyList_get_value(Arguments::system_properties(), "test.jvmci.compileMethodExceptionIsFatal");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this view on system properties is restricted to properties set at VM startup (e.g. on the command line) and will not see the result of calls to System.setProperty() made by an application.

if (val != nullptr && strcmp(val, "true") == 0) {
fatal_exception(JVMCIENV, "testing JVMCI fatal exception handling");
}
}
#endif

if (after_compiler_upcall(JVMCIENV, compiler, method, "call_HotSpotJVMCIRuntime_compileMethod")) {
return;
}
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/jvmci/jvmci_globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ bool JVMCIGlobals::check_jvmci_flags_are_consistent() {
CHECK_NOT_SET(JVMCINativeLibraryThreadFraction, EnableJVMCI)
CHECK_NOT_SET(JVMCILibPath, EnableJVMCI)
CHECK_NOT_SET(JVMCINativeLibraryErrorFile, EnableJVMCI)
CHECK_NOT_SET(JVMCICompileMethodExceptionIsFatal, EnableJVMCI)
CHECK_NOT_SET(JVMCILibDumpJNIConfig, EnableJVMCI)

#ifndef COMPILER2
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/jvmci/jvmci_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ class fileStream;
"error data to this file" \
"[default: ./" LIBJVMCI_ERR_FILE "] (%p replaced with pid)") \
\
notproduct(bool, JVMCICompileMethodExceptionIsFatal, false, \
"An exception thrown by HotSpotJVMCIRuntime::compileMethod " \
"is fatal. Used to test error handling only.") \
\
NOT_COMPILER2(product(bool, UseMultiplyToLenIntrinsic, false, DIAGNOSTIC, \
"Enables intrinsification of BigInteger.multiplyToLen()")) \
\
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
* @test
* @summary Tests handling of an exception thrown by HotSpotJVMCIRuntime.compileMethod.
* @requires vm.jvmci
* @requires vm.debug
* @library /test/lib /
* @modules jdk.internal.vm.ci/jdk.vm.ci.hotspot
* jdk.internal.vm.ci/jdk.vm.ci.code
Expand Down Expand Up @@ -72,8 +71,9 @@ public static void main(String[] args) throws Exception {
int total = 0;
long start = System.currentTimeMillis();

// Use a 5 sec timeout just in case the compiler creation fails
while (System.currentTimeMillis() - start < 5000) {
// Use a 10 sec timeout to prevent endless loop if
// JVMCI compiler creation fails
while (System.currentTimeMillis() - start < 10_000) {
total += getTime();
if (watch.exists()) {
watch.delete();
Expand All @@ -95,7 +95,7 @@ static void testSubprocess(boolean fatalError) throws Exception {
"-XX:-TieredCompilation",
"-XX:+PrintCompilation",
"--add-exports=jdk.internal.vm.ci/jdk.vm.ci.services=ALL-UNNAMED",
"-XX:" + (fatalError ? "+" : "-") + "JVMCICompileMethodExceptionIsFatal",
"-Dtest.jvmci.compileMethodExceptionIsFatal=" + (fatalError ? "true" : "false"),
"-XX:+PrintWarnings",
"-Xbootclasspath/a:.",
TestUncaughtErrorInCompileMethod.class.getName(), "true");
Expand Down