|
164 | 164 | import jdk.vm.ci.services.Services;
|
165 | 165 |
|
166 | 166 | class LibGraalOptions {
|
167 |
| - @Option(help = "Converts an exception triggered by the CrashAt option into a fatal error " + |
| 167 | + @Option(help = "If non-zero, converts an exception triggered by the CrashAt option into a fatal error " + |
168 | 168 | "if a non-null pointer was passed in the _fatal option to JNI_CreateJavaVM. " +
|
| 169 | + "The value of this option is the number of milliseconds to sleep before calling _fatal. " + |
169 | 170 | "This option exists for the purpose of testing fatal error handling in libgraal.") //
|
170 |
| - static final RuntimeOptionKey<Boolean> CrashAtIsFatal = new LibGraalRuntimeOptionKey<>(false); |
| 171 | + static final RuntimeOptionKey<Integer> CrashAtIsFatal = new LibGraalRuntimeOptionKey<>(0); |
171 | 172 | @Option(help = "The fully qualified name of a no-arg, void, static method to be invoked " +
|
172 | 173 | "in HotSpot from libgraal when the libgraal isolate is being shutdown." +
|
173 | 174 | "This option exists for the purpose of testing callbacks in this context.") //
|
@@ -889,8 +890,8 @@ static OptionValues initializeOptions() {
|
889 | 890 | options.update(values);
|
890 | 891 | }
|
891 | 892 |
|
892 |
| - if (LibGraalOptions.CrashAtThrowsOOME.getValue() && LibGraalOptions.CrashAtIsFatal.getValue()) { |
893 |
| - throw new IllegalArgumentException("CrashAtThrowsOOME and CrashAtIsFatal cannot both be true"); |
| 893 | + if (LibGraalOptions.CrashAtThrowsOOME.getValue() && LibGraalOptions.CrashAtIsFatal.getValue() != 0) { |
| 894 | + throw new IllegalArgumentException("CrashAtThrowsOOME and CrashAtIsFatal cannot both be enabled"); |
894 | 895 | }
|
895 | 896 |
|
896 | 897 | return options;
|
@@ -939,9 +940,14 @@ private static boolean notifyCrash(String crashMessage) {
|
939 | 940 | // Remaining compilations should proceed so that test finishes quickly.
|
940 | 941 | return false;
|
941 | 942 | }
|
942 |
| - } else if (LibGraalOptions.CrashAtIsFatal.getValue()) { |
| 943 | + } else if (LibGraalOptions.CrashAtIsFatal.getValue() != 0) { |
943 | 944 | LogHandler handler = ImageSingletons.lookup(LogHandler.class);
|
944 | 945 | if (handler instanceof FunctionPointerLogHandler) {
|
| 946 | + try { |
| 947 | + Thread.sleep(LibGraalOptions.CrashAtIsFatal.getValue()); |
| 948 | + } catch (InterruptedException e) { |
| 949 | + // ignore |
| 950 | + } |
945 | 951 | VMError.shouldNotReachHere(crashMessage);
|
946 | 952 | }
|
947 | 953 | // If changing this message, update the test for it in mx_vm_gate.py
|
|
0 commit comments