Skip to content

Top-mem #1469

Open
Open
Top-mem#1469
@SoniEx2

Description

@SoniEx2

0 is valid as a pointer value in wasm. top-mem would make it invalid.

top-mem simply makes the memory grow downwards from UINT_MAX down to 0. so a 64kB memory goes from UINT_MAX-65535 to UINT_MAX (inclusive), and so on for increasingly bigger memories.

(it is a shame that C and C++ decided 0 was the best way to represent NULL, instead of using -1 which would fault on all major architectures for bigger-than-byte reads. at least we can workaround the issue in wasm.)

Interaction with JS

JS's view of a wasm memory should respect top-mem. that way pointers don't need to be converted/adjusted by JS before indexing the memory.

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