Repository navigation
fix: give each host function parameter its core wasm width - #234
Open
robfischer1 wants to merge 1 commit into
Open
robfischer1 wants to merge 1 commit into
robfischer1 wants to merge 1 commit into
Conversation
generate_host_function_builder declared every lifted parameter of a
host import uint32. wazero derives the host function's wasm signature
from the Go one, so a u64/s64 (i64), f32 or f64 parameter either did not
compile — the import side passes floats through as Go floats:
cannot use result2 (variable of type uint32) as float32 value in argument to host.Wide
— or, where a conversion hid the mismatch, linked a signature the guest
never imported. host_param_type maps each core wasm parameter to the Go
type wazero pairs with it (i32/pointer/length: uint32; i64 and the
pointer-or-i64 join: uint64; f32: float32; f64: float64), and the builder
asserts one Go parameter per core parameter.
Tests: imports::tests::test_import_params_take_their_core_wasm_width
(fails without the fix) and the new import-param-widths example
(TestWideImportParams at the min/max of every width,
TestOptionS64ImportParam; without the fix its bindings do not compile).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
generate_host_function_builderdeclared every lifted parameter of a host import asuint32. wazero derives the host function's wasm signature from the Go one. A u64/s64 (i64), f32 or f64 parameter therefore either failed to compile:or, where a conversion hid the mismatch, linked a signature the guest never imported.
host_param_typemaps each core parameter to the Go type wazero pairs with it.Tests:
imports::tests::test_import_params_take_their_core_wasm_widthimport-param-widthsexample, at the min and max of every width🤖 Generated with Claude Code
https://claude.ai/code/session_01K99bnsYaj3w4MMWSF5hTMu