Stream: git-wasmtime

Topic: wasmtime / issue #9169 Support typed functions with 17 pa...


view this post on Zulip Wasmtime GitHub notifications bot (Aug 23 2024 at 18:23):

jvff opened issue #9169:

Feature

WasmParams currently supports tuples with up to 16 elements. However, wit-bindgen may generate imports for functions with up to 17 parameters, in scenarios where there are 16 flat types used for parameters plus an extra pointer for the return heap area. This is (AFAICT) according to the Canonical ABI.

Benefit

This would allow using proper typing when exporting functions to Wasm modules following the WIT interface.

Implementation

I tested adding another line here:

https://github.com/bytecodealliance/wasmtime/blob/main/crates/wasmtime/src/runtime/func.rs#L356

and it seemed to work for my use case. I'm not sure if there are tests that need to be updated or if there's a better approach before opening a PR.

Alternatives

I think this could be worked around by not using typed parameters.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 23 2024 at 19:35):

alexcrichton commented on issue #9169:

Makes sense to me to add, feel free to send a PR!

view this post on Zulip Wasmtime GitHub notifications bot (Aug 23 2024 at 20:02):

alexcrichton closed issue #9169:

Feature

WasmParams currently supports tuples with up to 16 elements. However, wit-bindgen may generate imports for functions with up to 17 parameters, in scenarios where there are 16 flat types used for parameters plus an extra pointer for the return heap area. This is (AFAICT) according to the Canonical ABI.

Benefit

This would allow using proper typing when exporting functions to Wasm modules following the WIT interface.

Implementation

I tested adding another line here:

https://github.com/bytecodealliance/wasmtime/blob/main/crates/wasmtime/src/runtime/func.rs#L356

and it seemed to work for my use case. I'm not sure if there are tests that need to be updated or if there's a better approach before opening a PR.

Alternatives

I think this could be worked around by not using typed parameters.


Last updated: Dec 23 2024 at 12:05 UTC