Search in sources :

Example 31 with LoweringPhase

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

the class PoorMansEATest method test.

@SuppressWarnings("try")
private void test(final String snippet) {
    DebugContext debug = getDebugContext();
    try (DebugContext.Scope s = debug.scope("PoorMansEATest", new DebugDumpScope(snippet))) {
        StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
        HighTierContext highTierContext = getDefaultHighTierContext();
        new InliningPhase(new CanonicalizerPhase()).apply(graph, highTierContext);
        PhaseContext context = new PhaseContext(getProviders());
        new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
        // remove framestates in order to trigger the simplification.
        cleanup: for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) {
            for (Node input : fs.inputs()) {
                if (input instanceof NewInstanceNode) {
                    fs.replaceAtUsages(null);
                    fs.safeDelete();
                    continue cleanup;
                }
            }
        }
        new CanonicalizerPhase().apply(graph, context);
    } catch (Throwable e) {
        throw debug.handle(e);
    }
}
Also used : NewInstanceNode(org.graalvm.compiler.nodes.java.NewInstanceNode) DebugDumpScope(org.graalvm.compiler.debug.DebugDumpScope) Node(org.graalvm.compiler.graph.Node) NewInstanceNode(org.graalvm.compiler.nodes.java.NewInstanceNode) AbstractNewObjectNode(org.graalvm.compiler.nodes.java.AbstractNewObjectNode) LoweringPhase(org.graalvm.compiler.phases.common.LoweringPhase) DebugContext(org.graalvm.compiler.debug.DebugContext) FrameState(org.graalvm.compiler.nodes.FrameState) PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) 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)

Aggregations

LoweringPhase (org.graalvm.compiler.phases.common.LoweringPhase)31 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)30 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)27 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)19 DebugContext (org.graalvm.compiler.debug.DebugContext)13 FloatingReadPhase (org.graalvm.compiler.phases.common.FloatingReadPhase)12 HighTierContext (org.graalvm.compiler.phases.tiers.HighTierContext)12 GuardLoweringPhase (org.graalvm.compiler.phases.common.GuardLoweringPhase)10 MidTierContext (org.graalvm.compiler.phases.tiers.MidTierContext)8 InliningPhase (org.graalvm.compiler.phases.common.inlining.InliningPhase)7 ConditionalEliminationPhase (org.graalvm.compiler.phases.common.ConditionalEliminationPhase)6 Test (org.junit.Test)6 DebugDumpScope (org.graalvm.compiler.debug.DebugDumpScope)5 Node (org.graalvm.compiler.graph.Node)5 OptionValues (org.graalvm.compiler.options.OptionValues)5 ResolvedJavaMethod (jdk.vm.ci.meta.ResolvedJavaMethod)4 FrameStateAssignmentPhase (org.graalvm.compiler.phases.common.FrameStateAssignmentPhase)4 List (java.util.List)3 FloatingReadNode (org.graalvm.compiler.nodes.memory.FloatingReadNode)3 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)3