Search in sources :

Example 1 with MemoryOrderMode

use of org.graalvm.compiler.core.common.memory.MemoryOrderMode in project graal by oracle.

the class WordOperationPlugin method writeOp.

protected void writeOp(GraphBuilderContext b, JavaKind writeKind, AddressNode address, LocationIdentity location, ValueNode value, Opcode op) {
    assert op == Opcode.WRITE_POINTER || op == Opcode.WRITE_POINTER_SIDE_EFFECT_FREE || op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED || op == Opcode.INITIALIZE || op == Opcode.WRITE_POINTER_VOLATILE;
    assert op != Opcode.INITIALIZE || location.isInit() : "must use init location for initializing";
    final BarrierType barrier = (op == Opcode.WRITE_BARRIERED ? BarrierType.UNKNOWN : BarrierType.NONE);
    final boolean compressible = (op == Opcode.WRITE_OBJECT || op == Opcode.WRITE_BARRIERED);
    final boolean hasSideEffect = (op != Opcode.WRITE_POINTER_SIDE_EFFECT_FREE);
    final MemoryOrderMode memoryOrder = op == Opcode.WRITE_POINTER_VOLATILE ? MemoryOrderMode.VOLATILE : MemoryOrderMode.PLAIN;
    b.add(new JavaWriteNode(writeKind, address, location, value, barrier, compressible, hasSideEffect, memoryOrder));
}
Also used : JavaWriteNode(org.graalvm.compiler.nodes.extended.JavaWriteNode) MemoryOrderMode(org.graalvm.compiler.core.common.memory.MemoryOrderMode) BarrierType(org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType)

Example 2 with MemoryOrderMode

use of org.graalvm.compiler.core.common.memory.MemoryOrderMode in project graal by oracle.

the class StandardGraphBuilderPlugins method registerUnsafeAtomicsPlugins.

private static void registerUnsafeAtomicsPlugins(Registration r, boolean isSunMiscUnsafe, boolean explicitUnsafeNullChecks, String casPrefix, String[] memoryOrders, JavaKind[] supportedJavaKinds) {
    for (JavaKind kind : supportedJavaKinds) {
        Class<?> javaClass = getJavaClass(kind);
        String kindName = getKindName(isSunMiscUnsafe, kind);
        boolean isLogic = true;
        JavaKind returnKind = JavaKind.Boolean.getStackKind();
        if (casPrefix.startsWith("compareAndExchange")) {
            isLogic = false;
            returnKind = kind.isNumericInteger() ? kind.getStackKind() : kind;
        }
        for (String memoryOrderString : memoryOrders) {
            MemoryOrderMode memoryOrder = memoryOrderString.equals("") ? MemoryOrderMode.VOLATILE : MemoryOrderMode.valueOf(memoryOrderString.toUpperCase());
            r.register(new UnsafeCompareAndSwapPlugin(returnKind, kind, memoryOrder, isLogic, explicitUnsafeNullChecks, casPrefix + kindName + memoryOrderString, Receiver.class, Object.class, long.class, javaClass, javaClass));
        }
    }
}
Also used : MemoryOrderMode(org.graalvm.compiler.core.common.memory.MemoryOrderMode) Receiver(org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver) JavaKind(jdk.vm.ci.meta.JavaKind)

Aggregations

MemoryOrderMode (org.graalvm.compiler.core.common.memory.MemoryOrderMode)2 JavaKind (jdk.vm.ci.meta.JavaKind)1 JavaWriteNode (org.graalvm.compiler.nodes.extended.JavaWriteNode)1 Receiver (org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.Receiver)1 BarrierType (org.graalvm.compiler.nodes.memory.OnHeapMemoryAccess.BarrierType)1