Skip to content

Add Memory64 support (WASM 3.0) #132

@avrabe

Description

@avrabe

Summary

WRT references WASM 3.0 but doesn't support Memory64 yet. The testsuite has memory64 tests that will fail.

Current State

  • Type system: Limits.memory64 field exists but unused at runtime
  • Runtime: All memory addresses use u32 (casts like Value::I32(addr) => *addr as u32)
  • Tests: memory64.wast, load64.wast, etc. exist in testsuite

Implementation Approach

Use u64 for all memory addresses:

  • Simple, consistent implementation
  • Modern 64-bit CPUs handle u64 as efficiently as u32
  • No branching overhead from address type checking
  • Truncate to u32 only at boundary when writing to 32-bit memories

Tasks

  1. Update MemoryLoad/MemoryStore to use u64 addresses
  2. Add Value::I64 address handling in memory operations
  3. Update memory.size/memory.grow for 64-bit memories
  4. Update bulk memory operations (copy, fill, init)
  5. Enable memory64 WAST tests

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions