Skip to content

fix: give each host function parameter its core wasm width - #234

Open
robfischer1 wants to merge 1 commit into
arcjet:mainfrom
robfischer1:host-param-widths
Open

robfischer1 wants to merge 1 commit into
arcjet:mainfrom
robfischer1:host-param-widths

Conversation

@robfischer1

Copy link
Copy Markdown

generate_host_function_builder declared every lifted parameter of a host import as uint32. 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:

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 parameter to the Go type wazero pairs with it.

Tests:

  • imports::tests::test_import_params_take_their_core_wasm_width
  • The import-param-widths example, at the min and max of every width

🤖 Generated with Claude Code

https://claude.ai/code/session_01K99bnsYaj3w4MMWSF5hTMu

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>
@robfischer1
robfischer1 requested a review from a team as a code owner October 7, 2026 14:25
@arcjet-review arcjet-review Bot added needs review Awaiting human review and removed needs review Awaiting human review labels Oct 7, 2026
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.

1 participant