From c2d14012e3ff4c31b081c4640928a5ae79d9af13 Mon Sep 17 00:00:00 2001 From: Christian Wimmer Date: Wed, 4 Oct 2023 14:13:49 -0700 Subject: [PATCH] Always use ParseOnce and InlineBeforeAnalysis --- substratevm/CHANGELOG.md | 1 + .../pointsto/phases/InlineBeforeAnalysis.java | 14 +++++----- .../com/oracle/svm/core/SubstrateOptions.java | 28 +++++++++---------- .../LegacyRuntimeCompilationFeature.java | 3 +- .../ParseOnceRuntimeCompilationFeature.java | 4 --- .../hosted/RuntimeCompilationFeature.java | 6 +--- .../svm/hosted/NativeImageGenerator.java | 3 -- 7 files changed, 23 insertions(+), 36 deletions(-) diff --git a/substratevm/CHANGELOG.md b/substratevm/CHANGELOG.md index 5e9f3998451c..787b5f3a1c91 100644 --- a/substratevm/CHANGELOG.md +++ b/substratevm/CHANGELOG.md @@ -8,6 +8,7 @@ This changelog summarizes major changes to GraalVM Native Image. * (GR-48612) Enable `--strict-image-heap` by default. The option is now deprecated and can be removed from your argument list. A blog post with more information will follow shortly. * (GR-48354) Remove native-image-agent legacy `build`-option * (GR-49221) Support for thread dumps can now be enabled with `--enable-monitoring=threaddump`. The option `-H:±DumpThreadStacksOnSignal` is deprecated and marked for removal. +* (GR-48579) Options ParseOnce, ParseOnceJIT, and InlineBeforeAnalysis are deprecated and no longer have any effect. ## GraalVM for JDK 21 (Internal Version 23.1.0) * (GR-35746) Lower the default aligned chunk size from 1 MB to 512 KB for the serial and epsilon GCs, reducing memory usage and image size in many cases. diff --git a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/phases/InlineBeforeAnalysis.java b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/phases/InlineBeforeAnalysis.java index ac16fbd9f104..a38f15a5562c 100644 --- a/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/phases/InlineBeforeAnalysis.java +++ b/substratevm/src/com.oracle.graal.pointsto/src/com/oracle/graal/pointsto/phases/InlineBeforeAnalysis.java @@ -24,6 +24,11 @@ */ package com.oracle.graal.pointsto.phases; +import com.oracle.graal.pointsto.BigBang; +import com.oracle.graal.pointsto.flow.AnalysisParsedGraph; +import com.oracle.graal.pointsto.meta.AnalysisMethod; +import com.oracle.svm.util.ClassUtil; + import jdk.compiler.graal.debug.DebugContext; import jdk.compiler.graal.nodes.GraphDecoder; import jdk.compiler.graal.nodes.StructuredGraph; @@ -31,11 +36,6 @@ import jdk.compiler.graal.options.OptionKey; import jdk.compiler.graal.printer.GraalDebugHandlersFactory; -import com.oracle.graal.pointsto.BigBang; -import com.oracle.graal.pointsto.flow.AnalysisParsedGraph; -import com.oracle.graal.pointsto.meta.AnalysisMethod; -import com.oracle.svm.util.ClassUtil; - /** * Inlining before the static analysis improves the precision of the analysis especially when * constants are propagated. So the goal is to inline callees that are folded to constants. @@ -54,7 +54,7 @@ public class InlineBeforeAnalysis { public static class Options { - @Option(help = "Inline methods before static analysis")// + @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 OptionKey InlineBeforeAnalysis = new OptionKey<>(true); } @@ -71,7 +71,7 @@ public static StructuredGraph decodeGraph(BigBang bb, AnalysisMethod method, Ana try (DebugContext.Scope s = debug.scope("InlineBeforeAnalysis", result)) { - if (bb.strengthenGraalGraphs() && Options.InlineBeforeAnalysis.getValue(bb.getOptions())) { + if (bb.strengthenGraalGraphs()) { InlineBeforeAnalysisGraphDecoder decoder = bb.getHostVM().createInlineBeforeAnalysisGraphDecoder(bb, method, result); decoder.decode(method); } else { 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 bec6202dd629..f60ca0c817fe 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 @@ -40,13 +40,6 @@ import org.graalvm.collections.EconomicMap; import org.graalvm.collections.UnmodifiableEconomicMap; -import jdk.compiler.graal.api.replacements.Fold; -import jdk.compiler.graal.core.common.GraalOptions; -import jdk.compiler.graal.options.Option; -import jdk.compiler.graal.options.OptionKey; -import jdk.compiler.graal.options.OptionStability; -import jdk.compiler.graal.options.OptionType; -import jdk.compiler.graal.options.OptionValues; import org.graalvm.nativeimage.ImageInfo; import org.graalvm.nativeimage.ImageSingletons; import org.graalvm.nativeimage.Platform; @@ -54,7 +47,6 @@ import com.oracle.svm.core.c.libc.LibCBase; import com.oracle.svm.core.c.libc.MuslLibC; -import com.oracle.svm.core.deopt.DeoptimizationSupport; import com.oracle.svm.core.heap.ReferenceHandler; import com.oracle.svm.core.option.APIOption; import com.oracle.svm.core.option.APIOptionGroup; @@ -70,15 +62,21 @@ import com.oracle.svm.util.ModuleSupport; import com.oracle.svm.util.ReflectionUtil; +import jdk.compiler.graal.api.replacements.Fold; +import jdk.compiler.graal.core.common.GraalOptions; +import jdk.compiler.graal.options.Option; +import jdk.compiler.graal.options.OptionKey; +import jdk.compiler.graal.options.OptionStability; +import jdk.compiler.graal.options.OptionType; +import jdk.compiler.graal.options.OptionValues; import jdk.internal.misc.Unsafe; public class SubstrateOptions { - @Option(help = "When true, compiler graphs are parsed only once before static analysis. When false, compiler graphs are parsed for static analysis and again for AOT compilation.")// + @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 ParseOnce = new HostedOptionKey<>(true); - @Option(help = "When true, each compiler graph version (DeoptTarget, AOT, JIT) needed for runtime compilation will be separately analyzed during static analysis." + - "When false, only one version of the compiler graph (AOT) will be used in static analysis, and then three new versions will be parsed for compilation.")// - public static final HostedOptionKey ParseOnceJIT = new HostedOptionKey<>(true); + @Option(help = "Deprecated, option no longer has any effect.", deprecated = true, deprecationMessage = "It no longer has any effect, and no replacement is available")// + static final HostedOptionKey ParseOnceJIT = new HostedOptionKey<>(true); @Option(help = "Preserve the local variable information for every Java source line to allow line-by-line stepping in the debugger. Allow the lookup of Java-level method information, e.g., in stack traces.")// public static final HostedOptionKey SourceLevelDebug = new HostedOptionKey<>(false); @Option(help = "Constrain debug info generation to the comma-separated list of package prefixes given to this option.")// @@ -89,10 +87,10 @@ public class SubstrateOptions { public static boolean parseOnce() { /* - * Parsing all graphs before static analysis is work-in-progress and for JIT compilation is - * only enabled when ParseOnceJIT is set. + * GR-48579: Old code only reachable when this method would return false will be deleted + * later. */ - return ParseOnce.getValue() && (ParseOnceJIT.getValue() || !DeoptimizationSupport.enabled()); + return true; } @Option(help = "Module containing the class that contains the main entry point. Optional if --shared is used.", type = OptionType.User)// diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/LegacyRuntimeCompilationFeature.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/LegacyRuntimeCompilationFeature.java index 72574ffd7752..64ec144820da 100644 --- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/LegacyRuntimeCompilationFeature.java +++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/LegacyRuntimeCompilationFeature.java @@ -74,7 +74,6 @@ import com.oracle.graal.pointsto.meta.AnalysisMetaAccess; import com.oracle.graal.pointsto.meta.AnalysisMethod; import com.oracle.graal.pointsto.meta.PointsToAnalysisMethod; -import com.oracle.svm.core.SubstrateOptions; import com.oracle.svm.core.config.ConfigurationValues; import com.oracle.svm.core.util.VMError; import com.oracle.svm.graal.GraalSupport; @@ -195,7 +194,7 @@ public List> getRequiredFeatures() { @Override public void afterRegistration(AfterRegistrationAccess access) { - VMError.guarantee(!SubstrateOptions.ParseOnceJIT.getValue(), "This feature is only supported when ParseOnceJIT is not set"); + VMError.shouldNotReachHere("GR-48579: dead code that will be deleted later"); ImageSingletons.add(RuntimeCompilationFeature.class, this); } diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/ParseOnceRuntimeCompilationFeature.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/ParseOnceRuntimeCompilationFeature.java index 46667863224a..94b4696c6fce 100644 --- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/ParseOnceRuntimeCompilationFeature.java +++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/ParseOnceRuntimeCompilationFeature.java @@ -146,10 +146,6 @@ import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.ResolvedJavaType; -/** - * Runtime compilation strategy used when {@link com.oracle.svm.core.SubstrateOptions#ParseOnceJIT} - * is enabled. - */ public class ParseOnceRuntimeCompilationFeature extends RuntimeCompilationFeature implements Feature, RuntimeCompilationSupport { public static class Options { diff --git a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/RuntimeCompilationFeature.java b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/RuntimeCompilationFeature.java index e52b07270260..94e99a4cac82 100644 --- a/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/RuntimeCompilationFeature.java +++ b/substratevm/src/com.oracle.svm.graal/src/com/oracle/svm/graal/hosted/RuntimeCompilationFeature.java @@ -179,11 +179,7 @@ public static RuntimeCompilationFeature singleton() { } public static Class getRuntimeCompilationFeature() { - if (SubstrateOptions.ParseOnceJIT.getValue()) { - return ParseOnceRuntimeCompilationFeature.class; - } else { - return LegacyRuntimeCompilationFeature.class; - } + return ParseOnceRuntimeCompilationFeature.class; } public interface RuntimeCompilationCandidatePredicate { diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java index a0b88fe4872c..6d7b1698e24c 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/NativeImageGenerator.java @@ -158,7 +158,6 @@ import com.oracle.graal.pointsto.meta.AnalysisUniverse; import com.oracle.graal.pointsto.meta.HostedProviders; import com.oracle.graal.pointsto.meta.PointsToAnalysisFactory; -import com.oracle.graal.pointsto.phases.InlineBeforeAnalysis; import com.oracle.graal.pointsto.reports.AnalysisReporter; import com.oracle.graal.pointsto.reports.ReportUtils; import com.oracle.graal.pointsto.typestate.DefaultAnalysisPolicy; @@ -1377,8 +1376,6 @@ public static void registerGraphBuilderPlugins(FeatureHandler featureHandler, Ru plugins.appendInlineInvokePlugin(replacements); boolean useInlineBeforeAnalysisMethodHandleSupport = !SubstrateOptions.UseOldMethodHandleIntrinsics.getValue() && - SubstrateOptions.parseOnce() && - InlineBeforeAnalysis.Options.InlineBeforeAnalysis.getValue(aUniverse.getBigbang().getOptions()) && !DeoptimizationSupport.enabled(); if (useInlineBeforeAnalysisMethodHandleSupport) { if (reason.duringAnalysis()) {