Skip to content

Commit

Permalink
'post-return' is invalid in combination with 'async'
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewagner committed Jan 15, 2025
1 parent 66c5c49 commit b9376b8
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 @@ -2515,6 +2515,7 @@ async def canon_lift(opts, inst, ft, callee, caller, on_start, on_return, on_blo
if opts.post_return is not None:
[] = await call_and_trap_on_throw(opts.post_return, task, flat_results)
else:
assert(not opts.post_return)
if not opts.callback:
[] = await call_and_trap_on_throw(callee, task, flat_args)
assert(types_match_values(flat_ft.results, []))
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 b9376b8

Please sign in to comment.