Skip to content

feat: sub-word memory ops, memory.size/grow, compilation chain artifacts#57

Merged
avrabe merged 1 commit intomainfrom
feat/subword-memory-chain-artifacts
Mar 21, 2026
Merged

feat: sub-word memory ops, memory.size/grow, compilation chain artifacts#57
avrabe merged 1 commit intomainfrom
feat/subword-memory-chain-artifacts

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Mar 20, 2026

Summary

Sub-word Memory Operations (15 new WASM opcodes)

  • i32: load8_s/u, load16_s/u, store8, store16 → LDRB/LDRSB/LDRH/LDRSH/STRB/STRH
  • i64: load8_s/u, load16_s/u, load32_s/u, store8, store16, store32 → register pair handling
  • Thumb-2 narrow (16-bit) encoding for low registers + small offsets, wide (32-bit) otherwise
  • Bounds checking works uniformly across all sub-word ops (Software/Masking/None)

memory.size / memory.grow

  • memory.size: LSR R10, #16 (R10 = memory bytes, divide by 65536 for pages)
  • memory.grow: returns -1 on embedded (fixed memory, cannot grow)

Compilation Chain Rivet Artifacts (40+ artifacts across 4 files)

  • compilation-chain.yaml (CC-001..008): Full pipeline — WASM Component → Meld fuse → Synth AOT → link with kiln-builtins.a → firmware.elf → Cortex-M
  • kiln-builtins-api.yaml (KB-001..005, KB-TR-001..005): __meld_dispatch_import C ABI, per-import symbols, cabi_realloc, .meld_import_table format
  • static-linking.yaml (SL-001..007, SL-TR-001..003): ARM cross-toolchain (Create ARM cross-compilation toolchain #27), linker scripts, symbol resolution, memory layout
  • e2e-verification.yaml (E2E-VER-001..010): PoC through component round-trip verification plan

802 tests (up from 766)

Test plan

  • cargo test --workspace — 802 tests, 0 failures
  • cargo clippy --workspace --all-targets -- -D warnings — clean
  • cargo fmt --check — clean
  • rivet validate — 0 local errors (25 expected external cross-ref errors)

🤖 Generated with Claude Code

Sub-word loads/stores (15 new WASM opcodes):
- i32: load8_s/u, load16_s/u, store8, store16
- i64: load8_s/u, load16_s/u, load32_s/u, store8, store16, store32
- ARM encoding: LDRB/LDRSB/LDRH/LDRSH/STRB/STRH with Thumb-2 narrow/wide
- Bounds checking works uniformly across all sub-word operations
- 42 new tests (decoder, instruction selector, encoder)

memory.size / memory.grow:
- memory.size: LSR R10, #16 (R10 = memory bytes, /65536 for pages)
- memory.grow: returns -1 on embedded (fixed memory cannot grow)

Compilation chain rivet artifacts (4 new files, 40+ artifacts):
- compilation-chain.yaml: CC-001..008 — full pipeline stages
- kiln-builtins-api.yaml: KB-001..005, KB-TR-001..005 — C ABI bridge
- static-linking.yaml: SL-001..007, SL-TR-001..003 — linker requirements
- e2e-verification.yaml: E2E-VER-001..010 — end-to-end test plan

802 tests (up from 766), clippy clean, fmt clean.

Implements: FR-002
Implements: FR-003
Trace: skip

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit b12d743 into main Mar 21, 2026
6 checks passed
@avrabe avrabe deleted the feat/subword-memory-chain-artifacts branch March 21, 2026 05:00
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