Skip to content

Commit 28b5896

Browse files
committed
Enable shared arena support by default
1 parent b4039c6 commit 28b5896

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

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

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,16 +1528,13 @@ public static boolean isForeignAPIEnabled() {
15281528
public static final HostedOptionKey<Boolean> VectorAPISupport = new HostedOptionKey<>(false);
15291529

15301530
@Option(help = "Enable support for Arena.ofShared ", type = Expert)//
1531-
public static final HostedOptionKey<Boolean> SharedArenaSupport = new HostedOptionKey<>(false, key -> {
1532-
if (key.getValue()) {
1533-
UserError.guarantee(isForeignAPIEnabled(), "Support for Arena.ofShared is only available with foreign API support. " +
1534-
"Enable foreign API support with %s",
1535-
SubstrateOptionsParser.commandArgument(ForeignAPISupport, "+"));
1536-
1531+
public static final HostedOptionKey<Boolean> SharedArenaSupport = new HostedOptionKey<>(true, key -> {
1532+
if (isSharedArenaSupportEnabled()) {
15371533
// GR-65162: Shared arenas cannot be used together with Vector API support
1538-
UserError.guarantee(!VectorAPIEnabled.getValue(), "Support for Arena.ofShared is not available with Vector API support. " +
1539-
"Either disable Vector API support using %s or replace usages of Arena.ofShared with Arena.ofAuto and disable shared arena support.",
1540-
SubstrateOptionsParser.commandArgument(VectorAPISupport, "-"));
1534+
UserError.guarantee(!VectorAPIEnabled.getValue(), "Support for Arena.ofShared (which is part of the FFM API) is not available with Vector API support. " +
1535+
"Either disable Vector API support using %s or replace usages of Arena.ofShared with Arena.ofAuto and disable shared arena support using %s.",
1536+
SubstrateOptionsParser.commandArgument(VectorAPISupport, "-"),
1537+
SubstrateOptionsParser.commandArgument(key, "-"));
15411538
}
15421539
});
15431540

substratevm/src/com.oracle.svm.hosted.foreign/src/com/oracle/svm/hosted/foreign/ForeignFunctionsFeature.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.util.function.Supplier;
4949
import java.util.function.UnaryOperator;
5050

51+
import com.oracle.svm.core.thread.JavaThreads;
5152
import org.graalvm.collections.EconomicSet;
5253
import org.graalvm.nativeimage.AnnotationAccess;
5354
import org.graalvm.nativeimage.ImageSingletons;
@@ -764,6 +765,7 @@ protected void initSafeArenaAccessors(BeforeAnalysisAccessImpl access) throws No
764765
registerSafeArenaAccessorMethod(metaAccess, ReflectionUtil.lookupMethod(mappedMemoryUtils, "unload", long.class, boolean.class, long.class));
765766
registerSafeArenaAccessorMethod(metaAccess, ReflectionUtil.lookupMethod(SubstrateMappedMemoryUtils.class, "load", long.class, boolean.class, long.class));
766767
registerSafeArenaAccessorMethod(metaAccess, Thread.class.getMethod("currentThread"));
768+
registerSafeArenaAccessorMethod(metaAccess, JavaThreads.class.getMethod("getCurrentThreadOrNull"));
767769

768770
/*
769771
* The actual method checking a valid session state (if not inlined) is also safe as this

0 commit comments

Comments
 (0)