From edd010eac01d735e17c91752afc29ed91765bd23 Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Tue, 23 Feb 2016 16:03:27 +0100 Subject: Binary: Condense format of local declarations --- BinaryEncoding.md | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index bfdbe30..0f4f4f5 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -123,13 +123,21 @@ must contain a function body. Imported and exported functions must have a name. | flags | `uint8` | always | flags indicating attributes of a function
bit `0` : a name is present
bit `1` : the function is an import
bit `2` : the function has local variables
bit `3` : the function is an export | | signature | `uint16` | always | index into the Signature section | | name | `uint32` | `flags[0] == 1` | name of the function as an offset within the module | -| i32 count | `uint16` | `flags[2] == 1` | number of `i32` local variables | -| i64 count | `uint16` | `flags[2] == 1` | number of `i64` local variables | -| f32 count | `uint16` | `flags[2] == 1` | number of `f32` local variables | -| f64 count | `uint16` | `flags[2] == 1` | number of `f64` local variables | +| local count | `varuint32` | always | number of local entries | +| locals | `local_entry*` | always | local variables | | body size | `uint16` | `flags[0] == 0` | size of function body to follow, in bytes | | body | `bytes` | `flags[0] == 0` | function body | +#### Local Entry + +Each local entry declares a number of local variables of one type. +It is legal to have several entries with the same type. + +| Field | Type | Description | +| ----- | ----- | ----- | ----- | +| count | `varuint32` | number of local variables of the following type | +| type | `value_type` | type of the variables | + ### Data Segments section The data segemnts section declares the initialized data that should be loaded into the linear memory. A module may only contain one data segments section. -- cgit v1.2.3 From 13e0758ad4ca3f880c3b7fb3afe41ad3377308dd Mon Sep 17 00:00:00 2001 From: Andreas Rossberg Date: Tue, 23 Feb 2016 17:26:59 +0100 Subject: Eps --- BinaryEncoding.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'BinaryEncoding.md') diff --git a/BinaryEncoding.md b/BinaryEncoding.md index 0f4f4f5..ae97f42 100644 --- a/BinaryEncoding.md +++ b/BinaryEncoding.md @@ -130,11 +130,11 @@ must contain a function body. Imported and exported functions must have a name. #### Local Entry -Each local entry declares a number of local variables of one type. +Each local entry declares a number of local variables of a given type. It is legal to have several entries with the same type. | Field | Type | Description | -| ----- | ----- | ----- | ----- | +| ----- | ----- | ----- | | count | `varuint32` | number of local variables of the following type | | type | `value_type` | type of the variables | -- cgit v1.2.3