Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Witty export of functions with 16 parameters #2429

Merged

Conversation

jvff
Copy link
Contributor

@jvff jvff commented Aug 30, 2024

Motivation

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

  • Need to bump the major/minor version number in the next release of the crates.
  • Need to update the developer manual.
  • This PR is adding or removing Cargo features.
  • Release is blocked and/or tracked by other issues (see links below)

Links

Instead of manually creating the very deeply nested type.
@jvff jvff added the bug Something isn't working label Aug 30, 2024
@jvff jvff added this to the Testnet #1 milestone Aug 30, 2024
@jvff jvff self-assigned this Aug 30, 2024
Allow usage of 17 parameters with typed exported functions.
Keep them as flat parameters instead, even if the return type needs to
be lowered as well.
They were added to work-around the issue with function parameters that
flattened to 16 flat types, and with the fix they are no longer needed.
@jvff jvff force-pushed the fix-witty-export-of-functions-with-16-parameters branch from d8d341c to e502be5 Compare August 30, 2024 20:48
@@ -159,7 +159,7 @@ wasm-instrument = "0.4.0"
wasmer = { package = "linera-wasmer", version = "4.3.6-linera.3", default-features = false }
wasmer-compiler-singlepass = { package = "linera-wasmer-compiler-singlepass", version = "4.3.6-linera.3" }
wasmparser = "0.101.1"
wasmtime = "24.0.0"
wasmtime = { git = "https://github.com/bytecodealliance/wasmtime", rev = "58f82587462543e912b4edcbb247842711ba6415" }
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The fix we need hasn't been released yet. I added a TODO to update this once a release is available (they tend to release often, so hopefully soon).

Instead of pinning to the commit with the necessary fix.
@jvff jvff merged commit be15a4c into linera-io:main Aug 31, 2024
5 checks passed
jvff added a commit that referenced this pull request Aug 31, 2024
ma2bd pushed a commit that referenced this pull request Aug 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Don't move parameters to heap if there are exactly 16 of them
2 participants