use of org.graalvm.compiler.hotspot.phases.aot.ReplaceConstantNodesPhase 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;
}
use of org.graalvm.compiler.hotspot.phases.aot.ReplaceConstantNodesPhase 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());
}
Aggregations