diff options
| author | Luke Wagner <luke@mozilla.com> | 2016-03-01 17:16:03 -0600 |
|---|---|---|
| committer | Luke Wagner <luke@mozilla.com> | 2016-03-04 00:42:35 -0600 |
| commit | 0d1393dd3de17f2d5e982853582e322eb4f41a14 (patch) | |
| tree | 517134cf15c7872325439877e156c003406dad27 /BinaryEncoding.md | |
| parent | 4a4d492356864a77c63045d84eee2c23e3251992 (diff) | |
| download | nanowasm-design-0d1393dd3de17f2d5e982853582e322eb4f41a14.tar.gz | |
Names section
Diffstat (limited to 'BinaryEncoding.md')
| -rw-r--r-- | BinaryEncoding.md | 39 |
1 files changed, 37 insertions, 2 deletions
diff --git a/BinaryEncoding.md b/BinaryEncoding.md index a34e63c..b021753 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -165,9 +165,8 @@ must contain a function body. Imported and exported functions must have a name. | Field | Type | Present? | Description | | ----- | ----- | ----- | ----- | -| flags | `uint8` | always | flags indicating attributes of a function <br>bit `0` : a name is present<br>bit `1` : the function is an import<br>bit `2` : the function has local variables<br>bit `3` : the function is an export | +| flags | `uint8` | always | flags indicating attributes of a function <br>bit `1` : the function is an import<br>bit `2` : the function has local variables<br>bit `3` : the function is an export | | signature | `uint16` | always | index into the Signature section | -| name | `uint32` | `flags[0] == 1` | name of the function as an offset within the module | | body size | `uint16` | `flags[0] == 0` | size of function body to follow, in bytes | | body | `bytes` | `flags[0] == 0` | function body | @@ -234,6 +233,42 @@ This section must be preceded by a [Functions](#functions-section) section. | count | `varuint32` | count of entries to follow | | entries | `uint16*` | repeated indexes into the function table | +### Function Names section + +ID: `function_names` + +| Field | Type | Description | +| ----- | ----- | ----- | +| names | `utf8-C-string*` | sequence of null-terminated utf8-encoded strings | + +The number of names is determined by the number of declared functions. The +sequence of names assigns a name to each function index. + +This section is optional and does not contribute to the semenatics of execution. +A validation error in this section is not reported and is treated as the section +being absent. The expectation is that, when a binary WebAssembly module is +viewed in a browser or other development environment, the names in this section +will be used as the names of functions in the [text format](TextFormat.md). + +### Local Names section + +ID: `local_names` + +| Field | Type | Description | +| ----- | ----- | ----- | +| names | `utf8-C-string*` | sequence of null-terminated utf8-encoded strings | + +The number of names is determined by the sum of all functions' number of locals. +The sequence of names is defined to be the concatentation of the sequence of +local names (ordered by local index) for each function (ordered by function index). +This sequence assigns a name to every local index in every function. + +This section is optional and does not contribute to the semenatics of execution. +A validation error in this section is not reported and is treated as the section +being absent. The expectation is that, when a binary WebAssembly module is +viewed in a browser or other development environment, the names in this section +will be used as the names of locals in the [text format](TextFormat.md). + ### End section ID: `end` |
