From 6ba25e3447f4b6eb955b3a35a9ad7f09c1257235 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Fri, 5 May 2017 09:30:02 -0700 Subject: [PATCH 1/2] Add a module name to the name section --- BinaryEncoding.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/BinaryEncoding.md b/BinaryEncoding.md index fba19769..a7a2aaec 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -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 | + 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 @@ -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 From 268de2e6e9842f3d956c0bae36bd51c8bac3e900 Mon Sep 17 00:00:00 2001 From: Derek Schuff Date: Wed, 10 May 2017 14:55:51 -0700 Subject: [PATCH 2/2] Make the name type code 0 --- BinaryEncoding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BinaryEncoding.md b/BinaryEncoding.md index a7a2aaec..465a8dfd 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -449,9 +449,9 @@ 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 | -| [Module](#module-name) | `3` | Assigns a name to the module | When present, name subsections must appear in this order and at most once. The