aboutsummaryrefslogtreecommitdiff
path: root/BinaryEncoding.md
diff options
context:
space:
mode:
authortitzer <titzer@google.com>2016-03-09 08:17:24 +0100
committertitzer <titzer@google.com>2016-03-09 08:17:24 +0100
commit2001bcfbb33578e3e0d546a4edf38bc2c149aaf0 (patch)
treec46087b927d28f4c89ba4501368d9fe328e5af27 /BinaryEncoding.md
parent2e5548b0ea58becff293e8028c2b06a68f1f738a (diff)
parentbf2aafc8fd81bc7e825a99998691429e84dbed2c (diff)
downloadnanowasm-design-2001bcfbb33578e3e0d546a4edf38bc2c149aaf0.tar.gz
Merge pull request #590 from WebAssembly/inline-strings
Store section data inline in the section
Diffstat (limited to 'BinaryEncoding.md')
-rw-r--r--BinaryEncoding.md26
1 files changed, 13 insertions, 13 deletions
diff --git a/BinaryEncoding.md b/BinaryEncoding.md
index 09e65f5..93fec5b 100644
--- a/BinaryEncoding.md
+++ b/BinaryEncoding.md
@@ -71,9 +71,6 @@ sequence, then followed recursively by any child nodes.
* Then write the (variable-length) integer `callee_index` (varuint32)
* Then recursively write each argument node, where arity is determined by looking up `callee_index` in a table of signatures
-### Strings
-Strings referenced by the module (i.e. function names) are encoded as null-terminated [UTF8](http://unicode.org/faq/utf_bom.html#UTF8).
-
# Module structure
The following documents the current prototype format. This format is based on and supersedes the v8-native prototype format, originally in a [public design doc](https://docs.google.com/document/d/1-G11CnMA0My20KI9D7dBR6ZCPOBCRD0oCH6SHCPFGx0/edit?usp=sharing).
@@ -143,9 +140,10 @@ A module may contain at most one import table section.
| Field | Type | Description |
| ----- | ----- | ----- |
| sig_index | `uint16` | signature index of the import |
-| module_name | `uint32` | offset from the start of the module of the string representing the module name |
-| func_name | `uint32` | offset from the start of the module of the string representing the function name |
-
+| module_len | `varuint32` | module string length |
+| module_str | `bytes` | module string of `module_len` bytes |
+| function_len | `varuint32` | function string length |
+| function_str | `bytes` | function string of `function_len` bytes |
### Functions section
@@ -188,7 +186,8 @@ This section must be preceded by a [Functions](#functions-section) section.
| ----- | ----- | ----- |
| sig_index | `uint16` | signature index of the export |
| func_index | `uint16` | index into the function table |
-| func_name | `uint32` | offset from the start of the module of the string representing the export name |
+| function_len | `varuint32` | function string length |
+| function_str | `bytes` | function string of `function_len` bytes |
### Start Function section
@@ -213,12 +212,13 @@ A module may only contain one data segments section.
| count | `varuint32` | count of data segments to follow |
| entries | `data_segment*` | repeated data segments as described below |
-* ```varuint32```: The number of data segments in the section.
-* For each data segment:
- - ```uint32```: The base address of the data segment in memory.
- - ```uint32```: The offset of the data segment's data in the file.
- - ```uint32```: The size of the data segment (in bytes)
- - ```uint8```: ```1``` if the segment's data should be automatically loaded into memory at module load time.
+a `data_segment` is:
+
+| Field | Type | Description |
+| ----- | ----- | ----- |
+| offset | `uint32` | the offset in linear memory at which to store the data |
+| size | `uint32` | the size of the data segment (in bytes) |
+| data | `bytes` | a sequence of `size` bytes |
### Indirect Function Table section