Skip to content

[GR-68116] Enable shared arena support by default. #11828

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1475,12 +1475,8 @@ public static boolean isForeignAPIEnabled() {
public static final HostedOptionKey<Boolean> VectorAPISupport = new HostedOptionKey<>(false);

@Option(help = "Enable support for Arena.ofShared ", type = Expert)//
public static final HostedOptionKey<Boolean> 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<Boolean> 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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down