Search in sources :

Example 1 with Suites

use of org.graalvm.compiler.phases.tiers.Suites in project graal by oracle.

the class AArch64HotSpotSuitesProvider method createSuites.

@Override
public Suites createSuites(OptionValues options) {
    Suites suites = super.createSuites(options);
    ListIterator<BasePhase<? super LowTierContext>> findPhase = suites.getLowTier().findPhase(FixReadsPhase.class);
    if (findPhase == null) {
        findPhase = suites.getLowTier().findPhase(ExpandLogicPhase.class);
    }
    findPhase.add(new AddressLoweringByUsePhase(addressLoweringByUse));
    // Put AArch64ReadReplacementPhase right before the SchedulePhase
    findPhase = suites.getLowTier().findPhase(SchedulePhase.class);
    while (PhaseSuite.findNextPhase(findPhase, SchedulePhase.class)) {
    // Search for last occurrence of SchedulePhase
    }
    findPhase.previous();
    findPhase.add(new AArch64ReadReplacementPhase());
    return suites;
}
Also used : LowTierContext(org.graalvm.compiler.phases.tiers.LowTierContext) SchedulePhase(org.graalvm.compiler.phases.schedule.SchedulePhase) AArch64ReadReplacementPhase(org.graalvm.compiler.replacements.aarch64.AArch64ReadReplacementPhase) ExpandLogicPhase(org.graalvm.compiler.phases.common.ExpandLogicPhase) AddressLoweringByUsePhase(org.graalvm.compiler.phases.common.AddressLoweringByUsePhase) BasePhase(org.graalvm.compiler.phases.BasePhase) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 2 with Suites

use of org.graalvm.compiler.phases.tiers.Suites in project graal by oracle.

the class HotSpotGraalCompiler method compileHelper.

public CompilationResult compileHelper(CompilationResultBuilderFactory crbf, CompilationResult result, StructuredGraph graph, ResolvedJavaMethod method, int entryBCI, boolean useProfilingInfo, OptionValues options) {
    HotSpotBackend backend = graalRuntime.getHostBackend();
    HotSpotProviders providers = backend.getProviders();
    final boolean isOSR = entryBCI != JVMCICompiler.INVOCATION_ENTRY_BCI;
    Suites suites = getSuites(providers, options);
    LIRSuites lirSuites = getLIRSuites(providers, options);
    ProfilingInfo profilingInfo = useProfilingInfo ? method.getProfilingInfo(!isOSR, isOSR) : DefaultProfilingInfo.get(TriState.FALSE);
    OptimisticOptimizations optimisticOpts = getOptimisticOpts(profilingInfo, options);
    /*
         * Cut off never executed code profiles if there is code, e.g. after the osr loop, that is
         * never executed.
         */
    if (isOSR && !OnStackReplacementPhase.Options.DeoptAfterOSR.getValue(options)) {
        optimisticOpts.remove(Optimization.RemoveNeverExecutedCode);
    }
    result.setEntryBCI(entryBCI);
    boolean shouldDebugNonSafepoints = providers.getCodeCache().shouldDebugNonSafepoints();
    PhaseSuite<HighTierContext> graphBuilderSuite = configGraphBuilderSuite(providers.getSuites().getDefaultGraphBuilderSuite(), shouldDebugNonSafepoints, isOSR);
    GraalCompiler.compileGraph(graph, method, providers, backend, graphBuilderSuite, optimisticOpts, profilingInfo, suites, lirSuites, result, crbf);
    if (!isOSR && useProfilingInfo) {
        ProfilingInfo profile = profilingInfo;
        profile.setCompilerIRSize(StructuredGraph.class, graph.getNodeCount());
    }
    return result;
}
Also used : HotSpotProviders(org.graalvm.compiler.hotspot.meta.HotSpotProviders) DefaultProfilingInfo(jdk.vm.ci.meta.DefaultProfilingInfo) ProfilingInfo(jdk.vm.ci.meta.ProfilingInfo) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) OptimisticOptimizations(org.graalvm.compiler.phases.OptimisticOptimizations) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 3 with Suites

use of org.graalvm.compiler.phases.tiers.Suites in project graal by oracle.

the class HotSpotSuitesProvider method createSuites.

