aboutsummaryrefslogtreecommitdiff
path: root/BinaryEncoding.md
diff options
context:
space:
mode:
authorLuke Wagner <luke@mozilla.com>2016-03-13 19:35:42 -0500
committerLuke Wagner <luke@mozilla.com>2016-03-13 19:35:42 -0500
commite3375281d46fe39cc1f37a4cd02cc524d3c8fdc6 (patch)
treed2e9a22d1a17e023d231a75855adce6920bd7b35 /BinaryEncoding.md
parent4c310f2c4e7e2560fa0225b0bb2cc7f4c8ab3dde (diff)
downloadnanowasm-design-e3375281d46fe39cc1f37a4cd02cc524d3c8fdc6.tar.gz
No validation errors after the End
Diffstat (limited to 'BinaryEncoding.md')
-rw-r--r--BinaryEncoding.md27
1 files changed, 12 insertions, 15 deletions
diff --git a/BinaryEncoding.md b/BinaryEncoding.md
index cac7fef..d588585 100644
--- a/BinaryEncoding.md
+++ b/BinaryEncoding.md
@@ -89,10 +89,9 @@ for all sections. The encoding of all sections begins as follows:
| id_len | `varuint32` | section identifier string length |
| id_str | `bytes` | section identifier string of id_len bytes |
-Each section other than the End section is optional and may appear at most once.
-The End section must appear exactly once. If present, sections must occur in
-this precise order (interleaved or followed by unknown sections, as noted
-above):
+Each section other than the End section is optional and may appear at most once
+and only in the precise order defined below (out-of-order sections are a
+validation error).
* [Signatures](#signatures-section) section
* [Import Table](#import-table-section) section
@@ -106,12 +105,13 @@ above):
* [End](#end-section) section
* [Names](#names-section) section
-Thus, the shortest valid module is 13 bytes (`magic number`, `version`,
-`size` = 4, `id_len` = 3, `id_str` = "end").
+The End section must appear exactly once and is the last section that affects
+execution, including whether the module validates. Any validation error after
+the End section causes the containing section and all subsequent bytes to be
+ignored.
-Additionally, known sections (from the above list) may not appear out of order
-and the end of the last present section must coincide with the last byte of the
-module.
+The shortest valid module is thus 13 bytes: `magic number`, `version`,
+`size` = `4`, `id_len` = `3`, `id_str` = `end`.
### Signatures section
@@ -264,12 +264,9 @@ affecting execution.
ID: `names`
-The names section does not change execution semantics and 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).
+When a binary WebAssembly module is viewed in a browser or other development
+environment, the names in this section, when present, are used as the names of
+functions and locals in the [text format](TextFormat.md).
| Field | Type | Description |
| ----- | ----- | ----- |