Skip to content

Commit

Permalink
Expand binary name section to include type, table, memory, global, an…
Browse files Browse the repository at this point in the history
…d label names.
  • Loading branch information
AndrewScheidecker committed May 15, 2017
1 parent e330cb8 commit e9e5a16
Showing 1 changed file with 46 additions and 1 deletion.
47 changes: 46 additions & 1 deletion BinaryEncoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,11 @@ be skipped over by an engine. The current list of valid `name_type` codes are:
| [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 |

| [Labels](#label-names) | `3` | Assigns names to labels in functions |
| [Type](#type-names) | `4` | Assigns names to types |
| [Table](#table-names) | `5` | Assigns names to tables |
| [Memory](#memory-names) | `6` | Assigns names to memories |
| [Global](#global-names) | `7` | Assigns names to globals |

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 @@ -500,6 +504,47 @@ 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 |

#### Label names

The label names subsection assigns `name_map`s to a subset of functions in the
[function index space](Modules.md#function-index-space). This may include both
module-defined or imported functions, but is only meaningful for module-defined
functions. The `name_map` for a given function assigns names to labels within
the function, with labels identified by the offset from the start of the function's
code to the operator that introduces the label (i.e. control flow operators).

| Field | Type | Description |
| ----- | ---- | ----------- |
| count | `varuint32` | count of `label_names` in funcs |
| funcs | `label_names*` | sequence of `label_names` sorted by index |

where a `label_name` is encoded as:

| Field | Type | Description |
| ----- | ---- | ----------- |
| index | `varuint32` | the index of the function whose labels are being named |
| label_map | `name_map` | assignment of names to labeling operator |

#### Type names

The type names subsection is a `name_map` which assigns names to a subset
of types in the module's [type section](#type-section).

#### Table names

The table names subsection is a `name_map` which assigns names to a subset
of tables in the [table index space](Modules.md#table-index-space).

#### Memory names

The memory names subsection is a `name_map` which assigns names to a subset
of memories in the [linear memory index space](Modules.md#linear-memory-index-space).

#### Global names

The global names subsection is a `name_map` which assigns names to a subset
of globals in the [global index space](Modules.md#global-index-space).

#### Module name

The module name subsection assigns a name to the module itself. It simply
Expand Down

0 comments on commit e9e5a16

Please sign in to comment.