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)));
}
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);
}
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]);
}
}
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)));
}
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);
}
Aggregations