Skip to content

Read-only tables (and memories) #1278

Open
@lars-t-hansen

Description

@lars-t-hansen

Some of us were discussing alias analysis for a wasm compiler yesterday and it was observed that writing to a mutable global should not kill a value loaded from an immutable global.

This made me realize: we have multiple tables (introduced by the bulk memory proposal or reftypes, I'm not actually sure which) and table.fill and table.copy and table.get and table.set (introduced by the reftypes proposal), but so far as I can tell we have no immutable tables. If tables really are "generalized global variables", then perhaps we should, for symmetry. More importantly it would make it possible to export a table without fear of the table being tampered with.

Immutable tables must probably be initialized by an active element segment or from an imported immutable table, in the fashion of globals; this adds another wrinkle to our table initialization semantics puzzle.

(And once we have multiple memories, read-only memories will be attractive for some applications.)

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