Skip to content

Commit aa87fc8

Browse files
authored
Merge pull request WebAssembly#11 from dhil/wasmfx-merge
Merge with WebAssembly/spec and WebAssembly/gc
2 parents a8ffd1f + 5987142 commit aa87fc8

31 files changed

+1101
-166
lines changed

.github/workflows/ci-interpreter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
ocaml-compiler: 4.14.x
2525
- name: Setup OCaml tools
26-
run: opam install --yes ocamlbuild.0.14.0 ocamlfind.1.9.5 js_of_ocaml.4.0.0 js_of_ocaml-ppx.4.0.0
26+
run: opam install --yes ocamlfind.1.9.5 js_of_ocaml.4.0.0 js_of_ocaml-ppx.4.0.0
2727
- name: Setup Node.js
2828
uses: actions/setup-node@v2
2929
with:

document/core/appendix/changes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ Added managed reference types [#proposal-gc]_.
188188

189189
* New :ref:`reference instructions <syntax-instr-ref>` for :ref:`array types <syntax-structtype>`: |ARRAYNEW|, |ARRAYNEWDEFAULT|, |ARRAYNEWFIXED|, |ARRAYNEWDATA|, |ARRAYNEWELEM|, :math:`\ARRAYGET\K{\_}\sx^?`, |ARRAYSET|, |ARRAYLEN|, |ARRAYFILL|, |ARRAYCOPY|, |ARRAYINITDATA|, |ARRAYINITELEM|
190190

191-
* New :ref:`reference instructions <syntax-instr-ref>` for converting :ref:`host types <syntax-externtype>`: |EXTERNINTERNALIZE|, |EXTERNEXTERNALIZE|
191+
* New :ref:`reference instructions <syntax-instr-ref>` for converting :ref:`host types <syntax-externtype>`: |ANYCONVERTEXTERN|, |EXTERNCONVERTANY|
192192

193-
* Extended set of :ref:`constant instructions <valid-const>` with |REFI31|, |STRUCTNEW|, |STRUCTNEWDEFAULT|, |ARRAYNEW|, |ARRAYNEWDEFAULT|, |ARRAYNEWFIXED|, |EXTERNINTERNALIZE|, |EXTERNEXTERNALIZE|, and |GLOBALGET| for any previously declared immutable :ref:`global <syntax-global>`
193+
* Extended set of :ref:`constant instructions <valid-const>` with |REFI31|, |STRUCTNEW|, |STRUCTNEWDEFAULT|, |ARRAYNEW|, |ARRAYNEWDEFAULT|, |ARRAYNEWFIXED|, |ANYCONVERTEXTERN|, |EXTERNCONVERTANY|, and |GLOBALGET| for any previously declared immutable :ref:`global <syntax-global>`
194194

195195

196196
.. [#proposal-signext]

document/core/appendix/index-instructions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
279279
Instruction(None, r'\hex{CF}'),
280280
Instruction(r'\REFNULL~\X{ht}', r'\hex{D0}', r'[] \to [(\REF~\NULL~\X{ht})]', r'valid-ref.null', r'exec-ref.null'),
281281
Instruction(r'\REFISNULL', r'\hex{D1}', r'[(\REF~\NULL~\X{ht})] \to [\I32]', r'valid-ref.is_null', r'exec-ref.is_null'),
282-
Instruction(r'\REFFUNC~x', r'\hex{D2}', r'[] \to [\FUNCREF]', r'valid-ref.func', r'exec-ref.func'),
282+
Instruction(r'\REFFUNC~x', r'\hex{D2}', r'[] \to [\REF~\X{ht}]', r'valid-ref.func', r'exec-ref.func'),
283283
Instruction(r'\REFEQ', r'\hex{D3}', r'[\EQREF~\EQREF] \to [\I32]', r'valid-ref.eq', r'exec-ref.eq'),
284284
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'),
285285
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'),
@@ -327,15 +327,15 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
327327
Instruction(r'\STRUCTGETU~x~y', r'\hex{FB}~\hex{04}', r'[(\REF~\NULL~x)] \to [\I32]', r'valid-struct.get', r'exec-struct.get'),
328328
Instruction(r'\STRUCTSET~x~y', r'\hex{FB}~\hex{05}', r'[(\REF~\NULL~x)~t] \to []', r'valid-struct.set', r'exec-struct.set'),
329329
Instruction(r'\ARRAYNEW~x', r'\hex{FB}~\hex{06}', r'[t] \to [(\REF~x)]', r'valid-array.new', r'exec-array.new'),
330-
Instruction(r'\ARRAYNEWDEFAULT~x', r'\hex{FB}~\hex{07}', r'[] \to [(\REF~x)]', r'valid-array.new', r'exec-array.new'),
330+
Instruction(r'\ARRAYNEWDEFAULT~x', r'\hex{FB}~\hex{07}', r'[\I32] \to [(\REF~x)]', r'valid-array.new', r'exec-array.new'),
331331
Instruction(r'\ARRAYNEWFIXED~x~n', r'\hex{FB}~\hex{08}', r'[t^n] \to [(\REF~x)]', r'valid-array.new_fixed', r'exec-array.new_fixed'),
332332
Instruction(r'\ARRAYNEWDATA~x~y', r'\hex{FB}~\hex{09}', r'[\I32~\I32] \to [(\REF~x)]', r'valid-array.new_data', r'exec-array.new_data'),
333333
Instruction(r'\ARRAYNEWELEM~x~y', r'\hex{FB}~\hex{0A}', r'[\I32~\I32] \to [(\REF~x)]', r'valid-array.new_elem', r'exec-array.new_elem'),
334334
Instruction(r'\ARRAYGET~x', r'\hex{FB}~\hex{0B}', r'[(\REF~\NULL~x)~\I32] \to [t]', r'valid-array.get', r'exec-array.get'),
335335
Instruction(r'\ARRAYGETS~x', r'\hex{FB}~\hex{0C}', r'[(\REF~\NULL~x)~\I32] \to [\I32]', r'valid-array.get', r'exec-array.get'),
336336
Instruction(r'\ARRAYGETU~x', r'\hex{FB}~\hex{0D}', r'[(\REF~\NULL~x)~\I32] \to [\I32]', r'valid-array.get', r'exec-array.get'),
337337
Instruction(r'\ARRAYSET~x', r'\hex{FB}~\hex{0E}', r'[(\REF~\NULL~x)~\I32~t] \to []', r'valid-array.set', r'exec-array.set'),
338-
Instruction(r'\ARRAYLEN', r'\hex{FB}~\hex{0F}', r'[\ARRAYREF] \to []', r'valid-array.len', r'exec-array.len'),
338+
Instruction(r'\ARRAYLEN', r'\hex{FB}~\hex{0F}', r'[(\REF~\NULL~\ARRAY)] \to [\I32]', r'valid-array.len', r'exec-array.len'),
339339
Instruction(r'\ARRAYFILL~x', r'\hex{FB}~\hex{10}', r'[(\REF~\NULL~x)~\I32~t~\I32] \to []', r'valid-array.fill', r'exec-array.fill'),
340340
Instruction(r'\ARRAYCOPY~x~y', r'\hex{FB}~\hex{11}', r'[(\REF~\NULL~x)~\I32~(\REF~\NULL~y)~\I32~\I32] \to []', r'valid-array.copy', r'exec-array.copy'),
341341
Instruction(r'\ARRAYINITDATA~x~y', r'\hex{FB}~\hex{12}', r'[(\REF~\NULL~x)~\I32~\I32~\I32] \to []', r'valid-array.init_data', r'exec-array.init_data'),
@@ -346,8 +346,8 @@ def Instruction(name, opcode, type=None, validation=None, execution=None, operat
346346
Instruction(r'\REFCAST~(\REF~\NULL~t)', r'\hex{FB}~\hex{17}', r"[(\REF~\NULL~t')] \to [(\REF~\NULL~t)]", r'valid-ref.cast', r'exec-ref.cast'),
347347
Instruction(r'\BRONCAST~t_1~t_2', r'\hex{FB}~\hex{18}', r'[t_1] \to [t_1\reftypediff t_2]', r'valid-br_on_cast', r'exec-br_on_cast'),
348348
Instruction(r'\BRONCASTFAIL~t_1~t_2', r'\hex{FB}~\hex{19}', r'[t_1] \to [t_2]', r'valid-br_on_cast_fail', r'exec-br_on_cast_fail'),
349-
Instruction(r'\EXTERNINTERNALIZE', r'\hex{FB}~\hex{1A}', r'[\EXTERNREF] \to [\ANYREF]', r'valid-extern.internalize', r'exec-extern.internalize'),
350-
Instruction(r'\EXTERNEXTERNALIZE', r'\hex{FB}~\hex{1B}', r'[\ANYREF] \to [\EXTERNREF]', r'valid-extern.externalize', r'exec-extern.externalize'),
349+
Instruction(r'\ANYCONVERTEXTERN', r'\hex{FB}~\hex{1A}', r'[(\REF~\NULL~\EXTERN)] \to [(\REF~\NULL~\ANY)]', r'valid-any.convert_extern', r'exec-any.convert_extern'),
350+
Instruction(r'\EXTERNCONVERTANY', r'\hex{FB}~\hex{1B}', r'[(\REF~\NULL~\ANY)] \to [(\REF~\NULL~\EXTERN)]', r'valid-extern.convert_any', r'exec-extern.convert_any'),
351351
Instruction(r'\REFI31', r'\hex{FB}~\hex{1C}', r'[\I32] \to [\I31REF]', r'valid-ref.i31', r'exec-ref.i31'),
352352
Instruction(r'\I31GETS', r'\hex{FB}~\hex{1D}', r'[\I31REF] \to [\I32]', r'valid-i31.get_sx', r'exec-i31.get_sx'),
353353
Instruction(r'\I31GETU', r'\hex{FB}~\hex{1E}', r'[\I31REF] \to [\I32]', r'valid-i31.get_sx', r'exec-i31.get_sx'),

document/core/binary/instructions.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ Control Instructions
4444
.. _binary-call_ref:
4545
.. _binary-call_indirect:
4646
.. _binary-return_call:
47+
.. _binary-return_call_ref:
4748
.. _binary-return_call_indirect:
4849

4950
.. math::
@@ -131,8 +132,8 @@ Generic :ref:`reference instructions <syntax-instr-ref>` are represented by sing
131132
.. _binary-i31.get_u:
132133
.. _binary-ref.test:
133134
.. _binary-ref.cast:
134-
.. _binary-extern.internalize:
135-
.. _binary-extern.externalize:
135+
.. _binary-any.convert_extern:
136+
.. _binary-extern.convert_any:
136137

137138
.. math::
138139
\begin{array}{llclll}
@@ -166,8 +167,8 @@ Generic :ref:`reference instructions <syntax-instr-ref>` are represented by sing
166167
\hex{FB}~~21{:}\Bu32~~\X{ht}{:}\Bheaptype &\Rightarrow& \REFTEST~(\REF~\NULL~\X{ht}) \\ &&|&
167168
\hex{FB}~~22{:}\Bu32~~\X{ht}{:}\Bheaptype &\Rightarrow& \REFCAST~(\REF~\X{ht}) \\ &&|&
168169
\hex{FB}~~23{:}\Bu32~~\X{ht}{:}\Bheaptype &\Rightarrow& \REFCAST~(\REF~\NULL~\X{ht}) \\ &&|&
169-
\hex{FB}~~26{:}\Bu32 &\Rightarrow& \EXTERNINTERNALIZE \\ &&|&
170-
\hex{FB}~~27{:}\Bu32 &\Rightarrow& \EXTERNEXTERNALIZE \\ &&|&
170+
\hex{FB}~~26{:}\Bu32 &\Rightarrow& \ANYCONVERTEXTERN \\ &&|&
171+
\hex{FB}~~27{:}\Bu32 &\Rightarrow& \EXTERNCONVERTANY \\ &&|&
171172
\hex{FB}~~28{:}\Bu32 &\Rightarrow& \REFI31 \\ &&|&
172173
\hex{FB}~~29{:}\Bu32 &\Rightarrow& \I31GETS \\ &&|&
173174
\hex{FB}~~30{:}\Bu32 &\Rightarrow& \I31GETU \\

document/core/binary/modules.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
341341
\production{element segment} & \Belem &::=&
342342
0{:}\Bu32~~e{:}\Bexpr~~y^\ast{:}\Bvec(\Bfuncidx)
343343
&\Rightarrow& \\&&&\quad
344-
\{ \ETYPE~\FUNCREF, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
344+
\{ \ETYPE~(\REF~\NULL~\FUNC), \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
345345
1{:}\Bu32~~\X{et}:\Belemkind~~y^\ast{:}\Bvec(\Bfuncidx)
346346
&\Rightarrow& \\&&&\quad
347347
\{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EPASSIVE \} \\ &&|&
@@ -353,7 +353,7 @@ It decodes into a vector of :ref:`element segments <syntax-elem>` that represent
353353
\{ \ETYPE~\X{et}, \EINIT~((\REFFUNC~y)~\END)^\ast, \EMODE~\EDECLARATIVE \} \\ &&|&
354354
4{:}\Bu32~~e{:}\Bexpr~~\X{el}^\ast{:}\Bvec(\Bexpr)
355355
&\Rightarrow& \\&&&\quad
356-
\{ \ETYPE~\FUNCREF, \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
356+
\{ \ETYPE~(\REF~\NULL~\FUNC), \EINIT~\X{el}^\ast, \EMODE~\EACTIVE~\{ \ETABLE~0, \EOFFSET~e \} \} \\ &&|&
357357
5{:}\Bu32~~\X{et}:\Breftype~~\X{el}^\ast{:}\Bvec(\Bexpr)
358358
&\Rightarrow& \\&&&\quad
359359
\{ \ETYPE~et, \EINIT~\X{el}^\ast, \EMODE~\EPASSIVE \} \\ &&|&

document/core/exec/instructions.rst

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,43 +1475,57 @@ Where:
14751475
\end{array}
14761476
14771477
1478-
.. _exec-extern.externalize:
1478+
.. _exec-any.convert_extern:
14791479

1480-
:math:`\EXTERNEXTERNALIZE`
1481-
..........................
1480+
:math:`\ANYCONVERTEXTERN`
1481+
.........................
14821482

1483-
1. Assert: due to :ref:`validation <valid-extern.externalize>`, a :ref:`reference value <syntax-ref>` is on the top of the stack.
1483+
1. Assert: due to :ref:`validation <valid-any.convert_extern>`, a :ref:`reference value <syntax-ref>` is on the top of the stack.
14841484

14851485
2. Pop the value :math:`\reff` from the stack.
14861486

1487-
3. Let :math:`\reff'` be the reference value :math:`(\REFEXTERN~\reff)`.
1487+
3. If :math:`\reff` is :math:`\REFNULL~\X{ht}`, then:
1488+
1489+
a. Push the reference value :math:`(\REFNULL~\ANY)` to the stack.
1490+
1491+
4. Else:
1492+
1493+
a. Assert: due to :ref:`validation <valid-any.convert_extern>`, a :math:`\reff` is an :ref:`external reference <syntax-ref.extern>`.
14881494

1489-
5. Push the reference value :math:`\reff'` to the stack.
1495+
b. Let :math:`\REFEXTERN~\reff'` be the reference value :math:`\reff`.
1496+
1497+
c. Push the reference value :math:`\reff'` to the stack.
14901498

14911499
.. math::
14921500
\begin{array}{lcl@{\qquad}l}
1493-
\reff~\EXTERNEXTERNALIZE &\stepto& (\REFEXTERN~\reff)
1501+
(\REFNULL \X{ht})~\ANYCONVERTEXTERN &\stepto& (\REFNULL~\ANY) \\
1502+
(\REFEXTERN~\reff)~\ANYCONVERTEXTERN &\stepto& \reff \\
14941503
\end{array}
14951504
14961505
1497-
.. _exec-extern.internalize:
1506+
.. _exec-extern.convert_any:
14981507

1499-
:math:`\EXTERNINTERNALIZE`
1500-
..........................
1508+
:math:`\EXTERNCONVERTANY`
1509+
.........................
15011510

1502-
1. Assert: due to :ref:`validation <valid-extern.internalize>`, a :ref:`reference value <syntax-ref>` is on the top of the stack.
1511+
1. Assert: due to :ref:`validation <valid-extern.convert_any>`, a :ref:`reference value <syntax-ref>` is on the top of the stack.
15031512

15041513
2. Pop the value :math:`\reff` from the stack.
15051514

1506-
3. Assert: due to :ref:`validation <valid-extern.internalize>`, a :math:`\reff` is an :ref:`external reference <syntax-ref.extern>`.
1515+
3. If :math:`\reff` is :math:`\REFNULL~\X{ht}`, then:
1516+
1517+
a. Push the reference value :math:`(\REFNULL~\EXTERN)` to the stack.
1518+
1519+
4. Else:
15071520

1508-
4. Let :math:`\REFEXTERN~\reff'` be the reference value :math:`\reff`.
1521+
a. Let :math:`\reff'` be the reference value :math:`(\REFEXTERN~\reff)`.
15091522

1510-
5. Push the reference value :math:`\reff'` to the stack.
1523+
b. Push the reference value :math:`\reff'` to the stack.
15111524

15121525
.. math::
15131526
\begin{array}{lcl@{\qquad}l}
1514-
(\REFEXTERN~\reff)~\EXTERNINTERNALIZE &\stepto& \reff
1527+
(\REFNULL \X{ht})~\EXTERNCONVERTANY &\stepto& (\REFNULL~\EXTERN) \\
1528+
\reff~\EXTERNCONVERTANY &\stepto& (\REFEXTERN~\reff) & (\iff \reff \neq (\REFNULL \X{ht})) \\
15151529
\end{array}
15161530
15171531
@@ -4125,7 +4139,7 @@ Control Instructions
41254139

41264140
.. math::
41274141
\begin{array}{lcl@{\qquad}l}
4128-
S; \reff~(\BRONCAST~l~\X{rt}_1~X{rt}_2) &\stepto& (\BR~l)
4142+
S; \reff~(\BRONCAST~l~\X{rt}_1~X{rt}_2) &\stepto& \reff~(\BR~l)
41294143
& (\iff S \vdashval \reff : \X{rt}
41304144
\land \vdashreftypematch \X{rt} \matchesreftype \insttype_{F.\AMODULE}(\X{rt}_2)) \\
41314145
S; \reff~(\BRONCAST~l~\X{rt}_1~\X{rt}_2) &\stepto& \reff
@@ -4163,7 +4177,7 @@ Control Instructions
41634177
S; \reff~(\BRONCASTFAIL~l~\X{rt}_1~X{rt}_2) &\stepto& \reff
41644178
& (\iff S \vdashval \reff : \X{rt}
41654179
\land \vdashreftypematch \X{rt} \matchesreftype \insttype_{F.\AMODULE}(\X{rt}_2)) \\
4166-
S; \reff~(\BRONCASTFAIL~l~\X{rt}_1~\X{rt}_2) &\stepto& (\BR~l)
4180+
S; \reff~(\BRONCASTFAIL~l~\X{rt}_1~\X{rt}_2) &\stepto& \reff~(\BR~l)
41674181
& (\otherwise) \\
41684182
\end{array}
41694183

document/core/exec/modules.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -715,6 +715,10 @@ Once the function has returned, the following steps are executed:
715715

716716
2. Pop :math:`\val_{\F{res}}^m` from the stack.
717717

718+
3. Assert: due to :ref:`validation <valid-module>`, the frame :math:`F` is now on the top of the stack.
719+
720+
4. Pop the frame :math:`F` from the stack.
721+
718722
The values :math:`\val_{\F{res}}^m` are returned as the results of the invocation.
719723

720724
.. math::

document/core/syntax/instructions.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ while the latter performs a downcast and :ref:`traps <trap>` if the operand's ty
485485
.. _syntax-ref.i31:
486486
.. _syntax-i31.get_s:
487487
.. _syntax-i31.get_u:
488-
.. _syntax-extern.internalize:
489-
.. _syntax-extern.externalize:
488+
.. _syntax-any.convert_extern:
489+
.. _syntax-extern.convert_any:
490490
.. _syntax-instr-struct:
491491
.. _syntax-instr-array:
492492
.. _syntax-instr-i31:
@@ -521,8 +521,8 @@ Instructions in this group are concerned with creating and accessing :ref:`refer
521521
\ARRAYINITELEM~\typeidx~\elemidx \\&&|&
522522
\REFI31 \\&&|&
523523
\I31GET\K{\_}\sx \\&&|&
524-
\EXTERNINTERNALIZE \\&&|&
525-
\EXTERNEXTERNALIZE \\
524+
\ANYCONVERTEXTERN \\&&|&
525+
\EXTERNCONVERTANY \\
526526
\end{array}
527527
528528
The instructions |STRUCTNEW| and |STRUCTNEWDEFAULT| allocate a new :ref:`structure <syntax-structtype>`, initializing them either with operands or with default values.
@@ -539,7 +539,7 @@ again allowing for different sign extension modes in the case of a :ref:`packed
539539

540540
The instructions |REFI31| and :math:`\I31GET\K{\_}\sx` convert between type |I31| and an unboxed :ref:`scalar <syntax-i31>`.
541541

542-
The instructions |EXTERNINTERNALIZE| and |EXTERNEXTERNALIZE| allow lossless conversion between references represented as type :math:`(\REF~\NULL~\EXTERN)`| and as :math:`(\REF~\NULL~\ANY)`.
542+
The instructions |ANYCONVERTEXTERN| and |EXTERNCONVERTANY| allow lossless conversion between references represented as type :math:`(\REF~\NULL~\EXTERN)`| and as :math:`(\REF~\NULL~\ANY)`.
543543

544544
.. index:: ! parametric instruction, value type
545545
pair: abstract syntax; instruction

document/core/syntax/types.rst

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ There are three disjoint hierarchies of heap types:
9393
- *aggregate types* classify dynamically allocated *managed* data, such as *structures*, *arrays*, or *unboxed scalars*,
9494
- *external types* classify *external* references possibly owned by the :ref:`embedder <embedder>`.
9595

96-
The values from the latter two hierarchies are interconvertible by ways of the |EXTERNINTERNALIZE| and |EXTERNEXTERNALIZE| instructions.
96+
The values from the latter two hierarchies are interconvertible by ways of the |EXTERNCONVERTANY| and |ANYCONVERTEXTERN| instructions.
9797
That is, both type hierarchies are inhabited by an isomorphic set of values, but may have different, incompatible representations in practice.
9898

9999
.. math::
@@ -168,6 +168,29 @@ Other references are *non-null*.
168168
Reference types are *opaque*, meaning that neither their size nor their bit pattern can be observed.
169169
Values of reference type can be stored in :ref:`tables <syntax-table>`.
170170

171+
Conventions
172+
...........
173+
174+
* The reference type |ANYREF| is an abbreviation for :math:`\REF~\NULL~\ANY`.
175+
176+
* The reference type |EQREF| is an abbreviation for :math:`\REF~\NULL~\EQT`.
177+
178+
* The reference type |I31REF| is an abbreviation for :math:`\REF~\NULL~\I31`.
179+
180+
* The reference type |STRUCTREF| is an abbreviation for :math:`\REF~\NULL~\STRUCT`.
181+
182+
* The reference type |ARRAYREF| is an abbreviation for :math:`\REF~\NULL~\ARRAY`.
183+
184+
* The reference type |FUNCREF| is an abbreviation for :math:`\REF~\NULL~\FUNC`.
185+
186+
* The reference type |EXTERNREF| is an abbreviation for :math:`\REF~\NULL~\EXTERN`.
187+
188+
* The reference type |NULLREF| is an abbreviation for :math:`\REF~\NULL~\NONE`.
189+
190+
* The reference type |NULLFUNCREF| is an abbreviation for :math:`\REF~\NULL~\NOFUNC`.
191+
192+
* The reference type |NULLEXTERNREF| is an abbreviation for :math:`\REF~\NULL~\NOEXTERN`.
193+
171194

172195
.. index:: ! value type, number type, vector type, reference type
173196
pair: abstract syntax; value type

document/core/text/instructions.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ Reference Instructions
204204
.. _text-i31.get_u:
205205
.. _text-ref.test:
206206
.. _text-ref.cast:
207-
.. _text-extern.internalize:
208-
.. _text-extern.externalize:
207+
.. _text-any.convert_extern:
208+
.. _text-extern.convert_any:
209209

210210
.. math::
211211
\begin{array}{llclll}
@@ -240,8 +240,8 @@ Reference Instructions
240240
\text{ref.i31} &\Rightarrow& \REFI31 \\ &&|&
241241
\text{i31.get\_u} &\Rightarrow& \I31GETU \\ &&|&
242242
\text{i31.get\_s} &\Rightarrow& \I31GETS \\ &&|&
243-
\text{extern.internalize} &\Rightarrow& \EXTERNINTERNALIZE \\ &&|&
244-
\text{extern.externalize} &\Rightarrow& \EXTERNEXTERNALIZE \\
243+
\text{any.convert_extern} &\Rightarrow& \ANYCONVERTEXTERN \\ &&|&
244+
\text{extern.convert_any} &\Rightarrow& \EXTERNCONVERTANY \\
245245
\end{array}
246246
247247

0 commit comments

Comments
 (0)