Skip to content

chore(deps): bump the wasm-tools family to 0.263, decoding memargs as 0.262 did - #1707

Merged
avrabe merged 1 commit into
mainfrom
v091-wasmtools
Nov 12, 2026
Merged

avrabe merged 1 commit into
mainfrom
v091-wasmtools

Conversation

@avrabe

@avrabe avrabe commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Refs #1649

This moves the wasm-tools family from 0.262 to 0.263: wasmparser, wasm-encoder, wit-parser and wit-component go to 0.263, wat to 1.263, and wast to 263.0. The bump is a cargo update -p of those crates plus wasm-metadata. The resulting Cargo.lock delta is the same as dependabot's. One change goes beyond #1649: the wat requirement is raised to 1.263, which dependabot left at 1.262. The lock resolves 1.263.0 either way.

API breaks (both in synth-core)

Site Break Fix
arena_bind.rs (allocator body) wasm_encoder::MemArg replaced memory_index with target: MemArgTarget and added ordering target: MemArgTarget::Memory(0), ordering: None. This encodes the same bytes as memory_index: 0.
wasm_decoder.rs (memarg helper) wasmparser::MemArg replaced memory: u32 with target: MemArgTarget::{Memory(u32), Array(u32)} The helper is renamed memarg_target. A Memory(k > 0) target is wrapped in MultiMemory as before. An Array target (a GC array payload) loud-skips the function instead of being lowered as a linear-memory access.

A semantic change that this PR switches off

Parser::new enables WasmFeatures::all(). In 0.263 that set gained two in-flight proposals, acquire-release-atomics and multibyte-array-access. Both give new meanings to memarg flag bits 4 and 5, which 0.262, and the standard wasm 3.0 encoding, read as part of the alignment exponent.

Six hand-built probe modules showed the bumped decoder diverging from base 617e440:

  • Flags 0x12 and 0x32 became a hard Failed to decode error.
  • Flags 0x20 and 0x22 consumed an extra LEB as an array type index, then loud-skipped the function.

The decoder now parses through decode_parser(), which removes those two features. All six probes are byte-identical to base again. Synth lowers neither proposal. The Array arm above is therefore unreachable today and stays only as a defence.

Two synth-core unit tests, memarg_bit{4,5}_is_alignment_*_1649, pin the 0.262 reading of flags 0x12 and 0x22. Paired control: with decode_parser() reverted to the default feature set, both tests fail.

These probes are invalid wasm (an alignment larger than natural), and base accepts them. That is the existing invalid-accept class, and this PR leaves it unchanged.

