Search in sources :

Example 16 with WriteNode

use of org.graalvm.compiler.nodes.memory.WriteNode 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 17 with WriteNode

use of org.graalvm.compiler.nodes.memory.WriteNode in project graal by oracle.

the class MemoryScheduleTest method assertReadAndWriteInSameBlock.

private static void assertReadAndWriteInSameBlock(ScheduleResult schedule, boolean inSame) {
    StructuredGraph graph = schedule.getCFG().graph;
    FloatingReadNode read = graph.getNodes().filter(FloatingReadNode.class).first();
    WriteNode write = graph.getNodes().filter(WriteNode.class).first();
    assertTrue(!(inSame ^ schedule.getCFG().blockFor(read) == schedule.getCFG().blockFor(write)));
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode)

Aggregations

WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)17 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)11 ValueNode (org.graalvm.compiler.nodes.ValueNode)10 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)8 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)8 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)7 JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)6 AtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode)6 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)5 JavaKind (jdk.vm.ci.meta.JavaKind)4 FloatingReadNode (org.graalvm.compiler.nodes.memory.FloatingReadNode)4 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)3 DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)3 Node (org.graalvm.compiler.graph.Node)3 ResolvedJavaType (jdk.vm.ci.meta.ResolvedJavaType)2 DebugContext (org.graalvm.compiler.debug.DebugContext)2 ComputeObjectAddressNode (org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode)2 G1PostWriteBarrier (org.graalvm.compiler.hotspot.nodes.G1PostWriteBarrier)2 G1PreWriteBarrier (org.graalvm.compiler.hotspot.nodes.G1PreWriteBarrier)2 GetObjectAddressNode (org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode)2