Skip to content

Commit

Permalink
Merge pull request #439 from WebAssembly/post-return
Browse files Browse the repository at this point in the history
Add explicit note about 'post-return' being invalid in combination with 'async'
  • Loading branch information
dicej authored Jan 15, 2025
2 parents 66c5c49 + e819b99 commit b87bcf4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 1 addition & 0 deletions design/mvp/CanonicalABI.md
Original file line number Diff line number Diff line change
Expand Up @@ -2466,6 +2466,7 @@ validation specifies:
* `$f` is given type `$ft`
* a `memory` is present if required by lifting and is a subtype of `(memory 1)`
* a `realloc` is present if required by lifting and has type `(func (param i32 i32 i32 i32) (result i32))`
* if `async` is set, a `post-return` function may not be set
* if a `post-return` is present, it has type `(func (param flatten_functype({}, $ft, 'lift').results))`

When instantiating component instance `$inst`:
Expand Down
16 changes: 8 additions & 8 deletions design/mvp/Explainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -1288,20 +1288,20 @@ The Canonical ABI will use `realloc` both to allocate (passing `0` for the
first two parameters) and reallocate. If the Canonical ABI needs `realloc`,
validation requires this option to be present (there is no default).

The `(post-return ...)` option may only be present in `canon lift`
and specifies a core function to be called with the original return values
after they have finished being read, allowing memory to be deallocated and
destructors called. This immediate is always optional but, if present, is
validated to have parameters matching the callee's return type and empty
results.
The `(post-return ...)` option may only be present in `canon lift` when
`async` is not present and specifies a core function to be called with the
original return values after they have finished being read, allowing memory to
be deallocated and destructors called. This immediate is always optional but,
if present, is validated to have parameters matching the callee's return type
and empty results.

🔀 The `async` option specifies that the component wants to make (for imports)
or support (for exports) multiple concurrent (asynchronous) calls. This option
can be applied to any component-level function type and changes the derived
Canonical ABI significantly. See the [async explainer](Async.md) for more
details. When a function signature contains a `future` or `stream`, validation
requires the `async` option to be set (since a synchronous call to a function
using these types is highly likely to deadlock).
of `canon lower` requires the `async` option to be set (since a synchronous
call to a function using these types is highly likely to deadlock).

🔀 The `(callback ...)` option may only be present in `canon lift` when the
`async` option has also been set and specifies a core function that is
Expand Down

0 comments on commit b87bcf4

Please sign in to comment.