Skip to content

Commit 6e08e28

Browse files
Gate some spec features separately from async (#468)
* Gate some spec features separately from async This commit comes out of some discussion with folks today where a few features of the async specification are going to be gated behind separate feature gates distinct from the current one. This is to help reduce scope slightly for the 0.3.0 release of WASI and focus on the other features to ship. Here two new emoji-features are added: * 🚝: marking some builtins as `async` * 🚟: using `async` with `canon lift` without `callback` (stackful abi) I've tried to update `Async.md` and `CanonicalABI.md` where appropriate with these new emoji. * Review comments --------- Co-authored-by: Luke Wagner <[email protected]>
1 parent cfe011a commit 6e08e28

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

design/mvp/Async.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,8 @@ the core wasm toolchain) `$retp` must be a 4-byte-aligned pointer into linear
616616
memory from which the 8-byte (pointer, length) of the string result can be
617617
loaded.
618618

619-
The async export ABI provides two flavors: stackful and stackless.
619+
The async export ABI provides two flavors: stackful and stackless. The stackful
620+
ABI is currently gated by the 🚟 feature.
620621

621622
The async stackful export function signature is:
622623
```wat
@@ -716,11 +717,12 @@ replaced with `...` to focus on the overall flow of function calls.
716717
(core instance $libc (instantiate $Libc))
717718
(alias $libc "mem" (core memory $mem))
718719
(alias $libc "realloc" (core func $realloc))
720+
;; requires 🚟 for the stackful abi
719721
(canon lower $fetch async (memory $mem) (realloc $realloc) (core func $fetch'))
720722
(canon waitable-set.new (core func $new))
721723
(canon waitable-set.wait async (memory $mem) (core func $wait))
722724
(canon waitable.join (core func $join))
723-
(canon task.return (result string) async (memory $mem) (realloc $realloc) (core func $task_return))
725+
(canon task.return (result string) (memory $mem) (core func $task_return))
724726
(core instance $main (instantiate $Main (with "" (instance
725727
(export "mem" (memory $mem))
726728
(export "realloc" (func $realloc))

design/mvp/CanonicalABI.md

+7
Original file line numberDiff line numberDiff line change
@@ -2719,6 +2719,8 @@ present, is validated as such:
27192719
* `post-return` - only allowed on [`canon lift`](#canon-lift), which has rules
27202720
for validation
27212721
* 🔀 `async` - cannot be present with `post-return`
2722+
* 🔀,not(🚟) `async` - `callback` must also be present. Note that with the 🚟
2723+
feature (the "stackful" ABI), this restriction is lifted.
27222724
* 🔀 `callback` - the function has type `(func (param i32 i32 i32) (result i32))`
27232725
and cannot be present without `async` and is only allowed with
27242726
[`canon lift`](#canon-lift)
@@ -3086,6 +3088,7 @@ For a canonical definition:
30863088
validation specifies:
30873089
* `$rt` must refer to resource type
30883090
* `$f` is given type `(func (param i32))`
3091+
* 🔀+🚝 - `async` is allowed (otherwise it is not allowed)
30893092

30903093
Calling `$f` invokes the following function, which removes the handle from the
30913094
current component instance's `resources` table and, if the handle was owning,
@@ -3271,6 +3274,7 @@ For a canonical definition:
32713274
```
32723275
validation specifies:
32733276
* `$f` is given type `(func)`
3277+
* 🚟 - `async` is allowed (otherwise it must be `false`)
32743278

32753279
Calling `$f` calls `Task.yield_` to allow other tasks to execute:
32763280
```python
@@ -3317,6 +3321,7 @@ For a canonical definition:
33173321
```
33183322
validation specifies:
33193323
* `$f` is given type `(func (param $si) (param $ptr i32) (result i32))`
3324+
* 🚟 - `async` is allowed (otherwise it must be `false`)
33203325

33213326
Calling `$f` invokes the following function which waits for progress to be made
33223327
on a waitable in the given waitable set (indicated by index `$si`) and then
@@ -3361,6 +3366,7 @@ For a canonical definition:
33613366
```
33623367
validation specifies:
33633368
* `$f` is given type `(func (param $si i32) (param $ptr i32) (result i32))`
3369+
* 🚟 - `async` is allowed (otherwise it must be `false`)
33643370

33653371
Calling `$f` invokes the following function, which returns `NONE` (`0`) instead
33663372
of blocking if there is no event available, and otherwise returns the event the
@@ -3626,6 +3632,7 @@ For canonical definitions:
36263632
```
36273633
validation specifies:
36283634
* `$f` is given type `(func (param i32) (result i32))`
3635+
* 🚝 - `async` is allowed (otherwise it must be `false`)
36293636

36303637
The implementation of these four built-ins all funnel down to a single
36313638
parameterized `cancel_copy` function:

design/mvp/Explainer.md

+2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ implemented, considered stable and included in a future milestone:
5050
* 🪙: value imports/exports and component-level start function
5151
* 🪺: nested namespaces and packages in import/export names
5252
* 🔀: async
53+
* 🚝: marking some builtins as `async`
54+
* 🚟: using `async` with `canon lift` without `callback` (stackful lift)
5355
* 🧵: threading built-ins
5456
* 🔧: fixed-length lists
5557

0 commit comments

Comments
 (0)