Skip to content

Commit fa319c9

Browse files
authored
Update description of memory.atomic.wait64 (#190)
Now that JS `Atomics.wait` natively supports BigInt64Array, `memory.atomic.wait64` can be described directly in terms of `Atomic.wait`.
1 parent 85b562c commit fa319c9

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

proposals/threads/Overview.md

+3-12
Original file line numberDiff line numberDiff line change
@@ -400,23 +400,14 @@ For the web embedding, `memory.atomic.wait32` is equivalent in behavior to execu
400400
1. Return an `i32` value as described in the above table:
401401
("ok" -> `0`, "not-equal" -> `1`, "timed-out" -> `2`).
402402

403-
`memory.atomic.wait64` has no equivalent in ECMAScript as it is currently specified, as there is
404-
no `Int64Array` type, and an ECMAScript `Number` cannot represent all values of a
405-
64-bit integer. That said, the behavior can be approximated as follows:
403+
Similarly, `memory.atomic.wait64` is equivalent in behavior to executing the following:
406404

407405
1. Let `memory` be a `WebAssembly.Memory` object for this module.
408406
1. Let `buffer` be `memory`([`Get`][](`memory`, `"buffer"`)).
409-
1. Let `int64array` be `Int64Array`[](`buffer`), where `Int64Array` is a
410-
typed-array constructor that allows 64-bit integer views with an element size
411-
of `8`.
407+
1. Let `int64array` be `BigInt64Array`[](`buffer`)
412408
1. Let `result` be [`Atomics.wait`][](`int64array`, `address`, `expected`, `timeout` / 1e6),
413409
where `address`, `expected`, and `timeout` are the operands to the `wait` operator
414-
as described above. The [`Atomics.wait`][] operation is modified:
415-
1. `ValidateSharedIntegerTypedArray` will fail if the typed-array type is not an
416-
`Int64Array`.
417-
1. `value` is not converted to an `Int32`, but kept in a 64-bit integer
418-
representation.
419-
1. `indexedPosition` is (`i` x 8) + `offset`
410+
as described above.
420411
1. Return an `i32` value as described in the above table:
421412
("ok" -> `0`, "not-equal" -> `1`, "timed-out" -> `2`).
422413

0 commit comments

Comments
 (0)