Search in sources :

Example 1 with JavaOrderedReadNode

use of org.graalvm.compiler.nodes.extended.JavaOrderedReadNode in project graal by oracle.

the class WordOperationPlugin method readVolatileOp.

protected ValueNode readVolatileOp(GraphBuilderContext b, JavaKind readKind, AddressNode address, LocationIdentity location, Opcode op) {
    assert op == Opcode.READ_POINTER_VOLATILE || op == Opcode.READ_BARRIERED_VOLATILE;
    final BarrierType barrier = op == Opcode.READ_BARRIERED_VOLATILE ? BarrierType.UNKNOWN : BarrierType.NONE;
    final boolean compressible = op == Opcode.READ_BARRIERED_VOLATILE;
    /*
         * A JavaOrderedReadNode is lowered to an OrderedReadNode that will not float. This means it
         * cannot float above an explicit zero check on its base address or any other test that
         * ensures the read is safe.
         */
    JavaReadNode read = b.add(new JavaOrderedReadNode(readKind, address, location, barrier, MemoryOrderMode.VOLATILE, compressible));
    return read;
}
Also used : JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) JavaOrderedReadNode(org.graalvm.compiler.nodes.extended.JavaOrderedReadNode) BarrierType(org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType)

Example 2 with JavaOrderedReadNode

use of org.graalvm.compiler.nodes.extended.JavaOrderedReadNode in project graal by oracle.

the class LoadVMThreadLocalNode method lower.

@Override
public void lower(LoweringTool tool) {
    assert threadLocalInfo.offset >= 0;
    ConstantNode offset = ConstantNode.forLong(threadLocalInfo.offset, holder.graph());
    AddressNode address = graph().unique(new OffsetAddressNode(holder, offset));
    JavaReadNode read;
    if (MemoryOrderMode.ordersMemoryAccesses(memoryOrder)) {
        read = graph().add(new JavaOrderedReadNode(stamp, threadLocalInfo.storageKind, address, threadLocalInfo.locationIdentity, barrierType, memoryOrder, true));
    } else {
        read = graph().add(new JavaReadNode(stamp, threadLocalInfo.storageKind, address, threadLocalInfo.locationIdentity, barrierType, true));
        if (threadLocalInfo.allowFloatingReads) {
            /*
                 * Setting a guarding node allows a JavaReadNode to float when lowered. Otherwise
                 * they will be conservatively be forced at a fixed location.
                 */
            read.setGuard(read.graph().start());
        }
    }
    graph().replaceFixedWithFixed(this, read);
    tool.getLowerer().lower(read, tool);
}
Also used : JavaReadNode(org.graalvm.compiler.nodes.extended.JavaReadNode) ConstantNode(org.graalvm.compiler.nodes.ConstantNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode) JavaOrderedReadNode(org.graalvm.compiler.nodes.extended.JavaOrderedReadNode) AddressNode(org.graalvm.compiler.nodes.memory.address.AddressNode) OffsetAddressNode(org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)

Aggregations

JavaOrderedReadNode (org.graalvm.compiler.nodes.extended.JavaOrderedReadNode)2 JavaReadNode (org.graalvm.compiler.nodes.extended.JavaReadNode)2 ConstantNode (org.graalvm.compiler.nodes.ConstantNode)1 BarrierType (org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType)1 AddressNode (org.graalvm.compiler.nodes.memory.address.AddressNode)1 OffsetAddressNode (org.graalvm.compiler.nodes.memory.address.OffsetAddressNode)1