Skip to content
This repository was archived by the owner on Apr 25, 2025. It is now read-only.
This repository was archived by the owner on Apr 25, 2025. It is now read-only.

Multi-Memory Lowering & Memory Imports #35

@ashleynh

Description

@ashleynh

The wasm-split tool was recently updated to support writing instrumentation data to a separate, secondary memory. With the addition of the multi-memory lowering pass in Binaryen, we attempted to simplify the wasm-split tool to instrument only with secondary memory and ran into a problem. After wasm-split creates the second memory, the lowering pass combines the memories into one, creating a single memory that adds the page sizes of all memories together. This is a problem when the main memory is imported from Javascript, as the memory size accessed during instantiation needs to increase for a split module. We don’t have a heuristic for knowing whether the module is split before the instance is created.

In general, creating the lowering pass for multi-memories has been difficult as there are problems without great solutions. For example, how should independent memories that are imports or exports be represented in a single combined memory. Similarly, how do we adjust non-Const data segment offsets for data segments that belong to a memory other than the first? It would be far simpler from a tooling perspective for browsers to add support for multi-memory.

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