Search in sources :

Example 1 with EliminateRedundantInitializationPhase

use of org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase 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 EliminateRedundantInitializationPhase

use of org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase in project graal by oracle.

the class ReplaceConstantNodesPhaseTest method test.

private void test(String name, int expectedInits, int expectedResolves, int expectedLoads) {
    StructuredGraph graph = parseEager(name, AllowAssumptions.NO, new OptionValues(getInitialOptions(), GraalOptions.GeneratePIC, true));
    HighTierContext highTierContext = getDefaultHighTierContext();
    CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
    new EliminateRedundantInitializationPhase().apply(graph, highTierContext);
    new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, highTierContext);
    new LoadJavaMirrorWithKlassPhase(config).apply(graph, highTierContext);
    new ReplaceConstantNodesPhase(false).apply(graph, highTierContext);
    Assert.assertEquals(expectedInits, graph.getNodes().filter(InitializeKlassNode.class).count());
    Assert.assertEquals(expectedResolves, graph.getNodes().filter(ResolveConstantNode.class).count());
    Assert.assertEquals(expectedLoads, graph.getNodes().filter(LoadConstantIndirectlyNode.class).count());
}
Also used : ReplaceConstantNodesPhase(org.graalvm.compiler.hotspot.phases.aot.ReplaceConstantNodesPhase) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) OptionValues(org.graalvm.compiler.options.OptionValues) EliminateRedundantInitializationPhase(org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase) LoadJavaMirrorWithKlassPhase(org.graalvm.compiler.hotspot.phases.LoadJavaMirrorWithKlassPhase) LoweringPhase(org.graalvm.compiler.phases.common.LoweringPhase) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext)

Example 3 with EliminateRedundantInitializationPhase

use of org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase in project graal by oracle.

the class EliminateRedundantInitializationPhaseTest method test.

private void test(String name, int initNodesAfterParse, int initNodesAfterOpt) {
    StructuredGraph graph = parseEager(name, AllowAssumptions.NO);
    Assert.assertEquals(initNodesAfterParse, graph.getNodes().filter(InitializeKlassNode.class).count());
    HighTierContext highTierContext = getDefaultHighTierContext();
    new EliminateRedundantInitializationPhase().apply(graph, highTierContext);
    Assert.assertEquals(initNodesAfterOpt, graph.getNodes().filter(InitializeKlassNode.class).count());
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) EliminateRedundantInitializationPhase(org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase) HighTierContext(org.graalvm.compiler.phases.tiers.HighTierContext)

Aggregations

EliminateRedundantInitializationPhase (org.graalvm.compiler.hotspot.phases.aot.EliminateRedundantInitializationPhase)3 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)3 LoadJavaMirrorWithKlassPhase (org.graalvm.compiler.hotspot.phases.LoadJavaMirrorWithKlassPhase)2 ReplaceConstantNodesPhase (org.graalvm.compiler.hotspot.phases.aot.ReplaceConstantNodesPhase)2 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)2 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)2 AheadOfTimeVerificationPhase (org.graalvm.compiler.hotspot.phases.AheadOfTimeVerificationPhase)1 WriteBarrierAdditionPhase (org.graalvm.compiler.hotspot.phases.WriteBarrierAdditionPhase)1 WriteBarrierVerificationPhase (org.graalvm.compiler.hotspot.phases.WriteBarrierVerificationPhase)1 AOTInliningPolicy (org.graalvm.compiler.hotspot.phases.aot.AOTInliningPolicy)1 FinalizeProfileNodesPhase (org.graalvm.compiler.hotspot.phases.profiling.FinalizeProfileNodesPhase)1 LIRSuites (org.graalvm.compiler.lir.phases.LIRSuites)1 OptionValues (org.graalvm.compiler.options.OptionValues)1 BasePhase (org.graalvm.compiler.phases.BasePhase)1 LoweringPhase (org.graalvm.compiler.phases.common.LoweringPhase)1 InliningPhase (org.graalvm.compiler.phases.common.inlining.InliningPhase)1 MidTierContext (org.graalvm.compiler.phases.tiers.MidTierContext)1 Suites (org.graalvm.compiler.phases.tiers.Suites)1