Evidence: base 617e440 vs this branch, both built with default features (riscv)

  • Byte-identity census. 554 inputs (tests/**, scripts/repro, examples, plus the 257 top-level spec .wast files) × 8 configs give 4432 pairs. The configs are cortex-m4, cortex-m7dp, cortex-m4 --relocatable, the same with --debug-line, cortex-m4 --safety-bounds software, cortex-r5, riscv rv32imac and aarch64.
    • 1792 pairs produce byte-identical objects.
    • 2516 pairs are refusals with the same rc and the same diagnostics.
    • 124 pairs have identical rc and output files but different diagnostic text, in 16 simd_*.wast files. In each case the change is MemArg's Debug output inside an unsupported-op warning: memory: 0 } became target: Memory(0), ordering: None }. After applying that one substitution, 0 differences remain. spec_compile_census.py pins all 257 spec files and passes on the branch.
    • The census was rerun with --allow-skipped-exports, so a module with a declined export still emits an object. That run has 2208 byte-identical objects, 2100 identical refusals, and the same 124 pairs that differ in text only.
  • Validation-acceptance parity. The census gives the same rc on all 4432 pairs. The six memarg-flag probes also match base in rc and output sha256.
  • dissolve: bind passed-through embedder import cabi-arena-realloc to the native TCB arena allocator #418 arena-bind. allocator_body is the only site whose emitted bytes this change touches. cabi_arena_bind_418_differential.py passes on base and on the branch with identical logs. Its compile output is byte-identical: the ELF sha256 matches.
  • Spec execution oracle (scripts/repro/spec_exec_1636_differential.py). It passes on both binaries: 35676 directives executed, 11634 on cortex-m4 and 24042 on cortex-m7dp. There are 53 failures, all exact baseline entries. The per-directive --json ledgers of base and branch are byte-identical.
  • Builds and tests.
    • cargo fmt --check and cargo clippy --workspace --all-targets -- -D warnings pass.
    • cargo test --workspace --no-fail-fast: 3271 passed, 0 failed. That run predates the two new tests; after adding them, the synth-core lib tests pass 253 of 253.
    • --features riscv (async_intrinsics_gate): 2 passed. -p synth-cli --features verify: 479 passed. -p synth-verify --features z3-solver,arm: 278 passed.
  • Claim Check. All 55 steps of the Claim Check job, run locally: 0 failures.
  • Pins. scripts/check_version_pins.py passes. Bazel resolves crates from Cargo.lock (crate.from_cargo), so neither MODULE.bazel nor crates/BUILD.bazel pins these crates. MODULE.bazel.lock is not kept in sync with crate bumps: the 0.262 bump (chore(deps): bump the wasm-tools family to 0.262 #1591) did not touch it either, so this PR leaves it alone.

Rebased onto 5dc4e28

The evidence above was measured on base 617e440. On base 60170da (after #1697, #1702 and #1705) the branch was re-checked: cargo fmt --check, clippy clean, cargo test --workspace --no-fail-fast 3299 passed / 0 failed, Claim Check 55/55, and the spec-suite workflow steps (compile census PASS on all five backends, #1225 PASS, #1441 PASS, spec execution #1636 PASS: 35715 directives, baseline 54/54).

It was then rebased onto 5dc4e28, which adds only [profile.dev.package.ordeal*] to Cargo.toml (#1706) in a hunk disjoint from this one. On that head only cargo metadata --locked and cargo fmt --check were run locally, because the host was out of disk; CI is the full check for this head.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L

… 0.262 did

Moves wasmparser, wasm-encoder, wit-parser, wit-component (0.262 -> 0.263),
wat (1.262 -> 1.263) and wast (262.0 -> 263.0) together in the workspace
Cargo.toml, with a targeted `cargo update -p` of the family (plus its
wasm-metadata companion). The Cargo.lock delta equals dependabot's. The wat
requirement is raised to 1.263 as well, which dependabot left at 1.262; the
lock resolves 1.263.0 either way.

API breaks, both in synth-core:
- wasm_encoder::MemArg replaced `memory_index: u32` with
  `target: MemArgTarget` and added `ordering: Option<MemArgOrdering>`.
  arena_bind's allocator body now builds `target: Memory(0), ordering: None`,
  which encodes the same bytes as `memory_index: 0`.
- wasmparser::MemArg replaced `memory: u32` with `target: MemArgTarget`
  (`Memory(u32)` or the new `Array(u32)`, a GC array type). The decoder's
  memarg helper is renamed memarg_target and returns the target; a
  `Memory(k > 0)` op is wrapped in MultiMemory as before, and an `Array`
  target loud-skips the function instead of being lowered as a
  linear-memory access.

Semantic change, neutralised: Parser::new enables WasmFeatures::all(), and
0.263 added acquire-release-atomics and multibyte-array-access to it. Both
reassign memarg flag bits 4 and 5, which 0.262 (and the standard encoding)
read as alignment. A hand-built probe set showed the branch decoding
differently from base: flags 0x12 and 0x32 became a hard decode error, and
flags 0x20/0x22 consumed an extra LEB as an array type index and
loud-skipped the function. The decoder now parses with those two features
removed (decode_parser), and all six probes are byte-identical to base
again. Synth lowers neither proposal. Two synth-core unit tests pin the
0.262 reading of flags 0x12 and 0x22. Paired control: with decode_parser
reverted to the default feature set, both tests fail.

Evidence, base 617e440 vs this branch, both built with default features:
- Census: 554 inputs (tests/**, scripts/repro, examples, and the 257
  top-level spec .wast files) x 8 configs (cortex-m4, cortex-m7dp, cortex-m4
  --relocatable, the same plus --debug-line, cortex-m4 --safety-bounds
  software, cortex-r5, riscv rv32imac, aarch64) = 4432 pairs. 1792 have
  byte-identical outputs, and 2516 refusals have the same rc and output. The
  other 124 have identical rc and output files, and their diagnostic text
  differs only because MemArg's Debug output changed (`memory: 0 }` became
  `target: Memory(0), ordering: None }`) in the unsupported-op warnings of 16
  simd_*.wast files. Applying that one substitution leaves 0 differences.
  The census was rerun with --allow-skipped-exports, so a module with a
  declined export still emits an object: 2208 objects are byte-identical,
  2100 refusals are identical, and the same 124 pairs differ in text only.
- The #418 arena-bind path is the only site whose emitted bytes this change
  touches. The cabi_arena_bind_418 execution oracle passes on base and on
  the branch, with identical logs, and its compile output is byte-identical
  (the ELF sha256 matches).
- The spec_compile_census.py pins pass.
- Spec execution oracle (spec_exec_1636_differential.py): PASS on both
  binaries, 35676 directives executed (cortex-m4 11634, cortex-m7dp 24042),
  53 failures, all exact baseline entries. The per-directive --json ledgers
  of base and branch are byte-identical.
- fmt, clippy -D warnings, cargo test --workspace (3271 passed, 0 failed, before the two
  tests were added; synth-core lib 253 passed after),
  the riscv, verify and z3-solver,arm feature sets, and
  check_version_pins.py all pass.

Refs #1649

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
@codecov

codecov Bot commented Nov 12, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.23077% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/synth-core/src/wasm_decoder.rs 88.88% 7 Missing ⚠️

📢 Thoughts on this report? Let us know!

@avrabe
avrabe merged commit b705cdd into main Nov 12, 2026
80 of 81 checks passed
@avrabe
avrabe deleted the v091-wasmtools branch November 12, 2026 15:18
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