Search in sources :

Example 1 with MonitorExit

use of org.graalvm.compiler.nodes.extended.MonitorExit in project graal by oracle.

the class FloatingReadTest method test.

@SuppressWarnings("try")
private void test(final String snippet) {
    DebugContext debug = getDebugContext();
    try (DebugContext.Scope s = debug.scope("FloatingReadTest", new DebugDumpScope(snippet))) {
        StructuredGraph graph = parseEager(snippet, AllowAssumptions.YES);
        PhaseContext context = new PhaseContext(getProviders());
        new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
        new FloatingReadPhase().apply(graph);
        ReturnNode returnNode = null;
        MonitorExit monitorexit = null;
        for (Node n : graph.getNodes()) {
            if (n instanceof ReturnNode) {
                assert returnNode == null;
                returnNode = (ReturnNode) n;
            } else if (n instanceof MonitorExit) {
                monitorexit = (MonitorExit) n;
            }
        }
        debug.dump(DebugContext.BASIC_LEVEL, graph, "After lowering");
        Assert.assertNotNull(returnNode);
        Assert.assertNotNull(monitorexit);
        Assert.assertTrue(returnNode.result() instanceof FloatingReadNode);
        FloatingReadNode read = (FloatingReadNode) returnNode.result();
        assertOrderedAfterSchedule(graph, read, (Node) monitorexit);
    } catch (Throwable e) {
        throw debug.handle(e);
    }
}
Also used : DebugDumpScope(org.graalvm.compiler.debug.DebugDumpScope) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) Node(org.graalvm.compiler.graph.Node) LoweringPhase(org.graalvm.compiler.phases.common.LoweringPhase) DebugContext(org.graalvm.compiler.debug.DebugContext) FloatingReadPhase(org.graalvm.compiler.phases.common.FloatingReadPhase) PhaseContext(org.graalvm.compiler.phases.tiers.PhaseContext) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) MonitorExit(org.graalvm.compiler.nodes.extended.MonitorExit) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) CanonicalizerPhase(org.graalvm.compiler.phases.common.CanonicalizerPhase)

Aggregations

DebugContext (org.graalvm.compiler.debug.DebugContext)1 DebugDumpScope (org.graalvm.compiler.debug.DebugDumpScope)1 Node (org.graalvm.compiler.graph.Node)1 ReturnNode (org.graalvm.compiler.nodes.ReturnNode)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 MonitorExit (org.graalvm.compiler.nodes.extended.MonitorExit)1 FloatingReadNode (org.graalvm.compiler.nodes.memory.FloatingReadNode)1 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)1 FloatingReadPhase (org.graalvm.compiler.phases.common.FloatingReadPhase)1 LoweringPhase (org.graalvm.compiler.phases.common.LoweringPhase)1 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)1