Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a module name to the name section #1055

Merged
merged 2 commits into from
May 11, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions BinaryEncoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,8 @@ be skipped over by an engine. The current list of valid `name_type` codes are:
| --------- | ---- | ----------- |
| [Function](#function-names) | `1` | Assigns names to functions |
| [Local](#local-names) | `2` | Assigns names to locals in functions |
| [Module](#module-name) | `3` | Assigns a name to the module |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make the code be 0 so that it looks like we meant to do this all along ;) ?



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
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