Skip to content

Conversation

@dicej
Copy link
Contributor

@dicej dicej commented Dec 23, 2025

Previously, we generated a generic unreachable instruction for each trap in a fused adapter, plus some metadata to recover the specific kind of trap. However, that metadata was never hooked up to anything, so we only got a generic unreachable message at runtime.

This commit removes the metadata tracking and instead simply calls a host intrinsic, passing the trap code as a parameter. This is somewhate pessimal compared with what we had before, but improves ergonomics and allows us to avoid forking as many tests from the component-model repo.

If performance becomes an issue, we can easily add an option to skip the host call and only emit an unreachable instruction as before.

Note that I've removed forked versions of three tests in favor of their upstream equivalents.

Fixes #11683

Previously, we generated a generic `unreachable` instruction for each trap in a
fused adapter, plus some metadata to recover the specific kind of trap.
However, that metadata was never hooked up to anything, so we only got a generic
`unreachable` message at runtime.

This commit removes the metadata tracking and instead simply calls a host
intrinsic, passing the trap code as a parameter.  This is somewhate pessimal
compared with what we had before, but improves ergonomics and allows us to avoid
forking as many tests from the component-model repo.

If performance becomes an issue, we can easily add an option to skip the host
call and only emit an `unreachable` instruction as before.

Note that I've removed forked versions of three tests in favor of their upstream
equivalents.

Fixes bytecodealliance#11683
@dicej dicej requested a review from alexcrichton December 23, 2025 18:27
@dicej dicej requested review from a team as code owners December 23, 2025 18:27
@github-actions github-actions bot added the wasmtime:api Related to the API of the `wasmtime` crate itself label Dec 23, 2025
@dicej dicej enabled auto-merge December 23, 2025 20:45
@dicej dicej added this pull request to the merge queue Dec 23, 2025
Merged via the queue into bytecodealliance:main with commit 967f460 Dec 23, 2025
45 checks passed
@dicej dicej deleted the fix-11683 branch December 23, 2025 21:23
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.

generate precise traps in fused component adapters

2 participants