Skip to content

Commit

Permalink
Remove IntrinsifyMethodHandlesInvocationPlugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
teshull committed Mar 14, 2024
1 parent 6393391 commit 8fb4455
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1,021 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ public enum ReportingMode {
@Option(help = "Enable and disable normal processing of flags relating to experimental options.", type = OptionType.Expert, stability = OptionStability.EXPERIMENTAL) //
public static final HostedOptionKey<Boolean> UnlockExperimentalVMOptions = new HostedOptionKey<>(false);

@Option(help = "Force using legacy method handle intrinsics.", type = Expert, deprecated = true, deprecationMessage = "This option was introduced to simplify migration to GraalVM 23.1 and will be removed in a future release") //
@Option(help = "Deprecated, option no longer has any effect.", deprecated = true, deprecationMessage = "It no longer has any effect, and no replacement is available")//
public static final HostedOptionKey<Boolean> UseOldMethodHandleIntrinsics = new HostedOptionKey<>(false);

@Option(help = "Include all classes, methods, and fields from given modules", type = OptionType.Debug) //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ private void installRuntimeConfig(BeforeAnalysisAccessImpl config) {
FeatureHandler featureHandler = config.getFeatureHandler();
final boolean supportsStubBasedPlugins = !SubstrateOptions.useLLVMBackend();

NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, runtimeConfig, hostedProviders, config.getMetaAccess(), config.getUniverse(), null, config.getNativeLibraries(),
NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, runtimeConfig, hostedProviders, config.getMetaAccess(), config.getUniverse(), config.getNativeLibraries(),
config.getImageClassLoader(), ParsingReason.JITCompilation, ((Inflation) config.getBigBang()).getAnnotationSubstitutionProcessor(),
new SubstrateClassInitializationPlugin(config.getHostVM()), ConfigurationValues.getTarget(), supportsStubBasedPlugins);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@
import com.oracle.svm.hosted.phases.EarlyConstantFoldLoadFieldPlugin;
import com.oracle.svm.hosted.phases.ImageBuildStatisticsCounterPhase;
import com.oracle.svm.hosted.phases.InjectedAccessorsPlugin;
import com.oracle.svm.hosted.phases.IntrinsifyMethodHandlesInvocationPlugin;
import com.oracle.svm.hosted.phases.SubstrateClassInitializationPlugin;
import com.oracle.svm.hosted.phases.VerifyDeoptLIRFrameStatesPhase;
import com.oracle.svm.hosted.phases.VerifyNoGuardsPhase;
Expand Down Expand Up @@ -599,7 +598,6 @@ protected void doRun(Map<Method, CEntryPointData> entryPoints, JavaMainSupport j
bb.getSnippetReflectionProvider()).build();

registerGraphBuilderPlugins(featureHandler, runtimeConfiguration, (HostedProviders) runtimeConfiguration.getProviders(), bb.getMetaAccess(), aUniverse,
hUniverse,
nativeLibraries, loader, ParsingReason.AOTCompilation, bb.getAnnotationSubstitutionProcessor(),
new SubstrateClassInitializationPlugin((SVMHost) aUniverse.hostVM()),
ConfigurationValues.getTarget(), this.isStubBasedPluginsSupported());
Expand Down Expand Up @@ -1145,7 +1143,7 @@ public static void initializeBigBang(Inflation bb, OptionValues options, Feature
*/
bb.getMetaAccess().lookupJavaType(com.oracle.svm.core.graal.stackvalue.StackValueNode.StackSlotIdentity.class).registerAsReachable("root class");

NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, null, aProviders, aMetaAccess, aUniverse, null, nativeLibraries, loader, ParsingReason.PointsToAnalysis,
NativeImageGenerator.registerGraphBuilderPlugins(featureHandler, null, aProviders, aMetaAccess, aUniverse, nativeLibraries, loader, ParsingReason.PointsToAnalysis,
bb.getAnnotationSubstitutionProcessor(), classInitializationPlugin, ConfigurationValues.getTarget(), supportsStubBasedPlugins);
registerReplacements(debug, featureHandler, null, aProviders, true, initForeignCalls, new GraphEncoder(ConfigurationValues.getTarget().arch));

Expand Down Expand Up @@ -1353,7 +1351,7 @@ public void notifyNoPlugin(ResolvedJavaMethod targetMethod, OptionValues options
}

public static void registerGraphBuilderPlugins(FeatureHandler featureHandler, RuntimeConfiguration runtimeConfig, HostedProviders providers, AnalysisMetaAccess aMetaAccess,
AnalysisUniverse aUniverse, HostedUniverse hUniverse, NativeLibraries nativeLibs, ImageClassLoader loader, ParsingReason reason,
AnalysisUniverse aUniverse, NativeLibraries nativeLibs, ImageClassLoader loader, ParsingReason reason,
AnnotationSubstitutionProcessor annotationSubstitutionProcessor, ClassInitializationPlugin classInitializationPlugin,
TargetDescription target, boolean supportsStubBasedPlugins) {
GraphBuilderConfiguration.Plugins plugins = new GraphBuilderConfiguration.Plugins(new SubstitutionInvocationPlugins(annotationSubstitutionProcessor));
Expand All @@ -1367,12 +1365,8 @@ public static void registerGraphBuilderPlugins(FeatureHandler featureHandler, Ru
SubstrateReplacements replacements = (SubstrateReplacements) providers.getReplacements();
plugins.appendInlineInvokePlugin(replacements);

if (!SubstrateOptions.UseOldMethodHandleIntrinsics.getValue()) {
if (reason.duringAnalysis()) {
plugins.appendNodePlugin(new MethodHandleWithExceptionPlugin(providers.getConstantReflection().getMethodHandleAccess(), false));
}
} else {
plugins.appendNodePlugin(new IntrinsifyMethodHandlesInvocationPlugin(hostedSnippetReflection, providers, aUniverse, hUniverse));
if (reason.duringAnalysis()) {
plugins.appendNodePlugin(new MethodHandleWithExceptionPlugin(providers.getConstantReflection().getMethodHandleAccess(), false));
}
plugins.appendNodePlugin(new DeletedFieldsPlugin());
plugins.appendNodePlugin(new InjectedAccessorsPlugin());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import com.oracle.graal.pointsto.heap.ImageHeapScanner;
import com.oracle.graal.pointsto.meta.AnalysisMetaAccess;
import com.oracle.graal.pointsto.meta.AnalysisType;
import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.fieldvaluetransformer.FieldValueTransformerWithAvailability;
Expand Down Expand Up @@ -146,15 +145,9 @@ public void duringSetup(DuringSetupAccess access) {
referencedKeySetAdd = ReflectionUtil.lookupMethod(concurrentWeakInternSetClass, "add", Object.class);
}

if (!SubstrateOptions.UseOldMethodHandleIntrinsics.getValue()) {
/*
* Renaming is not crucial with old method handle intrinsics, so if those are requested
* explicitly, disable renaming to offer a fallback in case it causes problems.
*/
var accessImpl = (DuringSetupAccessImpl) access;
substitutionProcessor = new MethodHandleInvokerRenamingSubstitutionProcessor(accessImpl.getBigBang());
accessImpl.registerSubstitutionProcessor(substitutionProcessor);
}
var accessImpl = (DuringSetupAccessImpl) access;
substitutionProcessor = new MethodHandleInvokerRenamingSubstitutionProcessor(accessImpl.getBigBang());
accessImpl.registerSubstitutionProcessor(substitutionProcessor);
}

@Override
Expand Down
Loading

0 comments on commit 8fb4455

Please sign in to comment.