Skip to content

Should module byte offsets be used for specifying wasm code locations? #1071

Open
@dschuff

Description

@dschuff

In #1053 (and in the first version of #1064) locations of wasm instructions are specified as byte offsets in the module. This is analogous to use of PC addresses in native code, and this style of location is usable in browsers (e.g. for error messages and stack traces), in a module's name section as proposed in #1064 (which could feed into those same browser use cases, as well as online debugging), and in offline tools such as WABT and LLVM.

However, wasm is unlike traditional native-code architectures in that the code is not actually exposed to the program itself, so any specifications of references to code locations are just conventions rather than having any semantic meaning. All of the semantics and (other than the aforementioned cases) all of the conventions about wasm locations are self-consistent without reference to the binary bytes of the instructions (e.g. branch depth, imports/exports and all the other index spaces, etc). So it might be worth considering alternative naming/numbering schemes for referring to specific instructions in a wasm program.

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