Search in sources :

Example 1 with OrderedWriteNode

use of org.graalvm.compiler.nodes.memory.OrderedWriteNode in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerStoreFieldNode.

protected void lowerStoreFieldNode(StoreFieldNode storeField, LoweringTool tool) {
    StructuredGraph graph = storeField.graph();
    ResolvedJavaField field = storeField.field();
    ValueNode object = storeField.isStatic() ? staticFieldBase(graph, field) : storeField.object();
    object = createNullCheckedValue(object, storeField, tool);
    ValueNode value = implicitStoreConvert(graph, getStorageKind(storeField.field()), storeField.value());
    AddressNode address = createFieldAddress(graph, object, field);
    assert address != null;
    BarrierType barrierType = barrierSet.fieldStoreBarrierType(field, getStorageKind(field));
    WriteNode memoryWrite;
    if (storeField.ordersMemoryAccesses()) {
        memoryWrite = graph.add(new OrderedWriteNode(address, fieldLocationIdentity(field), value, barrierType, storeField.getMemoryOrder()));
    } else {
        memoryWrite = graph.add(new WriteNode(address, fieldLocationIdentity(field), value, barrierType));
    }
    memoryWrite.setStateAfter(storeField.stateAfter());
    graph.replaceFixedWithFixed(storeField, memoryWrite);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) OrderedWriteNode(org.graalvm.compiler.nodes.memory.OrderedWriteNode) 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) OrderedWriteNode(org.graalvm.compiler.nodes.memory.OrderedWriteNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) AtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) BarrierType(org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType) ResolvedJavaField(jdk.vm.ci.meta.ResolvedJavaField)

Example 2 with OrderedWriteNode

use of org.graalvm.compiler.nodes.memory.OrderedWriteNode in project graal by oracle.

the class DefaultJavaLoweringProvider method lowerJavaWriteNode.

protected void lowerJavaWriteNode(JavaWriteNode write) {
    StructuredGraph graph = write.graph();
    ValueNode value = implicitStoreConvert(graph, write.getWriteKind(), write.value(), write.isCompressible());
    WriteNode memoryWrite;
    if (write.ordersMemoryAccesses()) {
        memoryWrite = graph.add(new OrderedWriteNode(write.getAddress(), write.getKilledLocationIdentity(), value, write.getBarrierType(), write.getMemoryOrder()));
    } else if (write.hasSideEffect()) {
        memoryWrite = graph.add(new WriteNode(write.getAddress(), write.getKilledLocationIdentity(), value, write.getBarrierType()));
    } else {
        memoryWrite = graph.add(new SideEffectFreeWrite(write.getAddress(), write.getKilledLocationIdentity(), value, write.getBarrierType()));
    }
    memoryWrite.setStateAfter(write.stateAfter());
    graph.replaceFixedWithFixed(write, memoryWrite);
    memoryWrite.setGuard(write.getGuard());
}
Also used : SideEffectFreeWrite(org.graalvm.compiler.nodes.memory.SideEffectFreeWrite) StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) OrderedWriteNode(org.graalvm.compiler.nodes.memory.OrderedWriteNode) ValueNode(org.graalvm.compiler.nodes.ValueNode) OrderedWriteNode(org.graalvm.compiler.nodes.memory.OrderedWriteNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) AtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)

Example 3 with OrderedWriteNode

use of org.graalvm.compiler.nodes.memory.OrderedWriteNode 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;
    if (store.ordersMemoryAccesses()) {
        write = new OrderedWriteNode(address, store.getLocationIdentity(), value, barrierSet.storeBarrierType(store), store.getMemoryOrder());
    } else {
        write = new WriteNode(address, store.getLocationIdentity(), value, barrierSet.storeBarrierType(store));
    }
    write = graph.add(write);
    write.setStateAfter(store.stateAfter());
    graph.replaceFixedWithFixed(store, write);
}
Also used : StructuredGraph(org.graalvm.compiler.nodes.StructuredGraph) OrderedWriteNode(org.graalvm.compiler.nodes.memory.OrderedWriteNode) 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) OrderedWriteNode(org.graalvm.compiler.nodes.memory.OrderedWriteNode) WriteNode(org.graalvm.compiler.nodes.memory.WriteNode) AtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode) JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) LoweredAtomicReadAndWriteNode(org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode) JavaKind(jdk.vm.ci.meta.JavaKind)

Aggregations

StructuredGraph (org.graalvm.compiler.nodes.StructuredGraph)3 ValueNode (org.graalvm.compiler.nodes.ValueNode)3 JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)3 AtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.AtomicReadAndWriteNode)3 LoweredAtomicReadAndWriteNode (org.graalvm.compiler.nodes.java.LoweredAtomicReadAndWriteNode)3 OrderedWriteNode (org.graalvm.compiler.nodes.memory.OrderedWriteNode)3 WriteNode (org.graalvm.compiler.nodes.memory.WriteNode)3 ComputeObjectAddressNode (org.graalvm.compiler.nodes.ComputeObjectAddressNode)2 GetObjectAddressNode (org.graalvm.compiler.nodes.GetObjectAddressNode)2 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)2 IndexAddressNode (org.graalvm.compiler.nodes.memory.address.IndexAddressNode)2 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)2 JavaKind (jdk.vm.ci.meta.JavaKind)1 ResolvedJavaField (jdk.vm.ci.meta.ResolvedJavaField)1 BarrierType (org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType)1 SideEffectFreeWrite (org.graalvm.compiler.nodes.memory.SideEffectFreeWrite)1