Skip to content

Commit

Permalink
[spec] Fix a few minor oversights
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Oct 14, 2023
1 parent 2eb52be commit 0118f2d
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion document/core/appendix/index-instructions.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
Instruction(None, r'\hex{CF}'),
Instruction(r'\REFNULL~\X{ht}', r'\hex{D0}', r'[] \to [(\REF~\NULL~\X{ht})]', r'valid-ref.null', r'exec-ref.null'),
Instruction(r'\REFISNULL', r'\hex{D1}', r'[(\REF~\NULL~\X{ht})] \to [\I32]', r'valid-ref.is_null', r'exec-ref.is_null'),
Instruction(r'\REFFUNC~x', r'\hex{D2}', r'[] \to [\FUNCREF]', r'valid-ref.func', r'exec-ref.func'),
Instruction(r'\REFFUNC~x', r'\hex{D2}', r'[] \to [\REF~\X{ht}]', r'valid-ref.func', r'exec-ref.func'),
Instruction(None, r'\hex{D3}'),
Instruction(r'\REFASNONNULL', r'\hex{D4}', r'[(\REF~\NULL~\X{ht})] \to [(\REF~\X{ht})]', r'valid-ref.as_non_null', r'exec-ref.as_non_null'),
Instruction(r'\BRONNULL~l', r'\hex{D5}', r'[t^\ast~(\REF~\NULL~\X{ht})] \to [t^\ast~(\REF~\X{ht})]', r'valid-br_on_null', r'exec-br_on_null'),
Expand Down
1 change: 1 addition & 0 deletions document/core/binary/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Control Instructions
.. _binary-call_ref:
.. _binary-call_indirect:
.. _binary-return_call:
.. _binary-return_call_ref:
.. _binary-return_call_indirect:

.. math::
Expand Down
4 changes: 2 additions & 2 deletions document/core/binary/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
\production{element segment} & \Belem &::=&
0{:}\Bu32~~e{:}\Bexpr~~y^\ast{:}\Bvec(\Bfuncidx)
&\Rightarrow& \\&&&\quad
\{ \ETYPE~\FUNCREF, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
\{ \ETYPE~(\REF~\NULL~\FUNC), \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
1{:}\Bu32~~\X{et}:\Belemkind~~y^\ast{:}\Bvec(\Bfuncidx)
&\Rightarrow& \\&&&\quad
\{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EPASSIVE \} \\ &&|&
Expand All @@ -350,7 +350,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
\{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EDECLARATIVE \} \\ &&|&
4{:}\Bu32~~e{:}\Bexpr~~\X{el}^\ast{:}\Bvec(\Bexpr)
&\Rightarrow& \\&&&\quad
\{ \ETYPE~\FUNCREF, \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
\{ \ETYPE~(\REF~\NULL~\FUNC), \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
5{:}\Bu32~~\X{et}:\Breftype~~\X{el}^\ast{:}\Bvec(\Bexpr)
&\Rightarrow& \\&&&\quad
\{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EPASSIVE \} \\ &&|&
Expand Down
7 changes: 7 additions & 0 deletions document/core/syntax/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ Other references are *non-null*.
Reference types are *opaque*, meaning that neither their size nor their bit pattern can be observed.
Values of reference type can be stored in :ref:`tables <syntax-table>`.

Conventions
...........

* The reference type |FUNCREF| is an abbreviation for :math:`\REF~\NULL~\FUNC`.

* The reference type |EXTERNREF| is an abbreviation for :math:`\REF~\NULL~\EXTERN`.


.. index:: ! value type, number type, vector type, reference type, ! bottom type
pair: abstract syntax; value type
Expand Down
8 changes: 5 additions & 3 deletions document/core/valid/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1649,9 +1649,9 @@ Control Instructions

* The table :math:`C.\CTABLES[x]` must be defined in the context.

* Let :math:`\limits~\reftype` be the :ref:`table type <syntax-tabletype>` :math:`C.\CTABLES[x]`.
* Let :math:`\limits~t` be the :ref:`table type <syntax-tabletype>` :math:`C.\CTABLES[x]`.

* The :ref:`reference type <syntax-reftype>` :math:`\reftype` must be |FUNCREF|.
* The :ref:`reference type <syntax-reftype>` :math:`t` must :ref:`match <match-reftype>` type :math:`\REF~\NULL~\FUNC`.

* The type :math:`C.\CTYPES[y]` must be defined in the context.

Expand All @@ -1663,7 +1663,9 @@ Control Instructions

.. math::
\frac{
C.\CTABLES[x] = \limits~\FUNCREF
C.\CTABLES[x] = \limits~t
\qquad
C \vdashvaltypematch t \matchesreftype \REF~\NULL~\FUNC
\qquad
C.\CTYPES[y] = [t_1^\ast] \toF C.\CRETURN
}{
Expand Down
2 changes: 0 additions & 2 deletions interpreter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,6 @@ expr:
( loop <name>? <block_type> <instr>* )
( if <name>? <block_type> ( then <instr>* ) ( else <instr>* )? )
( if <name>? <block_type> <expr>+ ( then <instr>* ) ( else <instr>* )? ) ;; = <expr>+ (if <name>? <block_type> (then <instr>*) (else <instr>*)?)
( let <name>? <block_type> <local>* <instr>* )
instr:
<expr>
Expand All @@ -230,7 +229,6 @@ instr:
loop <name>? <block_type> <instr>* end <name>? ;; = (loop <name>? <block_type> <instr>*)
if <name>? <block_type> <instr>* end <name>? ;; = (if <name>? <block_type> (then <instr>*))
if <name>? <block_type> <instr>* else <name>? <instr>* end <name>? ;; = (if <name>? <block_type> (then <instr>*) (else <instr>*))
let <name>? <block_type> <local>* <instr>* end <name>? ;; = (let <name>? <block_type> <local>* <instr>*)
op:
unreachable
Expand Down
1 change: 0 additions & 1 deletion test/core/binary.wast
Original file line number Diff line number Diff line change
Expand Up @@ -1132,4 +1132,3 @@
)
"unexpected content after last section"
)

0 comments on commit 0118f2d

Please sign in to comment.