Skip to content

Commit

Permalink
Add a module name to the name section (#1055)
Browse files Browse the repository at this point in the history
It's additional name type (with code 0) alongside function and local names.
  • Loading branch information
dschuff authored May 11, 2017
1 parent a8d95ac commit dfc0d51
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions BinaryEncoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,11 @@ be skipped over by an engine. The current list of valid `name_type` codes are:

| Name Type | Code | Description |
| --------- | ---- | ----------- |
| [Module](#module-name) | `0` | Assigns a name to the module |
| [Function](#function-names) | `1` | Assigns names to functions |
| [Local](#local-names) | `2` | Assigns names to locals in functions |


When present, name subsections must appear in this order and at most once. The
end of the last subsection must coincide with the last byte of the name
section to be a well-formed name section.
Expand Down Expand Up @@ -498,6 +500,16 @@ where a `local_name` is encoded as:
| index | `varuint32` | the index of the function whose locals are being named |
| local_map | `name_map` | assignment of names to local indices |

#### Module name

The module name subsection assigns a name to the module itself. It simply
consists of a single string:

| Field | Type | Description |
| ----- | ---- | ----------- |
| name_len | `varuint32` | length of `name_str` in bytes |
| name_str | `bytes` | UTF-8 encoding of the name |

# Function Bodies

Function bodies consist of a sequence of local variable declarations followed by
Expand Down

0 comments on commit dfc0d51

Please sign in to comment.