@Override
public Suites createSuites(OptionValues options) {
    Suites ret = defaultSuitesCreator.createSuites(options);
    if (ImmutableCode.getValue(options)) {
        // lowering introduces class constants, therefore it must be after lowering
        ret.getHighTier().appendPhase(new LoadJavaMirrorWithKlassPhase(config));
        if (VerifyPhases.getValue(options)) {
            ret.getHighTier().appendPhase(new AheadOfTimeVerificationPhase());
        }
        if (GeneratePIC.getValue(options)) {
            ListIterator<BasePhase<? super HighTierContext>> highTierLowering = ret.getHighTier().findPhase(LoweringPhase.class);
            highTierLowering.previous();
            highTierLowering.add(new EliminateRedundantInitializationPhase());
            if (HotSpotAOTProfilingPlugin.Options.TieredAOT.getValue(options)) {
                highTierLowering.add(new FinalizeProfileNodesPhase(HotSpotAOTProfilingPlugin.Options.TierAInvokeInlineeNotifyFreqLog.getValue(options)));
            }
            ListIterator<BasePhase<? super MidTierContext>> midTierLowering = ret.getMidTier().findPhase(LoweringPhase.class);
            midTierLowering.add(new ReplaceConstantNodesPhase());
            // Replace inlining policy
            if (Inline.getValue(options)) {
                ListIterator<BasePhase<? super HighTierContext>> iter = ret.getHighTier().findPhase(InliningPhase.class);
                InliningPhase inlining = (InliningPhase) iter.previous();
                CanonicalizerPhase canonicalizer = inlining.getCanonicalizer();
                iter.set(new InliningPhase(new AOTInliningPolicy(null), canonicalizer));
            }
        }
    }
    ret.getMidTier().appendPhase(new WriteBarrierAdditionPhase(config));
    if (VerifyPhases.getValue(options)) {
        ret.getMidTier().appendPhase(new WriteBarrierVerificationPhase(config));
    }
    return ret;
}
Also used : EliminateRedundantInitializationPhase(org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase) WriteBarrierVerificationPhase(org.graalvm.compiler.hotspot.phases.WriteBarrierVerificationPhase) WriteBarrierAdditionPhase(org.graalvm.compiler.hotspot.phases.WriteBarrierAdditionPhase) FinalizeProfileNodesPhase(org.graalvm.compiler.hotspot.phases.profiling.FinalizeProfileNodesPhase) AOTInliningPolicy(org.graalvm.compiler.hotspot.phases.aot.AOTInliningPolicy) ReplaceConstantNodesPhase(org.graalvm.compiler.hotspot.phases.aot.ReplaceConstantNodesPhase) AheadOfTimeVerificationPhase(org.graalvm.compiler.hotspot.phases.AheadOfTimeVerificationPhase) MidTierContext(org.graalvm.compiler.phases.tiers.MidTierContext) LoadJavaMirrorWithKlassPhase(org.graalvm.compiler.hotspot.phases.LoadJavaMirrorWithKlassPhase) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) InliningPhase(org.graalvm.compiler.phases.common.inlining.InliningPhase) BasePhase(org.graalvm.compiler.phases.BasePhase) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites)

Example 4 with Suites

use of org.graalvm.compiler.phases.tiers.Suites in project graal by oracle.

the class HotSpotTruffleCompilerImpl method compileTruffleCallBoundaryMethod.

/**
 * Compiles a method denoted as a
 * {@linkplain HotSpotTruffleCompilerRuntime#getTruffleCallBoundaryMethods() Truffle call
 * boundary}. The compiled code has a special entry point generated by an
 * {@link TruffleCallBoundaryInstrumentationFactory}.
 */
