Skip to content

Commit d5ff4f0

Browse files
committed
Enable shared arena support by default
1 parent c18c686 commit d5ff4f0

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,12 +1475,8 @@ public static boolean isForeignAPIEnabled() {
14751475
public static final HostedOptionKey<Boolean> VectorAPISupport = new HostedOptionKey<>(false);
14761476

14771477
@Option(help = "Enable support for Arena.ofShared ", type = Expert)//
1478-
public static final HostedOptionKey<Boolean> SharedArenaSupport = new HostedOptionKey<>(false, key -> {
1479-
if (key.getValue()) {
1480-
UserError.guarantee(isForeignAPIEnabled(), "Support for Arena.ofShared is only available with foreign API support. " +
1481-
"Enable foreign API support with %s",
1482-
SubstrateOptionsParser.commandArgument(ForeignAPISupport, "+"));
1483-
1478+
public static final HostedOptionKey<Boolean> SharedArenaSupport = new HostedOptionKey<>(true, key -> {
1479+
if (isSharedArenaSupportEnabled()) {
14841480
// GR-65162: Shared arenas cannot be used together with Vector API support
14851481
UserError.guarantee(!VectorAPIEnabled.getValue(), "Support for Arena.ofShared is not available with Vector API support. " +
14861482
"Either disable Vector API support using %s or replace usages of Arena.ofShared with Arena.ofAuto and disable shared arena support.",

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)