Search in sources :

Example 1 with InliningPhase

use of org.graalvm.compiler.phases.common.inlining.InliningPhase 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 2 with InliningPhase

use of org.graalvm.compiler.phases.common.inlining.InliningPhase in project graal by oracle.

the class TrufflePEATest method processMethod.

protected StructuredGraph processMethod(final String snippet) {
    StructuredGraph graph = parseEager(snippet, StructuredGraph.AllowAssumptions.NO);
    HighTierContext context = getDefaultHighTierContext();
    new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
    new PartialEscapePhase(true, true, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
    return graph;
}
Also used : PartialEscapePhase(org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) InliningPhase(org.graalvm.compiler.phases.common.inlining.InliningPhase)

Example 3 with InliningPhase

use of org.graalvm.compiler.phases.common.inlining.InliningPhase in project graal by oracle.

the class InliningTest method getGraph.

@SuppressWarnings("try")
private StructuredGraph getGraph(final String snippet, final boolean eagerInfopointMode) {
    DebugContext debug = getDebugContext();
    try (DebugContext.Scope s = debug.scope("InliningTest", new DebugDumpScope(snippet, true))) {
        ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
        Builder builder = builder(method, AllowAssumptions.YES, debug);
        StructuredGraph graph = eagerInfopointMode ? parse(builder, getDebugGraphBuilderSuite()) : parse(builder, getEagerGraphBuilderSuite());
        try (DebugContext.Scope s2 = debug.scope("Inlining", graph)) {
            PhaseSuite<HighTierContext> graphBuilderSuite = eagerInfopointMode ? getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withFullInfopoints(true)) : getDefaultGraphBuilderSuite();
            HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
            debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
            new CanonicalizerPhase().apply(graph, context);
            new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
            debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
            new CanonicalizerPhase().apply(graph, context);
            new DeadCodeEliminationPhase().apply(graph);
            return graph;
        }
    } catch (Throwable e) {
        throw debug.handle(e);
    }
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) DebugDumpScope(org.graalvm.compiler.debug.DebugDumpScope) Builder(org.graalvm.compiler.nodes.StructuredGraph.Builder) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) DebugContext(org.graalvm.compiler.debug.DebugContext) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) InliningPhase(org.graalvm.compiler.phases.common.inlining.InliningPhase) DeadCodeEliminationPhase(org.graalvm.compiler.phases.common.DeadCodeEliminationPhase) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Example 4 with InliningPhase

use of org.graalvm.compiler.phases.common.inlining.InliningPhase in project graal by oracle.

the class EarlyReadEliminationTest method processMethod.

protected StructuredGraph processMethod(String snippet, boolean doLowering) {
    StructuredGraph graph = parseEager(getResolvedJavaMethod(snippet), AllowAssumptions.NO);
    HighTierContext context = getDefaultHighTierContext();
    new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
    if (doLowering) {
        new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
    }
    new EarlyReadEliminationPhase(new CanonicalizerPhase()).apply(graph, context);
    return graph;
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) LoweringPhase(org.graalvm.compiler.phases.common.LoweringPhase) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) InliningPhase(org.graalvm.compiler.phases.common.inlining.InliningPhase) EarlyReadEliminationPhase(org.graalvm.compiler.virtual.phases.ea.EarlyReadEliminationPhase)

Example 5 with InliningPhase

use of org.graalvm.compiler.phases.common.inlining.InliningPhase in project graal by oracle.

the class LockEliminationTest method getGraph.

private StructuredGraph getGraph(String snippet) {
    ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
    StructuredGraph graph = parseEager(method, AllowAssumptions.YES);
    HighTierContext context = getDefaultHighTierContext();
    new CanonicalizerPhase().apply(graph, context);
    new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
    new CanonicalizerPhase().apply(graph, context);
    new DeadCodeEliminationPhase().apply(graph);
    new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
    new LockEliminationPhase().apply(graph);
    return graph;
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) LoweringPhase(org.graalvm.compiler.phases.common.LoweringPhase) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext) LockEliminationPhase(org.graalvm.compiler.phases.common.LockEliminationPhase) InliningPhase(org.graalvm.compiler.phases.common.inlining.InliningPhase) DeadCodeEliminationPhase(org.graalvm.compiler.phases.common.DeadCodeEliminationPhase) ResolvedJavaMethod(jdk.vm.ci.meta.ResolvedJavaMethod)

Aggregations

CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)27 InliningPhase (org.graalvm.compiler.phases.common.inlining.InliningPhase)27 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)26 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)24 DebugContext (org.graalvm.compiler.debug.DebugContext)9 DeadCodeEliminationPhase (org.graalvm.compiler.phases.common.DeadCodeEliminationPhase)9 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)8 LoweringPhase (org.graalvm.compiler.phases.common.LoweringPhase)7 PartialEscapePhase (org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase)7 DebugDumpScope (org.graalvm.compiler.debug.DebugDumpScope)5 Test (org.junit.Test)5 MidTierContext (org.graalvm.compiler.phases.tiers.MidTierContext)4 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)4 HashMap (java.util.HashMap)3 Node (org.graalvm.compiler.graph.Node)3 WriteBarrierAdditionPhase (org.graalvm.compiler.hotspot.phases.WriteBarrierAdditionPhase)3 Invoke (org.graalvm.compiler.nodes.Invoke)3 GuardLoweringPhase (org.graalvm.compiler.phases.common.GuardLoweringPhase)3 G1PostWriteBarrier (org.graalvm.compiler.hotspot.nodes.G1PostWriteBarrier)2 G1PreWriteBarrier (org.graalvm.compiler.hotspot.nodes.G1PreWriteBarrier)2