Skip to content

fix(parser): correct multi-memory memarg field ordering#156

Merged
avrabe merged 1 commit intomainfrom
fix/memarg-encoding-order
Mar 15, 2026
Merged

fix(parser): correct multi-memory memarg field ordering#156
avrabe merged 1 commit intomainfrom
fix/memarg-encoding-order

Conversation

@avrabe
Copy link
Collaborator

@avrabe avrabe commented Mar 15, 2026

Summary

  • Fix memarg binary encoding order: the multi-memory proposal encodes fields as align, memidx?, offset — we were reading align, offset, memidx?
  • This caused all multi-memory modules to fail with misaligned bytecode parsing
  • Fixes ~275 WAST test assertions (address0.wast, address1.wast now fully pass)

Test plan

  • address0.wast: 0/92 → 92/92 passing
  • address1.wast: 0/127 → 127/127 passing
  • Full WAST suite: 62,351 → 62,626 passing (95.4%)

Trace: skip

🤖 Generated with Claude Code

@github-actions
Copy link

github-actions bot commented Mar 15, 2026

🔍 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

The multi-memory proposal encodes memarg as: align, memidx?, offset.
The previous implementation incorrectly read offset before memidx,
causing all multi-memory modules (address0.wast, address1.wast, etc.)
to fail with "Unknown instruction opcode" due to misaligned bytecode
parsing.

Fixes ~275 WAST test assertions (62,351 → 62,626 passing).

Trace: skip

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe force-pushed the fix/memarg-encoding-order branch from 5259959 to 18f44d7 Compare March 15, 2026 11:55
@avrabe avrabe merged commit c7aba43 into main Mar 15, 2026
13 checks passed
@avrabe avrabe deleted the fix/memarg-encoding-order branch March 15, 2026 11:55
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