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));
}
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));
}
}
}
Aggregations