Search in sources :

Example 1 with LoweredAtomicReadAndAddNode

use of org.graalvm.compiler.nodes.java.LoweredAtomicReadAndAddNode in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerAtomicReadAndAddNode.

protected void lowerAtomicReadAndAddNode(AtomicReadAndAddNode n) {
    StructuredGraph graph = n.graph();
    JavaKind valueKind = n.getValueKind();
    ValueNode delta = implicitStoreConvert(graph, valueKind, n.delta());
    AddressNode address = graph.unique(new OffsetAddressNode(n.object(), n.offset()));
    BarrierType barrierType = barrierSet.guessStoreBarrierType(n.object(), delta);
    LIRKind lirAccessKind = LIRKind.fromJavaKind(target.arch, valueKind);
    LoweredAtomicReadAndAddNode memoryRead = graph.add(new LoweredAtomicReadAndAddNode(address, n.getKilledLocationIdentity(), delta, lirAccessKind, barrierType));
    memoryRead.setStateAfter(n.stateAfter());
    ValueNode readValue = implicitLoadConvert(graph, valueKind, memoryRead);
    n.stateAfter().replaceFirstInput(n, memoryRead);
    n.replaceAtUsages(readValue);
    graph.replaceFixedWithFixed(n, memoryRead);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) LoweredAtomicReadAndAddNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndAddNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) GetObjectAddressNode(org.graalvm.compiler.nodes.GetObjectAddressNode) IndexAddressNode(org.graalvm.compiler.nodes.memory.address.IndexAddressNode) ComputeObjectAddressNode(org.graalvm.compiler.nodes.ComputeObjectAddressNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) LIRKind(org.graalvm.compiler.core.common.LIRKind) BarrierType(org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType) JavaKind(jdk.vm.ci.meta.JavaKind)

Aggregations

JavaKind (jdk.vm.ci.meta.JavaKind)1 LIRKind (org.graalvm.compiler.core.common.LIRKind)1 ComputeObjectAddressNode (org.graalvm.compiler.nodes.ComputeObjectAddressNode)1 GetObjectAddressNode (org.graalvm.compiler.nodes.GetObjectAddressNode)1 StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)1 ValueNode (org.graalvm.compiler.nodes.ValueNode)1 LoweredAtomicReadAndAddNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndAddNode)1 BarrierType (org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType)1 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)1 IndexAddressNode (org.graalvm.compiler.nodes.memory.address.IndexAddressNode)1 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)1