diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java index 934259f4c1c2..ac89eec9c81a 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java @@ -1475,12 +1475,8 @@ public static boolean isForeignAPIEnabled() { public static final HostedOptionKey VectorAPISupport = new HostedOptionKey<>(false); @Option(help = "Enable support for Arena.ofShared ", type = Expert)// - public static final HostedOptionKey SharedArenaSupport = new HostedOptionKey<>(false, key -> { - if (key.getValue()) { - UserError.guarantee(isForeignAPIEnabled(), "Support for Arena.ofShared is only available with foreign API support. " + - "Enable foreign API support with %s", - SubstrateOptionsParser.commandArgument(ForeignAPISupport, "+")); - + public static final HostedOptionKey SharedArenaSupport = new HostedOptionKey<>(true, key -> { + if (isSharedArenaSupportEnabled()) { // GR-65162: Shared arenas cannot be used together with Vector API support UserError.guarantee(!VectorAPIEnabled.getValue(), "Support for Arena.ofShared is not available with Vector API support. " + "Either disable Vector API support using %s or replace usages of Arena.ofShared with Arena.ofAuto and disable shared arena support.", diff --git a/substratevm/src/com.oracle.svm.hosted.foreign/src/com/oracle/svm/hosted/foreign/ForeignFunctionsFeature.java b/substratevm/src/com.oracle.svm.hosted.foreign/src/com/oracle/svm/hosted/foreign/ForeignFunctionsFeature.java index b13ba343e97b..5287857f1f0e 100644 --- a/substratevm/src/com.oracle.svm.hosted.foreign/src/com/oracle/svm/hosted/foreign/ForeignFunctionsFeature.java +++ b/substratevm/src/com.oracle.svm.hosted.foreign/src/com/oracle/svm/hosted/foreign/ForeignFunctionsFeature.java @@ -48,6 +48,7 @@ import java.util.function.Supplier; import java.util.function.UnaryOperator; +import com.oracle.svm.core.thread.JavaThreads; import org.graalvm.collections.EconomicSet; import org.graalvm.nativeimage.AnnotationAccess; import org.graalvm.nativeimage.ImageSingletons; @@ -764,6 +765,7 @@ protected void initSafeArenaAccessors(BeforeAnalysisAccessImpl access) throws No registerSafeArenaAccessorMethod(metaAccess, ReflectionUtil.lookupMethod(mappedMemoryUtils, "unload", long.class, boolean.class, long.class)); registerSafeArenaAccessorMethod(metaAccess, ReflectionUtil.lookupMethod(SubstrateMappedMemoryUtils.class, "load", long.class, boolean.class, long.class)); registerSafeArenaAccessorMethod(metaAccess, Thread.class.getMethod("currentThread")); + registerSafeArenaAccessorMethod(metaAccess, JavaThreads.class.getMethod("getCurrentThreadOrNull")); /* * The actual method checking a valid session state (if not inlined) is also safe as this