From bbc5df6284c8f6230e320c2afd387ea9054e28cc Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Mon, 7 Mar 2016 11:41:24 -0600 Subject: Store strings inline in the import/export entries --- BinaryEncoding.md | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 09e65f5..0aac532 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 -- cgit v1.2.3 From c0c0dc12f60f4fd6413065015becab351e095d3c Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Mon, 7 Mar 2016 11:45:32 -0600 Subject: Store data segments inline --- BinaryEncoding.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 0aac532..532f632 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -212,12 +212,12 @@ 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) | ### Indirect Function Table section -- cgit v1.2.3 From bf2aafc8fd81bc7e825a99998691429e84dbed2c Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Tue, 8 Mar 2016 12:34:10 -0600 Subject: Add the actual inline bytes --- BinaryEncoding.md | 1 + 1 file changed, 1 insertion(+) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 532f632..93fec5b 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -218,6 +218,7 @@ a `data_segment` is: | ----- | ----- | ----- | | 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 -- cgit v1.2.3