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(-) 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