Skip to content
Merged
Changes from 1 commit
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
27 changes: 27 additions & 0 deletions proposals/shared-everything-threads/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -855,6 +855,33 @@ subtypes because other references (e.g. funcref and externref) may have arbitrar
representations that do not allow for efficient atomic accesses on the underlying hardware. Engines
still must ensure that non-atomic accesses to any reference do not tear.

The operands of RMW instructions are typed the same as operands to the corresponding `set`
instructions. For example, the typing of `struct.atomic.rmw.xchg` is as follows:

```
struct.atomic.rmw.add typeidx fieldidx

C |- struct.atomic.rmw.add x y : [(ref null x) t] -> [t]
- C.types[x] = struct fields
- fields[i] = mut t
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where is i coming from here?

- t = i32 \/ t = i64 \/ (C |- t <: anyref) \/ (C |- t <: (ref null (shared any))
```

Cmpxchg operations take an additional operand for the expected value. Its type may be a supertype of
the field type, as long as it is still equality-comparable. For example:

```
struct.atomic.rmw.cmpxchg typeidx fieldidx

C |- struct.atomic.rmw.cmpxchg x y : [(ref null x) t1 t2] -> [t2]
- C.types[x] = struct fields
- fields[i] = mut t2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, should be y. Will fix.

- (t2 = i32 /\ t1 = i32) \/
(t2 = i64 /\ t1 = i64) \/
((C |- t2 <: eqref) /\ t1 = eqref) \/
((C |- t2 <: (ref null (shared eq))) /\ t1 = (ref null (shared eq)))
```

> Note: Should we allow atomic arithmetic on i8 and i16 fields? Should we allow arithmetic on i31ref
> fields and table slots?

Expand Down