Skip to content

Option to assume zero-filled imported memory #2026

Closed
@aduros

Description

@aduros

When using memory.data() with --importMemory the actual zero-filled data ends up in the output wasm.

const buffer = memory.data(65535);
(data (;0;) (i32.const 1024) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00...

This makes perfect sense from a safety standpoint, since we can't assume the state of imported memory. However, it can lead to some pretty huge binaries. In my use case I'm importing memory, but everything after --memoryBase is guaranteed to be initialized to zero. wasm-opt has a --zero-filled-memory option for this, it would be really nice if it was exposed via an option to asc?

Thanks for the project and considering 😄

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions