use of org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode 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.java.LoweredAtomicReadAndWriteNode in project graal by oracle.
the class WriteBarrierAdditionPhase method run.
@SuppressWarnings("try")
@Override
protected void run(StructuredGraph graph) {
for (Node n : graph.getNodes()) {
try (DebugCloseable scope = n.graph().withNodeSourcePosition(n)) {
if (n instanceof ReadNode) {
addReadNodeBarriers((ReadNode) n, graph);
} else if (n instanceof WriteNode) {
addWriteNodeBarriers((WriteNode) n, graph);
} else if (n instanceof LoweredAtomicReadAndWriteNode) {
LoweredAtomicReadAndWriteNode loweredAtomicReadAndWriteNode = (LoweredAtomicReadAndWriteNode) n;
addAtomicReadWriteNodeBarriers(loweredAtomicReadAndWriteNode, graph);
} else if (n instanceof AbstractCompareAndSwapNode) {
addCASBarriers((AbstractCompareAndSwapNode) n, graph);
} else if (n instanceof ArrayRangeWrite) {
ArrayRangeWrite node = (ArrayRangeWrite) n;
if (node.writesObjectArray()) {
addArrayRangeBarriers(node, graph);
}
}
}
}
}
Aggregations