private CompilationResult compileTruffleCallBoundaryMethod(ResolvedJavaMethod javaMethod, CompilationIdentifier compilationId, DebugContext debug) {
    Suites newSuites = this.suites.copy();
    removeInliningPhase(newSuites);
    OptionValues options = TruffleCompilerOptions.getOptions();
    StructuredGraph graph = new StructuredGraph.Builder(options, debug, AllowAssumptions.NO).method(javaMethod).compilationId(compilationId).build();
    MetaAccessProvider metaAccess = providers.getMetaAccess();
    Plugins plugins = new Plugins(new InvocationPlugins());
    HotSpotCodeCacheProvider codeCache = (HotSpotCodeCacheProvider) providers.getCodeCache();
    boolean infoPoints = codeCache.shouldDebugNonSafepoints();
    GraphBuilderConfiguration newConfig = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true).withNodeSourcePosition(infoPoints);
    new GraphBuilderPhase.Instance(metaAccess, providers.getStampProvider(), providers.getConstantReflection(), providers.getConstantFieldProvider(), newConfig, OptimisticOptimizations.ALL, null).apply(graph);
    PhaseSuite<HighTierContext> graphBuilderSuite = getGraphBuilderSuite(codeCache, backend.getSuites());
    CompilationResultBuilderFactory factory = getTruffleCallBoundaryInstrumentationFactory(backend.getTarget().arch.getName());
    return compileGraph(graph, javaMethod, providers, backend, graphBuilderSuite, OptimisticOptimizations.ALL, graph.getProfilingInfo(), newSuites, lirSuites, new CompilationResult(compilationId), factory);
}
Also used : InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) HotSpotCodeCacheProvider(jdk.vm.ci.hotspot.HotSpotCodeCacheProvider) OptionValues(org.graalvm.compiler.options.OptionValues) GraphBuilderConfiguration(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) CompilationResult(org.graalvm.compiler.code.CompilationResult) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) CompilationResultBuilderFactory(org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory) MetaAccessProvider(jdk.vm.ci.meta.MetaAccessProvider) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Example 5 with Suites

use of org.graalvm.compiler.phases.tiers.Suites in project graal by oracle.

the class HotSpotTruffleCompilerImpl method create.

public static HotSpotTruffleCompilerImpl create(TruffleCompilerRuntime runtime) {
    HotSpotGraalRuntimeProvider hotspotGraalRuntime = (HotSpotGraalRuntimeProvider) runtime.getGraalRuntime();
    Backend backend = hotspotGraalRuntime.getHostBackend();
    OptionValues options = TruffleCompilerOptions.getOptions();
    Suites suites = backend.getSuites().getDefaultSuites(options);
    LIRSuites lirSuites = backend.getSuites().getDefaultLIRSuites(options);
    GraphBuilderPhase phase = (GraphBuilderPhase) backend.getSuites().getDefaultGraphBuilderSuite().findPhase(GraphBuilderPhase.class).previous();
    Plugins plugins = phase.getGraphBuilderConfig().getPlugins();
    SnippetReflectionProvider snippetReflection = hotspotGraalRuntime.getRequiredCapability(SnippetReflectionProvider.class);
    return new HotSpotTruffleCompilerImpl(hotspotGraalRuntime, runtime, plugins, suites, lirSuites, backend, snippetReflection);
}
Also used : Backend(org.graalvm.compiler.core.target.Backend) SnippetReflectionProvider(org.graalvm.compiler.api.replacements.SnippetReflectionProvider) OptionValues(org.graalvm.compiler.options.OptionValues) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) HotSpotGraalRuntimeProvider(org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider) GraphBuilderPhase(org.graalvm.compiler.java.GraphBuilderPhase) LIRSuites(org.graalvm.compiler.lir.phases.LIRSuites) Suites(org.graalvm.compiler.phases.tiers.Suites) InvocationPlugins(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins) Plugins(org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)

Aggregations

Suites (org.graalvm.compiler.phases.tiers.Suites)16 LIRSuites (org.graalvm.compiler.lir.phases.LIRSuites)10 BasePhase (org.graalvm.compiler.phases.BasePhase)8 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)7 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)6 CompilationResult (org.graalvm.compiler.code.CompilationResult)4 DebugContext (org.graalvm.compiler.debug.DebugContext)4 OptionValues (org.graalvm.compiler.options.OptionValues)4 LowTierContext (org.graalvm.compiler.phases.tiers.LowTierContext)4 Backend (org.graalvm.compiler.core.target.Backend)3 GraphBuilderPhase (org.graalvm.compiler.java.GraphBuilderPhase)3 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)3 MidTierContext (org.graalvm.compiler.phases.tiers.MidTierContext)3 HostedProviders (com.oracle.graal.pointsto.meta.HostedProviders)2 ProfilingInfo (jdk.vm.ci.meta.ProfilingInfo)2 CompilationIdentifier (org.graalvm.compiler.core.common.CompilationIdentifier)2 CompilationResultBuilderFactory (org.graalvm.compiler.lir.asm.CompilationResultBuilderFactory)2 Plugins (org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration.Plugins)2 InvocationPlugins (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugins)2 OptimisticOptimizations (org.graalvm.compiler.phases.OptimisticOptimizations)2