Skip to content

Commit 318a01c

Browse files
committed
Remove sequential reachability handler.
1 parent 83201c5 commit 318a01c

File tree

7 files changed

+6
-260
lines changed

7 files changed

+6
-260
lines changed

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,9 +1286,6 @@ protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, String ol
12861286
@Option(help = "Verify type states computed by the static analysis at run time. This is useful when diagnosing problems in the static analysis, but reduces peak performance significantly.", type = OptionType.Debug)//
12871287
public static final HostedOptionKey<Boolean> VerifyTypes = new HostedOptionKey<>(false);
12881288

1289-
@Option(help = "Run reachability handlers concurrently during analysis.", type = Expert, deprecated = true, deprecationMessage = "This option was introduced to simplify migration to GraalVM 22.2 and will be removed in a future release")//
1290-
public static final HostedOptionKey<Boolean> RunReachabilityHandlersConcurrently = new HostedOptionKey<>(true);
1291-
12921289
@Option(help = "Force many trampolines to be needed for inter-method calls. Normally trampolines are only used when a method destination is outside the range of a pc-relative branch instruction.", type = OptionType.Debug)//
12931290
public static final HostedOptionKey<Boolean> UseDirectCallTrampolinesALot = new HostedOptionKey<>(false);
12941291

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ConcurrentReachabilityHandler.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2022, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2022, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -31,35 +31,21 @@
3131
import java.util.function.BiConsumer;
3232
import java.util.function.Consumer;
3333

34-
import org.graalvm.nativeimage.ImageSingletons;
35-
3634
import com.oracle.graal.pointsto.meta.AnalysisElement;
3735
import com.oracle.graal.pointsto.meta.AnalysisElement.ElementNotification;
3836
import com.oracle.graal.pointsto.meta.AnalysisElement.MethodOverrideReachableNotification;
3937
import com.oracle.graal.pointsto.meta.AnalysisElement.SubtypeReachableNotification;
4038
import com.oracle.graal.pointsto.meta.AnalysisMetaAccess;
4139
import com.oracle.graal.pointsto.meta.AnalysisMethod;
4240
import com.oracle.graal.pointsto.meta.AnalysisType;
43-
import com.oracle.svm.core.SubstrateOptions;
4441
import com.oracle.svm.core.feature.InternalFeature;
45-
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
4642
import com.oracle.svm.core.util.UserError;
4743
import com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl;
4844

