Class SharedMemorySync
java.lang.Object
com.oracle.truffle.js.builtins.helper.SharedMemorySync
Implementation of the synchronization primitives of ECMA2017 Shared Memory model.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddWaiter(JSAgent agent, JSAgentWaiterList.JSAgentWaiterListEntry wl, JSAgentWaiterList.WaiterRecord waiterRecord, boolean isAsync) static booleancompareAndSetBigInt(JSTypedArrayObject target, int intArrayOffset, BigInt expected, BigInt replacement, TypedArray.TypedBigIntArray typedArray) static booleancompareAndSetInt(JSTypedArrayObject target, int intArrayOffset, int expected, int replacement, TypedArray.TypedIntArray typedArray) static intdoVolatileGet(JSTypedArrayObject target, int intArrayOffset, TypedArray.TypedIntArray typedArray) static BigIntdoVolatileGetBigInt(JSTypedArrayObject target, int intArrayOffset, TypedArray.TypedBigIntArray typedArray) static voiddoVolatilePut(JSTypedArrayObject target, int index, int value, TypedArray.TypedIntArray typedArray) static voiddoVolatilePutBigInt(JSTypedArrayObject target, int index, BigInt value, TypedArray.TypedBigIntArray typedArray) getWaiterList(JSContext context, JSDynamicObject target, int indexPos) static voidstatic JSAgentWaiterList.WaiterRecord[]removeWaiters(JSAgentWaiterList.JSAgentWaiterListEntry wl, int count) static booleansuspendAgent(JSAgent agent, JSAgentWaiterList.JSAgentWaiterListEntry wl, JSAgentWaiterList.WaiterRecord waiterRecord) SuspendAgent (WL, W, timeout).static voidWakes waiting agents on the WaiterList, since at least one of them should be notified.
-
Method Details
-
doVolatileGet
public static int doVolatileGet(JSTypedArrayObject target, int intArrayOffset, TypedArray.TypedIntArray typedArray) -
doVolatileGetBigInt
public static BigInt doVolatileGetBigInt(JSTypedArrayObject target, int intArrayOffset, TypedArray.TypedBigIntArray typedArray) -
doVolatilePut
public static void doVolatilePut(JSTypedArrayObject target, int index, int value, TypedArray.TypedIntArray typedArray) -
doVolatilePutBigInt
public static void doVolatilePutBigInt(JSTypedArrayObject target, int index, BigInt value, TypedArray.TypedBigIntArray typedArray) -
compareAndSetInt
public static boolean compareAndSetInt(JSTypedArrayObject target, int intArrayOffset, int expected, int replacement, TypedArray.TypedIntArray typedArray) -
compareAndSetBigInt
public static boolean compareAndSetBigInt(JSTypedArrayObject target, int intArrayOffset, BigInt expected, BigInt replacement, TypedArray.TypedBigIntArray typedArray) -
getWaiterList
public static JSAgentWaiterList.JSAgentWaiterListEntry getWaiterList(JSContext context, JSDynamicObject target, int indexPos) -
addWaiter
public static void addWaiter(JSAgent agent, JSAgentWaiterList.JSAgentWaiterListEntry wl, JSAgentWaiterList.WaiterRecord waiterRecord, boolean isAsync) -
removeWaiter
public static void removeWaiter(JSAgentWaiterList.JSAgentWaiterListEntry wl, JSAgentWaiterList.WaiterRecord w) -
suspendAgent
public static boolean suspendAgent(JSAgent agent, JSAgentWaiterList.JSAgentWaiterListEntry wl, JSAgentWaiterList.WaiterRecord waiterRecord) SuspendAgent (WL, W, timeout). Suspends (blocks) this agent, awaiting a notification via this WaiterList.- Returns:
- true if agent W was notified by another agent; false if timed out.
-
wakeWaiters
Wakes waiting agents on the WaiterList, since at least one of them should be notified. -
removeWaiters
public static JSAgentWaiterList.WaiterRecord[] removeWaiters(JSAgentWaiterList.JSAgentWaiterListEntry wl, int count)
-