Skip to content

Commit

Permalink
Fix binary encoding of tag types
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Jul 23, 2024
1 parent 1b99eaa commit babba57
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion document/core/binary/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ It decodes into a vector of :ref:`imports <syntax-import>` that represent the |M
\hex{01}~~\X{tt}{:}\Btabletype &\Rightarrow& \IDTABLE~\X{tt} \\ &&|&
\hex{02}~~\X{mt}{:}\Bmemtype &\Rightarrow& \IDMEM~\X{mt} \\ &&|&
\hex{03}~~\X{gt}{:}\Bglobaltype &\Rightarrow& \IDGLOBAL~\X{gt} \\ &&|&
\hex{04}~~\X{tt}{:}\Btagtype &\Rightarrow& \IDTAG~\X{tt} \\
\hex{04}~~x{:}\Btagtype &\Rightarrow& \IDTAG~x \\
\end{array}
Expand Down
7 changes: 2 additions & 5 deletions document/core/binary/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -321,17 +321,14 @@ Global Types
Tag Types
~~~~~~~~~

:ref:`Tag types <syntax-tagtype>` are encoded by their function type.
:ref:`Tag types <syntax-tagtype>` are encoded by a :ref:`type index <syntax-typeidx>` denoting a :ref:`function type <syntax-functype>`.

.. math::
\begin{array}{llclll}
\production{tag type} & \Btagtype &::=&
\hex{00}~~ft{:}\Bfunctype &\Rightarrow& ft \\
\hex{00}~~x{:}\Btypeidx &\Rightarrow& x \\
\end{array}
The |Bfunctype| of a tag is used to characterise exceptions.
The :math:`\hex{00}` bit signifies an exception and is currently the only allowed value.

.. note::
In future versions of WebAssembly,
the preceding zero byte may encode additional flags.
2 changes: 1 addition & 1 deletion document/core/syntax/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ The |MIMPORTS| component of a module defines a set of *imports* that are require
\IDTABLE~\tabletype \\&&|&
\IDMEM~\memtype \\&&|&
\IDGLOBAL~\globaltype \\&&|&
\IDTAG~\tagtype \\
\IDTAG~\typeidx \\
\end{array}
Each import is labeled by a two-level :ref:`name <syntax-name>` space, consisting of a |IMODULE| name and a |INAME| for an entity within that module.
Expand Down

0 comments on commit babba57

Please sign in to comment.