Search in sources :

Example 16 with ScheduleResult

use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.

the class MemoryScheduleTest method testIfRead3.

@Test
public void testIfRead3() {
    ScheduleResult schedule = getFinalSchedule("testIfRead3Snippet", TestMode.WITHOUT_FRAMESTATES);
    assertDeepEquals(4, schedule.getCFG().getBlocks().length);
    assertReadWithinStartBlock(schedule, false);
    assertReadWithinAllReturnBlocks(schedule, true);
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) Test(org.junit.Test)

Example 17 with ScheduleResult

use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.

the class MemoryScheduleTest method testIfRead4.

@Test
public void testIfRead4() {
    ScheduleResult schedule = getFinalSchedule("testIfRead4Snippet", TestMode.WITHOUT_FRAMESTATES);
    assertDeepEquals(3, schedule.getCFG().getBlocks().length);
    assertReadWithinStartBlock(schedule, false);
    assertReadWithinAllReturnBlocks(schedule, false);
    assertReadAndWriteInSameBlock(schedule, true);
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) Test(org.junit.Test)

Example 18 with ScheduleResult

use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.

the class MemoryScheduleTest method testBlockSchedule.

@Test
public void testBlockSchedule() {
    ScheduleResult schedule = getFinalSchedule("testBlockScheduleSnippet", TestMode.WITHOUT_FRAMESTATES);
    StructuredGraph graph = schedule.getCFG().graph;
    NodeIterable<WriteNode> writeNodes = graph.getNodes().filter(WriteNode.class);
    assertDeepEquals(1, schedule.getCFG().getBlocks().length);
    assertDeepEquals(8, writeNodes.count());
    assertDeepEquals(1, graph.getNodes().filter(FloatingReadNode.class).count());
    FloatingReadNode read = graph.getNodes().filter(FloatingReadNode.class).first();
    WriteNode[] writes = new WriteNode[8];
    int i = 0;
    for (WriteNode n : writeNodes) {
        writes[i] = n;
        i++;
    }
    assertOrderedAfterSchedule(schedule, writes[4], read);
    assertOrderedAfterSchedule(schedule, read, writes[5]);
    for (int j = 0; j < 7; j++) {
        assertOrderedAfterSchedule(schedule, writes[j], writes[j + 1]);
    }
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) Test(org.junit.Test)

Example 19 with ScheduleResult

use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.

the class MemoryScheduleTest method testLoop3.

@Test
public void testLoop3() {
    ScheduleResult schedule = getFinalSchedule("testLoop3Snippet", TestMode.WITHOUT_FRAMESTATES);
    assertDeepEquals(6, schedule.getCFG().getBlocks().length);
    assertReadWithinStartBlock(schedule, true);
    assertReadWithinAllReturnBlocks(schedule, false);
}
Also used : ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) Test(org.junit.Test)

Example 20 with ScheduleResult

use of org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult in project graal by oracle.

the class MemoryScheduleTest method testLoop9.

@Test
public void testLoop9() {
    ScheduleResult schedule = getFinalSchedule("testLoop9Snippet", TestMode.WITHOUT_FRAMESTATES);
    StructuredGraph graph = schedule.getCFG().getStartBlock().getBeginNode().graph();
    assertThat(graph.getNodes(ReturnNode.TYPE), hasCount(1));
    ReturnNode ret = graph.getNodes(ReturnNode.TYPE).first();
    assertThat(ret.result(), instanceOf(FloatingReadNode.class));
    Block readBlock = schedule.getNodeToBlockMap().get(ret.result());
    Assert.assertEquals(0, readBlock.getLoopDepth());
}
Also used : ReturnNode(org.graalvm.compiler.nodes.ReturnNode) ScheduleResult(org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) Block(org.graalvm.compiler.nodes.cfg.Block) Test(org.junit.Test)

Aggregations

ScheduleResult (org.graalvm.compiler.nodes.StructuredGraph.ScheduleResult)38 Test (org.junit.Test)24 Block (org.graalvm.compiler.nodes.cfg.Block)14 Node (org.graalvm.compiler.graph.Node)10 SchedulePhase (org.graalvm.compiler.phases.schedule.SchedulePhase)9 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)8 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)6 ValueNode (org.graalvm.compiler.nodes.ValueNode)6 List (java.util.List)5 AbstractMergeNode (org.graalvm.compiler.nodes.AbstractMergeNode)5 FixedWithNextNode (org.graalvm.compiler.nodes.FixedWithNextNode)5 LoopExitNode (org.graalvm.compiler.nodes.LoopExitNode)5 DebugContext (org.graalvm.compiler.debug.DebugContext)4 FixedNode (org.graalvm.compiler.nodes.FixedNode)4 FrameState (org.graalvm.compiler.nodes.FrameState)4 LoopBeginNode (org.graalvm.compiler.nodes.LoopBeginNode)4 ReturnNode (org.graalvm.compiler.nodes.ReturnNode)4 InitializeKlassNode (org.graalvm.compiler.hotspot.nodes.aot.InitializeKlassNode)3 LoadConstantIndirectlyFixedNode (org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyFixedNode)3 LoadConstantIndirectlyNode (org.graalvm.compiler.hotspot.nodes.aot.LoadConstantIndirectlyNode)3