use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerLoadIndexedNode.
protected void lowerLoadIndexedNode(LoadIndexedNode loadIndexed, LoweringTool tool) {
StructuredGraph graph = loadIndexed.graph();
ValueNode array = loadIndexed.array();
array = createNullCheckedValue(array, loadIndexed, tool);
JavaKind elementKind = loadIndexed.elementKind();
Stamp loadStamp = loadStamp(loadIndexed.stamp(NodeView.DEFAULT), elementKind);
GuardingNode boundsCheck = getBoundsCheck(loadIndexed, array, tool);
AddressNode address = createArrayIndexAddress(graph, array, elementKind, loadIndexed.index(), boundsCheck);
ReadNode memoryRead = graph.add(new ReadNode(address, NamedLocationIdentity.getArrayLocation(elementKind), loadStamp, BarrierType.NONE));
memoryRead.setGuard(boundsCheck);
ValueNode readValue = implicitLoadConvert(graph, elementKind, memoryRead);
loadIndexed.replaceAtUsages(readValue);
graph.replaceFixed(loadIndexed, memoryRead);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultJavaLoweringProvider method createUnsafeRead.
protected ReadNode createUnsafeRead(StructuredGraph graph, RawLoadNode load, GuardingNode guard) {
boolean compressible = load.accessKind() == JavaKind.Object;
JavaKind readKind = load.accessKind();
Stamp loadStamp = loadStamp(load.stamp(NodeView.DEFAULT), readKind, compressible);
AddressNode address = createUnsafeAddress(graph, load.object(), load.offset());
ReadNode memoryRead = graph.add(new ReadNode(address, load.getLocationIdentity(), loadStamp, BarrierType.NONE));
if (guard == null) {
// An unsafe read must not float otherwise it may float above
// a test guaranteeing the read is safe.
memoryRead.setForceFixed(true);
} else {
memoryRead.setGuard(guard);
}
ValueNode readValue = performBooleanCoercionIfNecessary(implicitLoadConvert(graph, readKind, memoryRead, compressible), readKind);
load.replaceAtUsages(readValue);
return memoryRead;
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerUnsafeStoreNode.
protected void lowerUnsafeStoreNode(RawStoreNode store) {
StructuredGraph graph = store.graph();
boolean compressible = store.value().getStackKind() == JavaKind.Object;
JavaKind valueKind = store.accessKind();
ValueNode value = implicitStoreConvert(graph, valueKind, store.value(), compressible);
AddressNode address = createUnsafeAddress(graph, store.object(), store.offset());
WriteNode write = graph.add(new WriteNode(address, store.getLocationIdentity(), value, unsafeStoreBarrierType(store)));
write.setStateAfter(store.stateAfter());
graph.replaceFixedWithFixed(store, write);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerAtomicReadAndWriteNode.
protected void lowerAtomicReadAndWriteNode(AtomicReadAndWriteNode n) {
StructuredGraph graph = n.graph();
JavaKind valueKind = n.getValueKind();
ValueNode newValue = implicitStoreConvert(graph, valueKind, n.newValue());
AddressNode address = graph.unique(new OffsetAddressNode(n.object(), n.offset()));
LoweredAtomicReadAndWriteNode memoryRead = graph.add(new LoweredAtomicReadAndWriteNode(address, n.getLocationIdentity(), newValue, atomicReadAndWriteBarrierType(n)));
memoryRead.setStateAfter(n.stateAfter());
ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead);
n.stateAfter().replaceFirstInput(n, memoryRead);
n.replaceAtUsages(readValue);
graph.replaceFixedWithFixed(n, memoryRead);
}
use of org.graalvm.compiler.nodes.memory.address.AddressNode in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerUnsafeMemoryLoadNode.
protected void lowerUnsafeMemoryLoadNode(UnsafeMemoryLoadNode load) {
StructuredGraph graph = load.graph();
JavaKind readKind = load.getKind();
assert readKind != JavaKind.Object;
Stamp loadStamp = loadStamp(load.stamp(NodeView.DEFAULT), readKind, false);
AddressNode address = graph.addOrUniqueWithInputs(OffsetAddressNode.create(load.getAddress()));
ReadNode memoryRead = graph.add(new ReadNode(address, load.getLocationIdentity(), loadStamp, BarrierType.NONE));
// An unsafe read must not float otherwise it may float above
// a test guaranteeing the read is safe.
memoryRead.setForceFixed(true);
ValueNode readValue = performBooleanCoercionIfNecessary(implicitLoadConvert(graph, readKind, memoryRead, false), readKind);
load.replaceAtUsages(readValue);
graph.replaceFixedWithFixed(load, memoryRead);
}
Aggregations