Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fence instruction and encoding to overview #141

Merged
merged 3 commits into from
Jul 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions proposals/threads/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,12 @@ For the web embedding, `atomic.notify` is equivalent in behavior to executing th
1. Let `result` be [`Atomics.notify`][](`int32array`, `address`, `fcount`).
1. Return `result` converted to an `i32`.

## Fence operator

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).

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.

## [JavaScript API][] changes

### `WebAssembly.Memory` Constructor
Expand Down Expand Up @@ -567,6 +573,8 @@ instr ::= ... |
inn.atomic.wait memarg |
atomic.notify memarg |

atomic.fence |

inn.atomic.load memarg | inn.atomic.store memarg |
inn.atomic.load8_u memarg | inn.atomic.load16_u memarg | i64.atomic.load32_u memarg |
inn.atomic.store8 memarg | inn.atomic.store16 memarg | i64.atomic.store32 memarg |
Expand All @@ -590,6 +598,8 @@ instr ::= ...
| 0xFE 0x01 m:memarg32 => i32.atomic.wait m
| 0xFE 0x02 m:memarg64 => i64.atomic.wait m

| 0xFE 0x03 0x00 => atomic.fence

| 0xFE 0x10 m:memarg32 => i32.atomic.load m
| 0xFE 0x11 m:memarg64 => i64.atomic.load m
| 0xFE 0x12 m:memarg8 => i32.atomic.load8_u m
Expand Down