Skip to content

Don't duplicate instruction encodings in wast - #2679

Merged
alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:lses-duplicate-instruction-encodings
Sep 28, 2026
Merged

alexcrichton merged 1 commit into
bytecodealliance:mainfrom
alexcrichton:lses-duplicate-instruction-encodings

Conversation

@alexcrichton

Copy link
Copy Markdown
Member

This commit resolves a longstanding issue where instruction encodings in the wasm-encoder crate are duplicated in the wast crate. This dates back to where wast came before wasm-encoder, but nowadays it's just duplication that's a bit onerous to maintain. This commit refactors the macro here to be a bit wordier/un-idiomatic but delegates to wasm_encoder::InstructionSink for encoding all instructions. Most instructions fit in a pattern that don't need custom code, but a number of instructions are annotated with #[custom_encode] now to manually specify how the wast structures are translated to wasm-encoder arguments.

This commit resolves a longstanding issue where instruction encodings in
the `wasm-encoder` crate are duplicated in the `wast` crate. This dates
back to where `wast` came before `wasm-encoder`, but nowadays it's just
duplication that's a bit onerous to maintain. This commit refactors the
macro here to be a bit wordier/un-idiomatic but delegates to
`wasm_encoder::InstructionSink` for encoding all instructions. Most
instructions fit in a pattern that don't need custom code, but a number
of instructions are annotated with `#[custom_encode]` now to manually
specify how the `wast` structures are translated to `wasm-encoder`
arguments.
@alexcrichton
alexcrichton requested a review from a team as a code owner September 25, 2026 22:20
@alexcrichton
alexcrichton requested review from dicej and removed request for a team September 25, 2026 22:20
@alexcrichton
alexcrichton added this pull request to the merge queue Sep 28, 2026
Merged via the queue into bytecodealliance:main with commit 2a2236b Sep 28, 2026
37 checks passed
@alexcrichton
alexcrichton deleted the lses-duplicate-instruction-encodings branch September 28, 2026 17:33
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