diff options
| author | JF Bastien <github@jfbastien.com> | 2016-02-28 22:13:48 -0500 |
|---|---|---|
| committer | JF Bastien <github@jfbastien.com> | 2016-02-28 22:13:48 -0500 |
| commit | 61e60c57b34a360d43cbe6c46d9d96f018ae00d9 (patch) | |
| tree | 7a9e26315fdb3a3585db0c70438562c5a1abe8b0 /BinaryEncoding.md | |
| parent | 35f2995981e5103db6b9fe77ef045eb69fdae3da (diff) | |
| parent | 14952154322a6508cfc2a8eb1942df9a117d8e0e (diff) | |
| download | nanowasm-design-61e60c57b34a360d43cbe6c46d9d96f018ae00d9.tar.gz | |
Merge pull request #563 from JSStats/magic-encoding
Document the magic number and version.
Diffstat (limited to 'BinaryEncoding.md')
| -rw-r--r-- | BinaryEncoding.md | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/BinaryEncoding.md b/BinaryEncoding.md index b6e3a6b..acf874b 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -73,7 +73,15 @@ Strings referenced by the module (i.e. function names) are encoded as null-termi The following documents the current prototype format. This format is based on and supersedes the v8-native prototype format, originally in a [public design doc](https://docs.google.com/document/d/1-G11CnMA0My20KI9D7dBR6ZCPOBCRD0oCH6SHCPFGx0/edit?usp=sharing). ## High-level structure -A module contains a sequence of sections. Sections can in general be repeated, but some can occur only once or have dependant sections that must preceed them but not immediately as unknown sections can occur in any order. Each section is identified by an immediate string. Sections whose identity is unknown to the WebAssembly implementation are ignored and this is supported by including the size in bytes for all sections. The encoding of all sections begins as follows: + +The module starts with a magic number and version as follows. + +| Field | Type | Description | +| ----- | ----- | ----- | +| magic number | `uint32 0x6d736100` | Magic number '\0asm' | +| version | `uint32` | Version number, currently 10. The version for MVP will be reset to 1. | + +This is followed by a sequence of sections. Sections can in general be repeated, but some can occur only once or have dependant sections that must preceed them but not immediately as unknown sections can occur in any order. Each section is identified by an immediate string. Sections whose identity is unknown to the WebAssembly implementation are ignored and this is supported by including the size in bytes for all sections. The encoding of all sections begins as follows: | Field | Type | Description | | ----- | ----- | ----- | |
