Skip to content

Option to assume zero-filled imported memory #2026

Closed

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 😄

Activity

  1. MaxGraey commented on Aug 10, 2021

    @MaxGraey
    Member

    Make sense. But first we have to provide public API for Binaryen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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

      ⌂ Proxy