29.5 Abstract Operations for the Memory Model
29.5.1 EventSet ( execution )
The abstract operation EventSet takes argument execution (a
- Let events be an empty Set.
- For each
Agent Events Record aer of execution.[[EventsRecords]], do- For each event E of aer.[[EventList]], do
- Add E to events.
- For each event E of aer.[[EventList]], do
- Return events.
29.5.2 SharedDataBlockEventSet ( execution )
The abstract operation SharedDataBlockEventSet takes argument execution (a
- Let events be an empty Set.
- For each event E of
EventSet (execution), do- If E is a
ReadSharedMemory ,WriteSharedMemory , orReadModifyWriteSharedMemory event, add E to events.
- If E is a
- Return events.
29.5.3 HostEventSet ( execution )
The abstract operation HostEventSet takes argument execution (a
- Let events be an empty Set.
- For each event E of
EventSet (execution), do- If E is not in
SharedDataBlockEventSet (execution), add E to events.
- If E is not in
- Return events.
29.5.4 ComposeWriteEventBytes ( execution, byteIndex, Ws )
The abstract operation ComposeWriteEventBytes takes arguments execution (a
- Let byteLocation be byteIndex.
- Let bytesRead be a new empty
List . - For each element W of Ws, do
Assert : W has byteLocation in its range.- Let payloadIndex be byteLocation - W.[[ByteIndex]].
- If W is a
WriteSharedMemory event, then- Let byte be W.[[Payload]][payloadIndex].
- Else,
Assert : W is aReadModifyWriteSharedMemory event.- Let bytes be
ValueOfReadEvent (execution, W). - Let bytesModified be W.[[ModifyOp]](bytes, W.[[Payload]]).
- Let byte be bytesModified[payloadIndex].
- Append byte to bytesRead.
- Set byteLocation to byteLocation + 1.
- Return bytesRead.
The read-modify-write modification [[ModifyOp]] is given by the function properties on the Atomics object that introduce
This abstract operation composes a
29.5.5 ValueOfReadEvent ( execution, R )
The abstract operation ValueOfReadEvent takes arguments execution (a
- Let Ws be execution.[[ReadsBytesFrom]](R).
Assert : Ws is aList ofWriteSharedMemory orReadModifyWriteSharedMemory events with length equal to R.[[ElementSize]].- Return
ComposeWriteEventBytes (execution, R.[[ByteIndex]], Ws).