Skip to content

Commit a9286ad

Browse files
committed
[GR-65416] Use -R:+EnableSignalHandling -R:+InstallSegfaultHandler instead of forcing them in the thin launchers
PullRequest: graal/20980
2 parents 30be617 + 03cf2bf commit a9286ad

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

sdk/mx.sdk/mx_sdk_vm_impl.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,8 @@ def contents(self):
14171417

14181418
if isinstance(image_config, mx_sdk.LauncherConfig) or (isinstance(image_config, mx_sdk.LanguageLibraryConfig) and image_config.launchers):
14191419
build_args += [
1420+
'-R:+EnableSignalHandling',
1421+
'-R:+InstallSegfaultHandler',
14201422
'--enable-monitoring=jvmstat,heapdump,jfr,threaddump',
14211423
] + svm_experimental_options([
14221424
'-H:+InstallExitHandlers',

sdk/mx.sdk/mx_sdk_vm_ng.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ class LanguageLibraryProject(NativeImageLibraryProject):
376376
def get_build_args(self):
377377
build_args = super().get_build_args()[:]
378378

379-
# Signals flags, the first 2 are also set in AbstractLanguageLauncher but better to be explicit
379+
# Signals flags
380380
build_args += [
381381
'-R:+EnableSignalHandling',
382382
'-R:+InstallSegfaultHandler',

sdk/src/org.graalvm.launcher/src/org/graalvm/launcher/AbstractLanguageLauncher.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* The Universal Permissive License (UPL), Version 1.0
@@ -48,7 +48,6 @@
4848
import java.util.List;
4949
import java.util.Map;
5050

51-
import org.graalvm.nativeimage.RuntimeOptions;
5251
import org.graalvm.polyglot.Context;
5352
import org.graalvm.polyglot.Engine;
5453
import org.graalvm.polyglot.Language;
@@ -150,12 +149,6 @@ protected final void launch(String[] args) {
150149
* @throws Exception if no launcher constructor has been set.
151150
*/
152151
public static void runLauncher(byte[][] optionVarsArgs, byte[][] args, int argc, long argv, boolean relaunch) throws Exception {
153-
if (isAOT()) {
154-
// enable signal handling for the launcher
155-
RuntimeOptions.set("EnableSignalHandling", true);
156-
RuntimeOptions.set("InstallSegfaultHandler", true);
157-
}
158-
159152
if (LAUNCHER_CTOR == null) {
160153
throw new Exception("Launcher constructor has not been set.");
161154
}

substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateSegfaultHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static boolean isFirst() {
129129
public abstract class SubstrateSegfaultHandler {
130130
public static class Options {
131131
@Option(help = "Install segfault handler that prints register contents and full Java stacktrace. Default: enabled for an executable, disabled for a shared library, disabled when EnableSignalHandling is disabled.")//
132-
static final RuntimeOptionKey<Boolean> InstallSegfaultHandler = new RuntimeOptionKey<>(null);
132+
public static final RuntimeOptionKey<Boolean> InstallSegfaultHandler = new RuntimeOptionKey<>(null);
133133
}
134134

135135
private static final long MARKER_VALUE = 0x0123456789ABCDEFL;

substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/isolated/IsolatedGraalUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
import java.lang.reflect.Array;
2828
import java.nio.ByteBuffer;
2929

30+
import com.oracle.svm.core.SubstrateSegfaultHandler;
3031
import org.graalvm.collections.EconomicMap;
3132
import org.graalvm.nativeimage.CurrentIsolate;
3233
import org.graalvm.nativeimage.Isolates;
@@ -127,6 +128,10 @@ private static void appendOptionsRelevantForCompilationIsolates(CreateIsolatePar
127128

128129
/* Compilation isolates do the reference handling manually to avoid the extra thread. */
129130
appendArgument(builder, SubstrateOptions.ConcealedOptions.AutomaticReferenceHandling, false);
131+
132+
/* Disable signal handling for compilation isolates. */
133+
appendArgument(builder, SubstrateOptions.EnableSignalHandling, false);
134+
appendArgument(builder, SubstrateSegfaultHandler.Options.InstallSegfaultHandler, false);
130135
}
131136

132137
private static void appendOptionsExplicitlySetForCompilationIsolates(CreateIsolateParameters.Builder builder) {

0 commit comments

Comments
 (0)