Skip to content

Commit 4cbecad

Browse files
conrad-wattbinji
authored andcommitted
Add fence instruction and encoding to overview (#141)
Following #140
1 parent 300b14b commit 4cbecad

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

proposals/threads/Overview.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,12 @@ For the web embedding, `atomic.notify` is equivalent in behavior to executing th
437437
1. Let `result` be [`Atomics.notify`][](`int32array`, `address`, `fcount`).
438438
1. Return `result` converted to an `i32`.
439439

440+
## Fence operator
441+
442+
The fence operator, `atomic.fence`, takes no operands, and returns nothing. It is intended to preserve the synchronization guarantees of the [fence operators of higher-level languages](https://en.cppreference.com/w/cpp/atomic/atomic_thread_fence).
443+
444+
Unlike other atomic operators, `atomic.fence` does not target a particular linear memory. It may occur in modules which declare no memory, or a non-shared memory, without causing a validation error.
445+
440446
## [JavaScript API][] changes
441447

442448
### `WebAssembly.Memory` Constructor
@@ -567,6 +573,8 @@ instr ::= ... |
567573
inn.atomic.wait memarg |
568574
atomic.notify memarg |
569575
576+
atomic.fence |
577+
570578
inn.atomic.load memarg | inn.atomic.store memarg |
571579
inn.atomic.load8_u memarg | inn.atomic.load16_u memarg | i64.atomic.load32_u memarg |
572580
inn.atomic.store8 memarg | inn.atomic.store16 memarg | i64.atomic.store32 memarg |
@@ -590,6 +598,8 @@ instr ::= ...
590598
| 0xFE 0x01 m:memarg32 => i32.atomic.wait m
591599
| 0xFE 0x02 m:memarg64 => i64.atomic.wait m
592600
601+
| 0xFE 0x03 0x00 => atomic.fence
602+
593603
| 0xFE 0x10 m:memarg32 => i32.atomic.load m
594604
| 0xFE 0x11 m:memarg64 => i64.atomic.load m
595605
| 0xFE 0x12 m:memarg8 => i32.atomic.load8_u m

0 commit comments

Comments
 (0)