Skip to content

Conversation

@alexcrichton
Copy link
Member

This commit refactors the component/func/host.rs file to deduplicate the paths between static/dynamic host functions. Previously there was a significant amount of duplication between the two which has been exacerbated through time. This commit refactors the state of affairs to ensure that all the shared logic between the two is in one location and the only difference is what they're already doing different (e.g. lifting/lowering guts).

The high-level goal here was to see if this was possible, but in the end this feels like a much cleaner state of affairs than prior as far fewer details are duplicated across a few locations. The host function behavior is slightly more "dynamic" than before in the sense that statically-known signature has a few more type lookups than before, for example, but this can be fixed in due time if necessary.

This commit refactors the `component/func/host.rs` file to deduplicate
the paths between static/dynamic host functions. Previously there was a
significant amount of duplication between the two which has been
exacerbated through time. This commit refactors the state of affairs to
ensure that all the shared logic between the two is in one location and
the only difference is what they're already doing different (e.g.
lifting/lowering guts).

The high-level goal here was to see if this was possible, but in the end
this feels like a much cleaner state of affairs than prior as far fewer
details are duplicated across a few locations. The host function
behavior is slightly more "dynamic" than before in the sense that
statically-known signature has a few more type lookups than before, for
example, but this can be fixed in due time if necessary.
@alexcrichton alexcrichton requested a review from a team as a code owner December 10, 2025 02:25
@alexcrichton alexcrichton requested review from fitzgen and removed request for a team December 10, 2025 02:25
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 10, 2025
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@fitzgen fitzgen added this pull request to the merge queue Dec 11, 2025
Merged via the queue into bytecodealliance:main with commit 05a711f Dec 11, 2025
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants