Skip to content

Commit 65ad0eb

Browse files
committed
Address review comments
1 parent a6158cc commit 65ad0eb

File tree

4 files changed

+22
-23
lines changed

4 files changed

+22
-23
lines changed

sdk/mx.sdk/mx_sdk_vm_ng.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def get_build_args(self):
380380
build_args += [
381381
'-R:+EnableSignalHandling',
382382
'-R:+InstallSegfaultHandler',
383-
'-H:+UnlockExperimentalVMOptions', '-H:+InstallJavaExitHandlersForSharedLibrary', '-H:-UnlockExperimentalVMOptions'
383+
'-H:+UnlockExperimentalVMOptions', '-H:+InstallExitHandlers', '-H:-UnlockExperimentalVMOptions',
384384
]
385385

386386
# Monitoring flags

substratevm/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ This changelog summarizes major changes to GraalVM Native Image.
1919
* (GR-60209) New syntax for configuration of the [Foreign Function & Memory API](https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/ForeignInterface.md)
2020
* (GR-64584) Experimental option `-H:+RelativeCodePointers` to significantly reduce relocation entries in position-independent executables and shared libraries.
2121
* (GR-60238) JNI registration is now included as part of the `"reflection"` section of _reachability-metadata.json_ using the `"jniAccessible"` attribute. Registrations performed through the `"jni"` section of _reachability-metadata.json_ and through _jni-config.json_ will still be accepted and parsed correctly.
22-
* (GR-64787) Enable `--install-exit-handlers` by default for executables and deprecate the option. If shared libraries were using this flag, the same functionality can be restored by using `-H:+InstallJavaExitHandlersForSharedLibrary`.
22+
* (GR-64787) Enable `--install-exit-handlers` by default for executables deprecate the option. To restore the previous functionality needs to be restored one can use `-H:-InstallExitHandlers`. To enable in shared libraries use `-H:-InstallExitHandlers`.
2323

2424
## GraalVM for JDK 24 (Internal Version 24.2.0)
2525
* (GR-59717) Added `DuringSetupAccess.registerObjectReachabilityHandler` to allow registering a callback that is executed when an object of a specified type is marked as reachable during heap scanning.

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

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@
2424
*/
2525
package com.oracle.svm.core;
2626

27-
import org.graalvm.nativeimage.ImageInfo;
28-
2927
import com.oracle.svm.core.annotate.Alias;
3028
import com.oracle.svm.core.annotate.TargetClass;
3129
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
@@ -36,7 +34,7 @@
3634
public class SubstrateExitHandlerFeature implements InternalFeature {
3735
@Override
3836
public void beforeAnalysis(BeforeAnalysisAccess access) {
39-
if (!ImageInfo.isSharedLibrary() || SubstrateOptions.DeprecatedOptions.InstallExitHandlers.getValue() || SubstrateOptions.InstallJavaExitHandlersForSharedLibrary.getValue()) {
37+
if (SubstrateOptions.InstallExitHandlers.getValue()) {
4038
RuntimeSupport.getRuntimeSupport().addStartupHook(new SubstrateExitHandlerStartupHook());
4139
}
4240
}
@@ -45,10 +43,8 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
4543
final class SubstrateExitHandlerStartupHook implements RuntimeSupport.Hook {
4644
@Override
4745
public void execute(boolean isFirstIsolate) {
48-
if (SubstrateOptions.EnableSignalHandling.getValue()) {
49-
if (isFirstIsolate) {
50-
Target_java_lang_Terminator.setup();
51-
}
46+
if (SubstrateOptions.EnableSignalHandling.getValue() && isFirstIsolate) {
47+
Target_java_lang_Terminator.setup();
5248
}
5349
}
5450
}

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

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,6 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Boolean o
591591
}
592592
}
593593
};
594-
595-
@APIOption(name = "install-exit-handlers", deprecated = "Enabled by default for executables. For shared libraries (when --shared is used), use the experimental option -H:+InstallJavaExitHandlersForSharedLibrary.")//
596-
@Option(help = "Provide java.lang.Terminator exit handlers", deprecated = true, deprecationMessage = "Enabled by default for executables. For shared libraries (when --shared is used), use the experimental option -H:+InstallJavaExitHandlersForSharedLibrary.")//
597-
protected static final HostedOptionKey<Boolean> InstallExitHandlers = new HostedOptionKey<>(false);
598-
599594
}
600595

601596
@Option(help = "Enable detection and runtime container configuration support.")//
@@ -1075,6 +1070,23 @@ private static void validateStripDebugInfo(HostedOptionKey<Boolean> optionKey) {
10751070
@Option(help = "Emit debuginfo debug.svm.imagebuild.* sections with detailed image-build options.")//
10761071
public static final HostedOptionKey<Boolean> UseImagebuildDebugSections = new HostedOptionKey<>(true);
10771072

1073+
@APIOption(name = "install-exit-handlers", deprecated = "--install-exit-handlers is enabled by default for executables and it can likely be removed. To use this option for the shared libraries, please use -H:+InstallExitHandlers.")//
1074+
@Option(help = "Provide java.lang.Terminator exit handlers. Default value is true for executables and false for shared libraries because this option installs signal handlers.", type = Expert, stability = OptionStability.EXPERIMENTAL)//
1075+
protected static final HostedOptionKey<Boolean> InstallExitHandlers = new HostedOptionKey<>(null) {
1076+
@Override
1077+
public Boolean getValueOrDefault(UnmodifiableEconomicMap<OptionKey<?>, Object> values) {
1078+
if (values.containsKey(this)) {
1079+
return (Boolean) values.get(this);
1080+
}
1081+
return ImageInfo.isExecutable();
1082+
}
1083+
1084+
@Override
1085+
public Boolean getValue(OptionValues values) {
1086+
return getValueOrDefault(values.getMap());
1087+
}
1088+
};
1089+
10781090
@Fold
10791091
public static boolean supportCompileInIsolates() {
10801092
UserError.guarantee(!ConcealedOptions.SupportCompileInIsolates.getValue() || SpawnIsolates.getValue(),
@@ -1098,15 +1110,6 @@ public static boolean shouldCompileInIsolates() {
10981110
@Option(help = "Size of the reserved address space of each compilation isolate (0: default for new isolates).") //
10991111
public static final RuntimeOptionKey<Long> CompilationIsolateAddressSpaceSize = new RuntimeOptionKey<>(0L);
11001112

1101-
@Option(help = "Provide java.lang.Terminator exit handlers for shared libraries. Note: this flag must be used with -XX:+EnableSignalHandling and will run shutdown hooks only in one isolate.", stability = OptionStability.EXPERIMENTAL, type = Expert)//
1102-
public static final HostedOptionKey<Boolean> InstallJavaExitHandlersForSharedLibrary = new HostedOptionKey<>(false, key -> {
1103-
if (key.getValue()) {
1104-
UserError.guarantee(ImageInfo.isSharedLibrary(), "%s can be used only for shared libraries (when image is built with %s)",
1105-
SubstrateOptionsParser.commandArgument(key, "+"),
1106-
SubstrateOptionsParser.commandArgument(SharedLibrary, "+"));
1107-
}
1108-
});
1109-
11101113
/** Query these options only through an appropriate method. */
11111114
public static class ConcealedOptions {
11121115

0 commit comments

Comments
 (0)