Skip to content

fix(decoder): element segment and SIMD instruction parsing (#150)#170

Merged
avrabe merged 2 commits intomainfrom
fix/stream-b-runtime-execution
Mar 21, 2026
Merged

fix(decoder): element segment and SIMD instruction parsing (#150)#170
avrabe merged 2 commits intomainfrom
fix/stream-b-runtime-execution

Conversation

@avrabe
Copy link
Collaborator

@avrabe avrabe commented Mar 20, 2026

Summary

  • Element segment flags 1/3: Use elemkind (0x00) instead of reftype encoding — per WebAssembly spec, flags 1 and 3 use elemkind, not reftype
  • SIMD load/store lane: Add lane byte to memarg parsing for v128.loadN_lane (84-87) and v128.storeN_lane (88-91) — missing byte caused cascading Truncated LEB128 errors

Impact

Baseline: 64,068 pass / 1,574 fail
After: 65,113 pass / 529 fail (+1,045 assertions fixed, -66% failures)

Fix Assertions Fixed
Element segment elemkind 429
SIMD lane byte 616
Total 1,045

Test plan

  • cargo check -p kiln-decoder — clean compile
  • Full WAST suite: 65,113 pass / 529 fail
  • select.wast: 176/176 pass (was 51/176)
  • CI passes

🤖 Generated with Claude Code

avrabe and others added 2 commits March 19, 2026 22:38
…eftype

Per WebAssembly spec, element segment flags 1 and 3 use elemkind encoding
(0x00 = funcref), not reftype encoding (0x70 = funcref). The decoder was
incorrectly matching against reftype bytes, causing modules with
(elem declare func ...) to fail with "malformed reference type".

Also adds 0x63/0x64 (ref null/ref) encoding support to flags 5, 6, 7
element segment reftype parsing for GC proposal compatibility.

Fixes 429 WAST assertion failures (64,068 → 64,497 passing).

Trace: skip
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The code body LEB128 validator treated v128.loadN_lane (84-87) and
v128.storeN_lane (88-91) the same as plain v128.load ops, missing the
trailing lane index byte. This caused the parser to go out of sync with
the byte stream, cascading into Truncated LEB128 errors for entire
SIMD-heavy modules.

Fixes 616 additional WAST assertions (64,497 → 65,113 passing).

Trace: skip
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link

🔍 Build Diagnostics Report

Summary

Metric Base Branch This PR Change
Errors 0 0 0
Warnings 2 2 0

🎯 Impact Analysis

Issues in Files You Modified

  • 0 new errors introduced by your changes
  • 0 new warnings introduced by your changes
  • 0 total errors in modified files
  • 0 total warnings in modified files
  • 0 files you modified

Cascading Issues (Your Changes Breaking Other Files)

  • 0 new errors in unchanged files
  • 0 new warnings in unchanged files
  • 0 unchanged files now affected

Note: "Cascading issues" are errors in files you didn't modify, caused by your changes (e.g., breaking API changes, dependency issues).

✅ No Issues Detected

Perfect! Your changes don't introduce any new errors or warnings, and don't break any existing code.


📊 Full diagnostic data available in workflow artifacts

🔧 To reproduce locally:

# Install cargo-kiln
cargo install --path cargo-kiln

# Analyze your changes
cargo-kiln build --output json --filter-severity error
cargo-kiln check --output json --filter-severity warning

@avrabe avrabe merged commit 964edf7 into main Mar 21, 2026
16 checks passed
@avrabe avrabe deleted the fix/stream-b-runtime-execution branch March 21, 2026 04:57
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