49-
@AutomaticallyRegisteredFeature
5045
public class ConcurrentReachabilityHandler extends ReachabilityHandler implements InternalFeature {
5146

5247
private final Map<Consumer<DuringAnalysisAccess>, ElementNotification> reachabilityNotifications = new ConcurrentHashMap<>();
5348

54-
public static ConcurrentReachabilityHandler singleton() {
55-
return ImageSingletons.lookup(ConcurrentReachabilityHandler.class);
56-
}
57-
58-
@Override
59-
public boolean isInConfiguration(IsInConfigurationAccess access) {
60-
return SubstrateOptions.RunReachabilityHandlersConcurrently.getValue();
61-
}
62-
6349
@Override
6450
public void registerMethodOverrideReachabilityHandler(BeforeAnalysisAccessImpl access, BiConsumer<DuringAnalysisAccess, Executable> callback, Executable baseMethod) {
6551
AnalysisMetaAccess metaAccess = access.getMetaAccess();

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/FeatureImpl.java

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@
6767
import com.oracle.graal.pointsto.meta.ObjectReachableCallback;
6868
import com.oracle.svm.common.meta.MultiMethod;
6969
import com.oracle.svm.core.LinkerInvocation;
70-
import com.oracle.svm.core.SubstrateOptions;
7170
import com.oracle.svm.core.annotate.Delete;
7271
import com.oracle.svm.core.feature.InternalFeature;
7372
import com.oracle.svm.core.graal.code.SubstrateBackend;
@@ -76,7 +75,6 @@
7675
import com.oracle.svm.core.meta.SharedField;
7776
import com.oracle.svm.core.meta.SharedMethod;
7877
import com.oracle.svm.core.meta.SharedType;
79-
import com.oracle.svm.core.option.SubstrateOptionsParser;
8078
import com.oracle.svm.core.util.UserError;
8179
import com.oracle.svm.core.util.VMError;
8280
import com.oracle.svm.hosted.ameta.FieldValueInterceptionSupport;
@@ -360,16 +358,14 @@ public SVMHost getHostVM() {
360358
public static class BeforeAnalysisAccessImpl extends AnalysisAccessBase implements Feature.BeforeAnalysisAccess {
361359

362360
private final NativeLibraries nativeLibraries;
363-
private final boolean concurrentReachabilityHandlers;
364361
private final ReachabilityHandler reachabilityHandler;
365-
private ClassForNameSupport classForNameSupport;
362+
private final ClassForNameSupport classForNameSupport;
366363

367364
public BeforeAnalysisAccessImpl(FeatureHandler featureHandler, ImageClassLoader imageClassLoader, Inflation bb, NativeLibraries nativeLibraries,
368365
DebugContext debugContext) {
369366
super(featureHandler, imageClassLoader, bb, debugContext);
370367
this.nativeLibraries = nativeLibraries;
371-
this.concurrentReachabilityHandlers = SubstrateOptions.RunReachabilityHandlersConcurrently.getValue(bb.getOptions());
372-
this.reachabilityHandler = concurrentReachabilityHandlers ? ConcurrentReachabilityHandler.singleton() : ReachabilityHandlerFeature.singleton();
368+
this.reachabilityHandler = new ConcurrentReachabilityHandler();
373369
this.classForNameSupport = ClassForNameSupport.currentLayer();
374370
}
375371

@@ -491,10 +487,6 @@ public void registerClassInitializerReachabilityHandler(Consumer<DuringAnalysisA
491487
reachabilityHandler.registerClassInitializerReachabilityHandler(this, callback, clazz);
492488
}
493489

494-
public boolean concurrentReachabilityHandlers() {
495-
return concurrentReachabilityHandlers;
496-
}
497-
498490
@Override
499491
public void registerFieldValueTransformer(Field field, FieldValueTransformer transformer) {
500492
FieldValueInterceptionSupport.singleton().registerFieldValueTransformer(field, transformer);
@@ -534,19 +526,14 @@ public boolean getAndResetRequireAnalysisIteration() {
534526

535527
public static class ConcurrentAnalysisAccessImpl extends DuringAnalysisAccessImpl {
536528

537-
private static final String concurrentReachabilityOption = SubstrateOptionsParser.commandArgument(SubstrateOptions.RunReachabilityHandlersConcurrently, "-");
538-
539529
public ConcurrentAnalysisAccessImpl(FeatureHandler featureHandler, ImageClassLoader imageClassLoader, Inflation bb, NativeLibraries nativeLibraries, DebugContext debugContext) {
540530
super(featureHandler, imageClassLoader, bb, nativeLibraries, debugContext);
541531
}
542532

543533
@Override
544534
public void requireAnalysisIteration() {
545535
if (bb.executorIsStarted()) {
546-
String msg = "Calling DuringAnalysisAccessImpl.requireAnalysisIteration() is not necessary when running the reachability handlers concurrently during analysis. " +
547-
"To fallback to running the reachability handlers sequentially, i.e., from Feature.duringAnalysis(), you can add the " + concurrentReachabilityOption +
548-
" option to the native-image command. Note that the fallback option is deprecated and it will be removed in a future release.";
549-
throw VMError.shouldNotReachHere(msg);
536+
throw VMError.shouldNotReachHere("Calling DuringAnalysisAccessImpl.requireAnalysisIteration() is not necessary when running the reachability handlers concurrently during analysis.");
550537
}
551538
super.requireAnalysisIteration();
552539
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProtectionDomainFeature.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ void enableCodeSource(DuringAnalysisAccess a) {
7575
ProtectionDomainSupport.enableCodeSource();
7676
if (access != null) {
7777
access.rescanField(ImageSingletons.lookup(ProtectionDomainSupport.class), executableURLSupplierField);
78-
if (!access.concurrentReachabilityHandlers()) {
79-
access.requireAnalysisIteration();
80-
}
8178
}
8279
}
8380
}

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ReachabilityHandlerFeature.java

Lines changed: 0 additions & 210 deletions
This file was deleted.

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/xml/XMLParsersRegistration.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ public void registerConfigs(Feature.DuringAnalysisAccess a) {
4747
List<String> parserClasses = xmlParserClasses();
4848
registerReflectionClasses(access, parserClasses);
4949
registerResources();
50-
if (!access.concurrentReachabilityHandlers()) {
51-
access.requireAnalysisIteration();
52-
}
5350
}
5451

5552
abstract List<String> xmlParserClasses();

substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleFeature.java

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -449,16 +449,8 @@ public void beforeAnalysis(BeforeAnalysisAccess access) {
449449
config.registerSubtypeReachabilityHandler((acc, klass) -> {
450450
DuringAnalysisAccessImpl impl = (DuringAnalysisAccessImpl) acc;
451451
/* Pass known reachable classes to the initializer: it will decide there what to do. */
452-
Boolean modified = TruffleBaseFeature.invokeStaticMethod(
453-
"com.oracle.truffle.runtime.BytecodeOSRRootNode",
454-
"initializeClassUsingDeprecatedFrameTransfer",
455-
Collections.singleton(Class.class),
456-
klass);
457-
if (modified != null && modified) {
458-
if (!impl.concurrentReachabilityHandlers()) {
459-
impl.requireAnalysisIteration();
460-
}
461-
}
452+
TruffleBaseFeature.invokeStaticMethod("com.oracle.truffle.runtime.BytecodeOSRRootNode", "initializeClassUsingDeprecatedFrameTransfer",
453+
Collections.singleton(Class.class), klass);
462454
}, BytecodeOSRNode.class);
463455
}
464456

0 commit comments

Comments
 (0)