Skip to content

Conversation

@alexcrichton
Copy link
Member

There was some preexisting duplication between Func-related constructors and Linker-related constructors. This consolidates everything into HostFunc which duplicates type signatures a bit more but complexity-wise reduces the amount of internal duplication.

This additionally notably cuts down on usage of block_on literally, if not conceptually, which is going to eventually be important for rationalizing it with *_concurrent functions.

There was some preexisting duplication between `Func`-related
constructors and `Linker`-related constructors. This consolidates
everything into `HostFunc` which duplicates type signatures a bit more
but complexity-wise reduces the amount of internal duplication.

This additionally notably cuts down on usage of `block_on` literally, if
not conceptually, which is going to eventually be important for
rationalizing it with `*_concurrent` functions.
@alexcrichton alexcrichton requested a review from a team as a code owner January 16, 2026 20:44
@alexcrichton alexcrichton requested review from dicej and removed request for a team January 16, 2026 20:44
ty: FuncType,
func: impl Fn(Caller<'_, T>, &mut [ValRaw]) -> Result<()> + Send + Sync + 'static,
) -> Self {
assert!(ty.comes_from_same_engine(store.as_context().engine()));
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this (and the other removed comes_from_same_engine assertions) no longer needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh still needed, but amongst the layers here this assert was happening at every layer so I deleted all the duplicate ones to delegate to the lowest-level layers to perform the assertion

@alexcrichton alexcrichton added this pull request to the merge queue Jan 16, 2026
Merged via the queue into bytecodealliance:main with commit 91bf501 Jan 16, 2026
45 checks passed
@alexcrichton alexcrichton deleted the refactor-some-async branch January 16, 2026 22:03
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.

2 participants