From 0d1393dd3de17f2d5e982853582e322eb4f41a14 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 1 Mar 2016 17:16:03 -0600 Subject: Names section --- BinaryEncoding.md | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'BinaryEncoding.md') 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
bit `0` : a name is present
bit `1` : the function is an import
bit `2` : the function has local variables
bit `3` : the function is an export | +| flags | `uint8` | always | flags indicating attributes of a function
bit `1` : the function is an import
bit `2` : the function has local variables
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` -- cgit v1.2.3 From 97e54b55d6a1f76d9466fe3d6be8a49e61f5ab01 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 1 Mar 2016 18:57:38 -0600 Subject: Mention 0 or 1 times --- BinaryEncoding.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index b021753..a997dc2 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -244,8 +244,8 @@ ID: `function_names` 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 +This section may occur 0 or 1 times and does not change observable semantics. 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). @@ -263,8 +263,8 @@ 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 +This section may occur 0 or 1 times and does not change observable semantics. 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). -- cgit v1.2.3 From db3dadda0c700372355106312943a77a71c7cacd Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Wed, 2 Mar 2016 09:55:41 -0600 Subject: s/observable/execution/ --- BinaryEncoding.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index a997dc2..b392e13 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -244,7 +244,7 @@ ID: `function_names` 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 may occur 0 or 1 times and does not change observable semantics. A +This section may occur 0 or 1 times and does not change execution semantics. 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 @@ -263,7 +263,7 @@ 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 may occur 0 or 1 times and does not change observable semantics. A +This section may occur 0 or 1 times and does not change execution semantics. 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 -- cgit v1.2.3 From 8ba66de02f123ae647f018f4589ede031f72bbcb Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Wed, 2 Mar 2016 10:04:12 -0600 Subject: Switch to up-front length from null-terminator --- BinaryEncoding.md | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index b392e13..0b0f9ad 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -235,39 +235,49 @@ This section must be preceded by a [Functions](#functions-section) section. ### Function Names section +This section may occur 0 or 1 times and does not change execution semantics. 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). + ID: `function_names` | Field | Type | Description | | ----- | ----- | ----- | -| names | `utf8-C-string*` | sequence of null-terminated utf8-encoded strings | +| names | `name*` | sequence of names | The number of names is determined by the number of declared functions. The -sequence of names assigns a name to each function index. +sequence of names assigns a name to each function index. A name is: + +| Field | Type | Description | +| ----- | ----- | ----- | +| size | varuint32 | string length, in bytes | +| string | bytes | valid utf8-encoding of non-null code points | + +### Local Names section This section may occur 0 or 1 times and does not change execution semantics. 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 +will be used as the names of locals in the [text format](TextFormat.md). ID: `local_names` | Field | Type | Description | | ----- | ----- | ----- | -| names | `utf8-C-string*` | sequence of null-terminated utf8-encoded strings | +| names | `name*` | sequence of names | 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 sequence assigns a name to every local index in every function. A name is: -This section may occur 0 or 1 times and does not change execution semantics. 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). +| Field | Type | Description | +| ----- | ----- | ----- | +| size | varuint32 | string length, in bytes | +| string | bytes | valid utf8-encoding of non-null code points | ### End section -- cgit v1.2.3 From 8939858859294e927d7d29309044feee23909a03 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Fri, 4 Mar 2016 00:37:52 -0600 Subject: Remove non-null requirement --- BinaryEncoding.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 0b0f9ad..5083e08 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -253,7 +253,7 @@ sequence of names assigns a name to each function index. A name is: | Field | Type | Description | | ----- | ----- | ----- | | size | varuint32 | string length, in bytes | -| string | bytes | valid utf8-encoding of non-null code points | +| string | bytes | valid utf8 encoding | ### Local Names section @@ -277,7 +277,7 @@ This sequence assigns a name to every local index in every function. A name is: | Field | Type | Description | | ----- | ----- | ----- | | size | varuint32 | string length, in bytes | -| string | bytes | valid utf8-encoding of non-null code points | +| string | bytes | valid utf8 encoding | ### End section -- cgit v1.2.3 From 3169f00ad637510a3cd0c9ab928785cbddb0271d Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Fri, 4 Mar 2016 10:23:58 -0600 Subject: Fuse into one section, give arrays lengths, allow lengths to differ --- BinaryEncoding.md | 55 ++++++++++++++++++++++++------------------------------- 1 file changed, 24 insertions(+), 31 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 5083e08..6fee3b7 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -233,51 +233,44 @@ 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 +### Names section -This section may occur 0 or 1 times and does not change execution semantics. 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). - -ID: `function_names` - -| Field | Type | Description | -| ----- | ----- | ----- | -| names | `name*` | sequence of names | +ID: `names` -The number of names is determined by the number of declared functions. The -sequence of names assigns a name to each function index. A name is: +This section may occur 0 or 1 times and does not change execution semantics. A +validation error in this section does not cause validation for the whole module +to fail and is instead treated as if the section was 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 and locals in the [text format](TextFormat.md). | Field | Type | Description | | ----- | ----- | ----- | -| size | varuint32 | string length, in bytes | -| string | bytes | valid utf8 encoding | - -### Local Names section +| count | `varuint32` | count of names to follow | +| names | `function_names*` | sequence of names | -This section may occur 0 or 1 times and does not change execution semantics. 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). +The sequence of `function_name` assigns names to the corresponding +function index. The count may be greater or less than the actual number of +functions. -ID: `local_names` +#### Function names | Field | Type | Description | | ----- | ----- | ----- | -| names | `name*` | sequence of names | +| fun_name_len | `varuint32` | string length, in bytes | +| fun_name_str | `bytes` | valid utf8 encoding | +| local_count | `varuint32` | count of local names to follow | +| local_names | `local_name*` | sequence of local names | + +The sequence of `local_name` assigns names to the corresponding local index. The +count may be greater or less than the actual number of functions. -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. A name is: +#### Local name | Field | Type | Description | | ----- | ----- | ----- | -| size | varuint32 | string length, in bytes | -| string | bytes | valid utf8 encoding | +| local_name_len | `varuint32` | string length, in bytes | +| local_name_str | `bytes` | valid utf8 encoding | ### End section -- cgit v1.2.3 From 9cb14e31abad1a2ac950e42667a408811b65c5f7 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Fri, 4 Mar 2016 10:36:36 -0600 Subject: Rename 'names' to 'entries' --- BinaryEncoding.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 6fee3b7..62ec74b 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -246,8 +246,8 @@ functions and locals in the [text format](TextFormat.md). | Field | Type | Description | | ----- | ----- | ----- | -| count | `varuint32` | count of names to follow | -| names | `function_names*` | sequence of names | +| count | `varuint32` | count of entries to follow | +| entries | `function_names*` | sequence of names | The sequence of `function_name` assigns names to the corresponding function index. The count may be greater or less than the actual number of -- cgit v1.2.3 From c08726cc0f25a0988277b3e1d7a0765fdf24f527 Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Fri, 4 Mar 2016 10:37:27 -0600 Subject: Fix typo --- BinaryEncoding.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 62ec74b..516e37d 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -263,7 +263,7 @@ functions. | local_names | `local_name*` | sequence of local names | The sequence of `local_name` assigns names to the corresponding local index. The -count may be greater or less than the actual number of functions. +count may be greater or less than the actual number of locals. #### Local name -- cgit v1.2.3