use of org.graalvm.compiler.nodes.memory.OrderedReadNode in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerLoadFieldNode.
protected void lowerLoadFieldNode(LoadFieldNode loadField, LoweringTool tool) {
assert loadField.getStackKind() != JavaKind.Illegal;
StructuredGraph graph = loadField.graph();
ResolvedJavaField field = loadField.field();
ValueNode object = loadField.isStatic() ? staticFieldBase(graph, field) : loadField.object();
object = createNullCheckedValue(object, loadField, tool);
Stamp loadStamp = loadStamp(loadField.stamp(NodeView.DEFAULT), getStorageKind(field));
AddressNode address = createFieldAddress(graph, object, field);
assert address != null : "Field that is loaded must not be eliminated: " + field.getDeclaringClass().toJavaName(true) + "." + field.getName();
ReadNode memoryRead;
BarrierType barrierType = barrierSet.fieldLoadBarrierType(field, getStorageKind(field));
if (loadField.ordersMemoryAccesses()) {
memoryRead = graph.add(new OrderedReadNode(address, loadStamp, barrierType, loadField.getMemoryOrder()));
} else {
memoryRead = graph.add(new ReadNode(address, fieldLocationIdentity(field), loadStamp, barrierType));
}
ValueNode readValue = implicitLoadConvert(graph, getStorageKind(field), memoryRead);
loadField.replaceAtUsages(readValue);
graph.replaceFixed(loadField, memoryRead);
}
use of org.graalvm.compiler.nodes.memory.OrderedReadNode in project graal by oracle.
the class DefaultJavaLoweringProvider method lowerJavaReadNode.
protected void lowerJavaReadNode(JavaReadNode read) {
StructuredGraph graph = read.graph();
JavaKind valueKind = read.getReadKind();
Stamp loadStamp = loadStamp(read.stamp(NodeView.DEFAULT), valueKind, read.isCompressible());
ReadNode memoryRead;
if (read.ordersMemoryAccesses()) {
memoryRead = graph.add(new OrderedReadNode(read.getAddress(), loadStamp, read.getBarrierType(), read.getMemoryOrder()));
} else {
memoryRead = graph.add(new ReadNode(read.getAddress(), read.getLocationIdentity(), loadStamp, read.getBarrierType()));
}
GuardingNode guard = read.getGuard();
ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead, read.isCompressible());
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);
}
read.replaceAtUsages(readValue);
graph.replaceFixed(read, memoryRead);
}
use of org.graalvm.compiler.nodes.memory.OrderedReadNode 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;
if (load.ordersMemoryAccesses()) {
memoryRead = new OrderedReadNode(address, loadStamp, barrierSet.readBarrierType(load), load.getMemoryOrder());
} else {
memoryRead = new ReadNode(address, load.getLocationIdentity(), loadStamp, barrierSet.readBarrierType(load));
}
memoryRead = graph.add(memoryRead);
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;
}
Aggregations