Fix witty export of functions with 16 parameters second attempt #2530
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
This is a second attempt to fix the issue, the first one (#2429) blocked publishing new crate versions because it depended on a fix that was upstreamed to
wasmtime
, but hadn't been included in a release yet. To remove the blocker it was reverted (by #2435) but now the newly released version 25.0.0 ofwasmtime
includes the fix that's needed.When exporting functions with a specific signature type (with parameters that are flattened to exactly 16 flat types and with a return type that flattens to more than one flat type) to a Wasm instance, Witty's
#[wit_export]
macro would incorrectly lower all parameters and return types to the type.This is different from what was specified in the specification.
Proposal
Don't lower the parameters of functions if they can be flattened into 16 flat types, even if the return type is lowered into the heap.
Test Plan
Ran tests manually to ensure that the
test_memory_run_application_with_dependency
passes without the dummy parameter that was introduced previously as a workaround before this fix.Release Plan
Links