Skip to content

Conversation

@dicej
Copy link
Collaborator

@dicej dicej commented Nov 17, 2025

I had thought that the spec allowed an async lift to omit the memory canonopt if only the result type (and not the paarameter types) required it, leaving the core function free to call any task.return at runtime as long as the type and string encoding matched. Indeed, that's what we implemented in wasm-tools and Wasmtime.

However, it looks like I misremembered, since the spec uses an exact comparison in LiftOptions.equal. That's good news, because allowing the core function to call any of several task.return functions, each with a different memory, makes it hard for the runtime to optimize compositions.

So no actual change needed here -- just a clarification. We'll update wasm-tools and Wasmtime to match.

I had _thought_ that the spec allowed an async lift to omit the memory canonopt
if only the result type (and not the paarameter types) required it, leaving the
core function free to call any `task.return` at runtime as long as the type and
string encoding matched.  Indeed, that's what we implemented in `wasm-tools` and
Wasmtime.

However, it looks like I misremembered, since the spec uses an exact comparison
in `LiftOptions.equal`.  That's good news, because allowing the core function to
call any of several `task.return` functions, each with a different memory, makes
it hard for the runtime to optimize compositions.

So no actual change needed here -- just a clarification.  We'll update
`wasm-tools` and `Wasmtime` to match.

Signed-off-by: Joel Dice <[email protected]>
@dicej dicej requested a review from lukewagner November 17, 2025 20:27
dicej added a commit to dicej/wasm-tools that referenced this pull request Nov 17, 2025
Per WebAssembly/component-model#575, both `wasm-tools`
and Wasmtime have been too permissive, allowing async lifts to optionally omit a
memory canonopt if only the return type (and not the parameter types) would need
one.  This fixes validation to require the option in such cases.

Signed-off-by: Joel Dice <[email protected]>
github-merge-queue bot pushed a commit to bytecodealliance/wasm-tools that referenced this pull request Nov 17, 2025
* require memory for async lifts as needed

Per WebAssembly/component-model#575, both `wasm-tools`
and Wasmtime have been too permissive, allowing async lifts to optionally omit a
memory canonopt if only the return type (and not the parameter types) would need
one.  This fixes validation to require the option in such cases.

Signed-off-by: Joel Dice <[email protected]>

* Fix streams-and-futures test

Fixing a mistake from #2376

* add memory option to lifts when needed in wit-component

Signed-off-by: Joel Dice <[email protected]>

---------

Signed-off-by: Joel Dice <[email protected]>
Co-authored-by: Alex Crichton <[email protected]>
Copy link
Member

@lukewagner lukewagner left a comment

Choose a reason for hiding this comment

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

Thanks!

@lukewagner lukewagner merged commit c6ba212 into WebAssembly:main Nov 18, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants