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