Skip to content

Commit 026ffea

Browse files
authored
Merge pull request WebAssembly#478 from ShinWonho/ref.null
Fix ref.null semantics
2 parents 72493ed + c91f0a7 commit 026ffea

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

document/core/exec/instructions.rst

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,13 +192,26 @@ Reference Instructions
192192

193193
.. _exec-ref.null:
194194

195-
:math:`\REFNULL~\X{ht}`
195+
:math:`\REFNULL~x`
196196
.......................
197197

198-
1. Push the value :math:`\REFNULL~\X{ht}` to the stack.
198+
1. Let :math:`F` be the :ref:`current <exec-notation-textual>` :ref:`frame <syntax-frame>`.
199+
200+
2. Assert: due to :ref:`validation <valid-ref.null>`, the :ref:`defined type <syntax-deftype>` :math:`F.\AMODULE.\MITYPES[x]` exists.
201+
202+
3. Let :math:`\deftype` be the :ref:`defined type <syntax-deftype>` :math:`F.\AMODULE.\MITYPES[x]`.
203+
204+
4. Push the value :math:`\REFNULL~\deftype` to the stack.
205+
206+
.. math::
207+
\begin{array}{lcl@{\qquad}l}
208+
F; (\REFNULL~x) &\stepto& F; (\REFNULL~\deftype)
209+
& (\iff \deftype = F.\AMODULE.\MITYPES[x]) \\
210+
\end{array}
199211
200212
.. note::
201-
No formal reduction rule is required for this instruction, since the |REFNULL| instruction is already a :ref:`value <syntax-val>`.
213+
No formal reduction rule is required for the case |REFNULL| |ABSHEAPTYPE|,
214+
since the instruction form is already a :ref:`value <syntax-val>`.
202215

203216

204217
.. _exec-ref.func:

document/core/exec/runtime.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Any of the aformentioned references can furthermore be wrapped up as an *externa
4747
\production{vector} & \vecc &::=&
4848
\V128.\CONST~\i128 \\
4949
\production{reference} & \reff &::=&
50-
\REFNULL~t \\&&|&
50+
\REFNULL~(\absheaptype~|~\deftype) \\&&|&
5151
\REFI31NUM~\u31 \\&&|&
5252
\REFSTRUCTADDR~\structaddr \\&&|&
5353
\REFARRAYADDR~\arrayaddr \\&&|&

0 commit comments

Comments
 (0)