Search in sources :

Example 11 with FloatingReadNode

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

the class DefaultHotSpotLoweringProvider method lowerKlassLayoutHelperNode.

private void lowerKlassLayoutHelperNode(KlassLayoutHelperNode n, LoweringTool tool) {
    if (tool.getLoweringStage() == LoweringTool.StandardLoweringStage.HIGH_TIER) {
        return;
    }
    StructuredGraph graph = n.graph();
    assert !n.getHub().isConstant();
    AddressNode address = createOffsetAddress(graph, n.getHub(), runtime.getVMConfig().klassLayoutHelperOffset);
    n.replaceAtUsagesAndDelete(graph.unique(new FloatingReadNode(address, KLASS_LAYOUT_HELPER_LOCATION, null, n.stamp(NodeView.DEFAULT), null, BarrierType.NONE)));
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) GetObjectAddressNode(org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode) ComputeObjectAddressNode(org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode)

Example 12 with FloatingReadNode

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

the class MemoryScheduleTest method assertReadWithinStartBlock.

private void assertReadWithinStartBlock(ScheduleResult schedule, boolean withinStartBlock) {
    boolean readEncountered = false;
    for (Node node : schedule.getBlockToNodesMap().get(schedule.getCFG().getStartBlock())) {
        if (node instanceof FloatingReadNode) {
            readEncountered = true;
        }
    }
    assertDeepEquals(withinStartBlock, readEncountered);
}
Also used : WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) StartNode(org.graalvm.compiler.nodes.StartNode) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) Node(org.graalvm.compiler.graph.Node) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode)

Example 13 with FloatingReadNode

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

use of org.graalvm.compiler.nodes.memory.FloatingReadNode 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)

Example 15 with FloatingReadNode

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

the class MemoryScheduleTest method assertReadWithinAllReturnBlocks.

private void assertReadWithinAllReturnBlocks(ScheduleResult schedule, boolean withinReturnBlock) {
    StructuredGraph graph = schedule.getCFG().graph;
    assertTrue(graph.getNodes(ReturnNode.TYPE).isNotEmpty());
    int withRead = 0;
    int returnBlocks = 0;
    for (ReturnNode returnNode : graph.getNodes(ReturnNode.TYPE)) {
        Block block = schedule.getCFG().getNodeToBlock().get(returnNode);
        for (Node node : schedule.getBlockToNodesMap().get(block)) {
            if (node instanceof FloatingReadNode) {
                withRead++;
                break;
            }
        }
        returnBlocks++;
    }
    assertDeepEquals(withRead == returnBlocks, withinReturnBlock);
}
Also used : ReturnNode(org.graalvm.compiler.nodes.ReturnNode) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) StartNode(org.graalvm.compiler.nodes.StartNode) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) ReturnNode(org.graalvm.compiler.nodes.ReturnNode) Node(org.graalvm.compiler.graph.Node) FloatingReadNode(org.graalvm.compiler.nodes.memory.FloatingReadNode) Block(org.graalvm.compiler.nodes.cfg.Block)

Aggregations

FloatingReadNode (org.graalvm.compiler.nodes.memory.FloatingReadNode)16 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)9 Node (org.graalvm.compiler.graph.Node)6 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)6 ComputeObjectAddressNode (org.graalvm.compiler.hotspot.nodes.ComputeObjectAddressNode)4 GetObjectAddressNode (org.graalvm.compiler.hotspot.nodes.GetObjectAddressNode)4 ReturnNode (org.graalvm.compiler.nodes.ReturnNode)4 ValueNode (org.graalvm.compiler.nodes.ValueNode)4 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)4 CanonicalizerPhase (org.graalvm.compiler.phases.common.CanonicalizerPhase)3 FloatingReadPhase (org.graalvm.compiler.phases.common.FloatingReadPhase)3 LoweringPhase (org.graalvm.compiler.phases.common.LoweringPhase)3 PhaseContext (org.graalvm.compiler.phases.tiers.PhaseContext)3 Stamp (org.graalvm.compiler.core.common.type.Stamp)2 DebugContext (org.graalvm.compiler.debug.DebugContext)2 DebugDumpScope (org.graalvm.compiler.debug.DebugDumpScope)2 KlassPointerStamp (org.graalvm.compiler.hotspot.nodes.type.KlassPointerStamp)2 StartNode (org.graalvm.compiler.nodes.StartNode)2 ReadNode (org.graalvm.compiler.nodes.memory.ReadNode)2 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)2