Skip to content

Multi-memory structural isolation: lower N wasm memories to N distinct native bases (memidx-through-IR, cross-memory ops, expose base/size for MPU/PMP) #406

Description

@avrabe

Committed lowering path for the dissolved-library-OS isolation model. Cross-repo decision: meld#300 commits to model 2 (multi-memory structural isolation) — meld preserves each component's memory as a distinct region (MemoryStrategy::MultiMemory, tested in meld-core/tests/multi_memory.rs) so the MPU/PMP boundary is the semantic boundary. synth is the remaining gate.

Today (the gap)

synth is single-memory: the memory index is dropped at the IR level (wasm_op.rs load/store variants carry no memory_index), cross-memory memory.copy/memory.fill are loud-skipped (#369-adjacent, wasm_decoder.rs non-zero dst_mem/src_memNone), and the linear-memory base is a single hardcoded register (R11 = 0x20000000 / 0x20000100). MPU is config-only — mpu_allocator computes region base/size/permissions + init code but nothing is wired into the optimized codegen path (#377).

The work (staged, gated — byte-changing on the load/store path)

  1. Carry memidx through the IR — add memory_index to the load/store/memory.* WasmOp variants; stop dropping it in wasm_decoder.rs.
  2. Per-memory native bases — place memory[k] at a distinct base; common case pins the function's home memory base in R11 (≈ today's cost), cross-memory access resolves via a per-memory base/size table (synth_memory::MemoryTable, MAX_MEMORIES=8 already exists).
  3. Cross-memory ops — emit memory.copy/memory.fill with distinct dst_mem/src_mem explicitly instead of loud-skipping.
  4. Expose per-memory base/size — so an embedder programs one MPU/PMP region per memory (the mpu_allocator region machinery already computes base/size/perms; wire it from the per-memory layout — ties to --safety-bounds software/mpu are no-ops on the optimized codegen path (flight-safety: jess pins software for PX4) #377).

Constraints / gating

Tracked under the VCR-* north-star program (epic #242). Refs: gale#86, gale#404, meld#300, synth#377 (MPU runtime wiring), synth#369 (decoder loud-skip).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions