Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Tweak segment encoding to keep memory/table index encoding (#28)
Browse files Browse the repository at this point in the history
The current state seems to remove the placeholder table/memory index from the encoding to use it as an active flag.
  • Loading branch information
AndrewScheidecker authored and binji committed Sep 11, 2018
1 parent 008e552 commit 872fcfa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 6 additions & 0 deletions document/core/binary/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,9 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
\production{element segment} & \Belem &::=&
\hex{01}~~y^\ast{:}\Bvec(\Bfuncidx)
&\Rightarrow& \{ \EINIT~y^\ast \} \\
\production{element segment} & \Belem &::=&
\hex{02}~~x{:}\Btableidx~~e{:}\Bexpr~~y^\ast{:}\Bvec(\Bfuncidx)
&\Rightarrow& \{ \ETABLE~x, \EOFFSET~e, \EINIT~y^\ast \} \\
\end{array}
.. note::
Expand Down Expand Up @@ -419,6 +422,9 @@ It decodes into a vector of :ref:`data segments <syntax-data>` that represent th
\production{data segment} & \Bdata &::=&
\hex{01}~~b^\ast{:}\Bvec(\Bbyte)
&\Rightarrow& \{ \DINIT~b^\ast \} \\
\production{data segment} & \Bdata &::=&
\hex{02}~~x{:}\Bmemidx~~e{:}\Bexpr~~b^\ast{:}\Bvec(\Bbyte)
&\Rightarrow& \{ \DMEM~x, \DOFFSET~e, \DINIT~b^\ast \} \\
\end{array}
.. note::
Expand Down
7 changes: 4 additions & 3 deletions proposals/bulk-memory-operations/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ Attempting to drop an active segment is a validation error.
The data section is encoded as follows:

```
datasec ::= seg*:section_11(vec(data)) => seg
data ::= 0x00 e:expr b*:vec(byte) => {data 0, offset e, init b*, active true}
data ::= 0x01 b*:vec(byte) => {data 0, offset empty, init b*, active false}
datasec ::= seg*:section_11(vec(data)) => seg
data ::= 0x00 e:expr b*:vec(byte) => {data 0, offset e, init b*, active true }
data ::= 0x01 b*:vec(byte) => {data 0, offset empty, init b*, active false}
data ::= 0x02 x:memidx e:expr b*:vec(byte) => {data x, offset e, init b*, active true }
```

The element section is encoded similarly.
Expand Down

0 comments on commit 872fcfa

Please sign in to comment.