Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spec type and module validation, subtyping, and module instantiation. #382

Merged
merged 13 commits into from
Jul 20, 2023
18 changes: 18 additions & 0 deletions document/core/appendix/properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,24 @@ The typing rules defining WebAssembly :ref:`validation <valid>` only cover the *
In order to state and prove soundness precisely, the typing rules must be extended to the *dynamic* components of the abstract :ref:`runtime <syntax-runtime>`, that is, the :ref:`store <syntax-store>`, :ref:`configurations <syntax-config>`, and :ref:`administrative instructions <syntax-instr-admin>`. [#cite-pldi2017]_


.. index:: context, recursive types, recursive type indices
.. context-rec:

Contexts
~~~~~~~~

.. todo:: maybe move elsewhere?

In order to check :ref:`rolled up <aux-roll-rectype>` recursive types,
the :ref:`context <context>` is locally extended with an additional component that records the :ref:`supertypes <syntax-subtype>` of each :ref:`recursive type index <syntax-rectypeidx>`, represented as :ref:`defined types <syntax-deftype>`:

.. math::
\begin{array}{llll}
\production{context} & C &::=&
\{~ \dots, \CRECS ~ (\deftype^\ast)^\ast ~\} \\
\end{array}


.. index:: value, value type, result, result type, trap
.. _valid-result:

Expand Down
39 changes: 19 additions & 20 deletions document/core/exec/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ Reference Instructions
S; F; \val^n~(\STRUCTNEW~x) &\stepto& S'; F; (\REFSTRUCTADDR~|S.\SSTRUCTS|)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
\land & \X{si} = \{\SITYPE~F.\AMODULE.\MITYPES[x], \SIFIELDS~(\packval_{\X{ft}}(\val))^n\} \\
\land & S' = S \with \SSTRUCTS = S.\SSTRUCTS~\X{si})
\end{array} \\
Expand All @@ -453,7 +453,7 @@ Reference Instructions
F; (\STRUCTNEWDEFAULT~x) &\stepto& (\default_{\unpacktype(\X{ft})}))^n~(\STRUCTNEW~x)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n)
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n)
\end{array} \\
\end{array}

Expand All @@ -463,7 +463,7 @@ Reference Instructions
S; F; (\STRUCTNEWDEFAULT~x) &\stepto& S'; F; (\REFSTRUCTADDR~|S.\SSTRUCTS|)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
\land & \X{si} = \{\SITYPE~F.\AMODULE.\MITYPES[x], \SIFIELDS~(\packval_{\X{ft}}(\default_{\unpacktype(\X{ft})}))^n\} \\
\land & S' = S \with \SSTRUCTS = S.\SSTRUCTS~\X{si})
\end{array} \\
Expand All @@ -483,7 +483,7 @@ Reference Instructions
S; F; (\REFSTRUCTADDR~a)~(\STRUCTGET\K{\_}\sx^?~x~i) &\stepto& \val
&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
\land & \val = \unpackval^{\sx^?}_{\X{ft}[i]}(S.\SSTRUCTS[a].\SIFIELDS[i]))
\end{array} \\
\end{array}
Expand All @@ -501,7 +501,7 @@ Reference Instructions
S; (\REFSTRUCTADDR~a)~\val~(\STRUCTSET~x~i) &\stepto& S'; \epsilon
&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
\land & S' = S \with \SSTRUCTS[a].\SIFIELDS[i] = \packval_{\X{ft}[i]}(\val))
\end{array} \\
\end{array}
Expand All @@ -525,7 +525,7 @@ Reference Instructions
S; F; \val~(\I32.\CONST~n)~(\ARRAYNEW~x) &\stepto& S'; F; (\REFARRAYADDR~|S.\SARRAYS|)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
\land & \X{ai} = \{\AITYPE~F.\AMODULE.\MITYPES[x], \AIFIELDS~(\packval_{\X{ft}}(\val))^n\} \\
\land & S' = S \with \SARRAYS = S.\SARRAYS~\X{ai})
\end{array} \\
Expand All @@ -544,7 +544,7 @@ Reference Instructions
F; (\I32.\CONST~n)~(\ARRAYNEWDEFAULT~x) &\stepto& (\default_{\unpacktype(\X{ft}}))^n~(\ARRAYNEWFIXED~x~n)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft})
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft})
\end{array} \\
\end{array}

Expand All @@ -554,7 +554,7 @@ Reference Instructions
S; F; (\I32.\CONST~n)~(\ARRAYNEWDEFAULT~x) &\stepto& S'; F; (\REFARRAYADDR~|S.\SARRAYS|)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
\land & \X{ai} = \{\AITYPE~F.\AMODULE.\MITYPES[x], \AIFIELDS~(\packval_{\X{ft}}(\default_{\unpacktype(\X{ft}}))^n\} \\
\land & S' = S \with \SARRAYS = S.\SARRAYS~\X{ai})
\end{array} \\
Expand All @@ -573,7 +573,7 @@ Reference Instructions
S; F; \val^n~(\I32.\CONST~n)~(\ARRAYNEWFIXED~x) &\stepto& S'; F; (\REFARRAYADDR~|S.\SARRAYS|)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
\land & \X{ai} = \{\AITYPE~F.\AMODULE.\MITYPES[x], \AIFIELDS~(\packval_{\X{ft}}(\val))^n\} \\
\land & S' = S \with \SARRAYS = S.\SARRAYS~\X{ai})
\end{array} \\
Expand All @@ -586,22 +586,21 @@ Reference Instructions
.......................................

.. todo:: Prose
.. todo:: extend type size convention to field types

.. math::
~\\[-1ex]
\begin{array}{lcl@{\qquad}l}
S; F; (\I32.\CONST~s)~(\I32.\CONST~n)~(\ARRAYNEWDATA~x~y) &\stepto& \TRAP
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
\land & s + n\cdot|\X{ft}| > |S.\SDATAS[F.\AMODULE.\MIDATAS[y]].\DIDATA|)
\end{array} \\
\\[1ex]
S; F; (\I32.\CONST~s)~(\I32.\CONST~n)~(\ARRAYNEWDATA~x~y) &\stepto& (t.\CONST~i)^n~(\ARRAYNEWFIXED~x)
\\&&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft}^n \\
\land & t = \unpacktype(\X{ft}) \\
\land & (b^\ast)^n = S.\SDATAS[F.\AMODULE.\MIDATAS[y]].\DIDATA[s \slice n\cdot|\X{ft}|] \\
\land & (\bytes_{\X{ft}}(i) = \unpackval_{\X{ft}}(b^\ast))^n)
Expand Down Expand Up @@ -644,7 +643,7 @@ Reference Instructions
S; (\REFARRAYADDR~a)~(\I32.\CONST~i)~(\ARRAYGET\K{\_}\sx^?~x) &\stepto& \val
&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TARRAY~\X{ft} \\
\land & \val = \unpackval^{\sx^?}_{\X{ft}}(S.\SARRAYS[a].\AIFIELDS[i]))
\end{array} \\
\end{array}
Expand All @@ -662,7 +661,7 @@ Reference Instructions
S; (\REFARRAYADDR~a)~(\I32.\CONST~i)~\val~(\ARRAYSET~x) &\stepto& S'; \epsilon
&
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & \expand(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
(\iff & \expanddt(F.\AMODULE.\MITYPES[x]) = \TSTRUCT~\X{ft}^n \\
\land & S' = S \with \SARRAYS[a].\AIFIELDS[i] = \packval_{\X{ft}}(\val))
\end{array} \\
\end{array}
Expand Down Expand Up @@ -3701,7 +3700,7 @@ Invocation of :ref:`function address <syntax-funcaddr>` :math:`a`

2. Let :math:`f` be the :ref:`function instance <syntax-funcinst>`, :math:`S.\SFUNCS[a]`.

3. Let :math:`\TFUNC~[t_1^n] \toF [t_2^m]` be the :ref:`structured type <syntax-strtype>` :math:`\expand(\X{f}.\FITYPE)`.
3. Let :math:`\TFUNC~[t_1^n] \toF [t_2^m]` be the :ref:`compound type <syntax-comptype>` :math:`\expanddt(\X{f}.\FITYPE)`.

4. Let :math:`\local^\ast` be the list of :ref:`locals <syntax-local>` :math:`f.\FICODE.\FLOCALS`.

Expand All @@ -3728,7 +3727,7 @@ Invocation of :ref:`function address <syntax-funcaddr>` :math:`a`
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & S.\SFUNCS[a] = f \\
\wedge & \expand(S.f.\FITYPE) = \TFUNC~[t_1^n] \toF [t_2^m] \\
\wedge & \expanddt(S.f.\FITYPE) = \TFUNC~[t_1^n] \toF [t_2^m] \\
\wedge & f.\FICODE = \{ \FTYPE~x, \FLOCALS~\{\LTYPE~t\}^k, \FBODY~\instr^\ast~\END \} \\
\wedge & F = \{ \AMODULE~f.\FIMODULE, ~\ALOCALS~\val^n~(\default_t)^k \})
\end{array} \\
Expand All @@ -3745,7 +3744,7 @@ Tail-invocation of :ref:`function address <syntax-funcaddr>` :math:`a`

1. Assert: due to :ref:`validation <valid-call>`, :math:`S.\SFUNCS[a]` exists.

2. Let :math:`\TFUNC~[t_1^n] \toF [t_2^m]` be the :ref:`structured type <syntax-strtype>` :math:`\expand(S.\SFUNCS[a].\FITYPE)`.
2. Let :math:`\TFUNC~[t_1^n] \toF [t_2^m]` be the :ref:`compound type <syntax-comptype>` :math:`\expanddt(S.\SFUNCS[a].\FITYPE)`.

3. Assert: due to :ref:`validation <valid-return_call>`, there are at least :math:`n` values on the top of the stack.

Expand All @@ -3770,7 +3769,7 @@ Tail-invocation of :ref:`function address <syntax-funcaddr>` :math:`a`
\begin{array}{lcl@{\qquad}l}
S; \FRAME_m\{F\}~B^\ast[\val^n~(\RETURNINVOKE~a)]~\END &\stepto&
\val^n~(\INVOKE~a)
& (\iff \expand(S.\SFUNCS[a].\FITYPE) = \TFUNC~[t_1^n] \toF [t_2^m])
& (\iff \expanddt(S.\SFUNCS[a].\FITYPE) = \TFUNC~[t_1^n] \toF [t_2^m])
\end{array}


Expand Down Expand Up @@ -3828,7 +3827,7 @@ Furthermore, the resulting store must be :ref:`valid <valid-store>`, i.e., all d
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & S.\SFUNCS[a] = \{ \FITYPE~\deftype, \FIHOSTCODE~\X{hf} \} \\
\wedge & \expand(\deftype) = \TFUNC~[t_1^n] \toF [t_2^m] \\
\wedge & \expanddt(\deftype) = \TFUNC~[t_1^n] \toF [t_2^m] \\
\wedge & (S'; \result) \in \X{hf}(S; \val^n)) \\
\end{array} \\
\begin{array}{lcl@{\qquad}l}
Expand All @@ -3837,7 +3836,7 @@ Furthermore, the resulting store must be :ref:`valid <valid-store>`, i.e., all d
\\ \qquad
\begin{array}[t]{@{}r@{~}l@{}}
(\iff & S.\SFUNCS[a] = \{ \FITYPE~\deftype, \FIHOSTCODE~\X{hf} \} \\
\wedge & \expand(\deftype) = \TFUNC~[t_1^n] \toF [t_2^m] \\
\wedge & \expanddt(\deftype) = \TFUNC~[t_1^n] \toF [t_2^m] \\
\wedge & \bot \in \X{hf}(S; \val^n)) \\
\end{array} \\
\end{array}
Expand Down
35 changes: 29 additions & 6 deletions document/core/exec/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ Growing :ref:`memories <syntax-meminst>`
:ref:`Modules <syntax-moduleinst>`
..................................

.. todo:: update prose for types
.. todo:: change semantics for globals

The allocation function for :ref:`modules <syntax-module>` requires a suitable list of :ref:`external values <syntax-externval>` that are assumed to :ref:`match <match-externtype>` the :ref:`import <syntax-import>` vector of the module,
a list of initialization :ref:`values <syntax-val>` for the module's :ref:`globals <syntax-global>`,
and list of :ref:`reference <syntax-ref>` vectors for the module's :ref:`element segments <syntax-elem>`.
Expand Down Expand Up @@ -381,8 +384,6 @@ and list of :ref:`reference <syntax-ref>` vectors for the module's :ref:`element

where:

.. todo:: adjust deftypes

.. math::
\begin{array}{@{}rlll@{}}
\table^\ast &=& \module.\MTABLES \\
Expand All @@ -403,7 +404,7 @@ where:
\MIEXPORTS~\exportinst^\ast ~\}
\end{array} \\[1ex]
\deftype^\ast &=&
\insttype_{\moduleinst}(\module.\MTYPES) \\
\alloctype^\ast(\module.\MTYPES) \\
S_1, \funcaddr^\ast &=&
\allocfunc^\ast(S, \module.\MFUNCS, \moduleinst) \\
S_2, \tableaddr^\ast &=&
Expand Down Expand Up @@ -450,8 +451,30 @@ Here, the notation :math:`\F{allocx}^\ast` is shorthand for multiple :ref:`alloc

Moreover, if the dots :math:`\dots` are a sequence :math:`A^n` (as for globals or tables), then the elements of this sequence are passed to the allocation function pointwise.

For types, however, allocation is defined in terms of :ref:`rolling <aux-roll-rectype>`:

.. math::
\begin{array}{rlll}
\alloctype^\ast(\rectype^n) = \deftype^\ast \\[1ex]
\mbox{where for all $i < n$:} \hfill \\
\deftype^\ast[x_i \slice m_i] &=& \rolldt{x_i}(\rectype^n[i])[\subst \deftype^\ast[0 : \slice x_i]) \\
x_{i+1} &=& x_i + m_i \land x_n = |\deftype^\ast| \\
\end{array}

.. todo:: unify with type closure somehow?


.. scratch
\begin{array}{rlll}
\alloctype^\ast(\epsilon) = \epsilon \\
\alloctype^\ast(\rectype^\ast~\rectype') = \deftype^\ast~{\deftype'}^\ast \\[1ex]
\mbox{where:} \hfill \\
\deftype^\ast &=& \alloctype^\ast(\reftype^\ast) \\
{\deftype'}^\ast &=& \rolldt{|\deftype^\ast|}(\rectype)[\subst \deftype^\ast) \\
\end{array}

.. note::
The definition of module allocation is mutually recursive with the allocation of its associated types and functions, because the resulting module instance :math:`\moduleinst` is passed to the allocators as an argument, in order to form the necessary closures.
The definition of module allocation is mutually recursive with the allocation of its associated functions, because the resulting module instance :math:`\moduleinst` is passed to the allocators as an argument, in order to form the necessary closures.
In an implementation, this recursion is easily unraveled by mutating one or the other in a secondary step.


Expand Down Expand Up @@ -665,7 +688,7 @@ The following steps are performed:

2. Let :math:`\funcinst` be the :ref:`function instance <syntax-funcinst>` :math:`S.\SFUNCS[\funcaddr]`.

3. Let :math:`\TFUNC~[t_1^n] \toF [t_2^m]` be the :ref:`structured type <syntax-strtype>` :math:`\expand(\funcinst.\FITYPE)`.
3. Let :math:`\TFUNC~[t_1^n] \toF [t_2^m]` be the :ref:`compound type <syntax-comptype>` :math:`\expanddt(\funcinst.\FITYPE)`.

4. If the length :math:`|\val^\ast|` of the provided argument values is different from the number :math:`n` of expected arguments, then:

Expand Down Expand Up @@ -697,7 +720,7 @@ The values :math:`\val_{\F{res}}^m` are returned as the results of the invocatio
~\\[-1ex]
\begin{array}{@{}lcl}
\invoke(S, \funcaddr, \val^n) &=& S; F; \val^n~(\INVOKE~\funcaddr) \\
&(\iff & \expand(S.\SFUNCS[\funcaddr].\FITYPE) = \TFUNC~[t_1^n] \toF [t_2^m] \\
&(\iff & \expanddt(S.\SFUNCS[\funcaddr].\FITYPE) = \TFUNC~[t_1^n] \toF [t_2^m] \\
&\wedge& (S \vdashval \val : t_1)^n \\
&\wedge& F = \{ \AMODULE~\{\}, \ALOCALS~\epsilon \}) \\
\end{array}
2 changes: 1 addition & 1 deletion document/core/exec/runtime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@ Conventions

.. math::
\begin{array}{llll}
\fblocktype_{S;F}(\typeidx) &=& \functype & (\iff \expand(F.\AMODULE.\MITYPES[\typeidx]) = \TFUNC~\functype) \\
\fblocktype_{S;F}(\typeidx) &=& \functype & (\iff \expanddt(F.\AMODULE.\MITYPES[\typeidx]) = \TFUNC~\functype) \\
\fblocktype_{S;F}([\valtype^?]) &=& [] \to [\valtype^?] \\
\end{array}

Expand Down
3 changes: 3 additions & 0 deletions document/core/exec/types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,6 @@ Any form of :ref:`type <syntax-type>` can be *instantiated* into a :ref:`closed

.. math::
\insttype_{\moduleinst}(t) = t[\subst \moduleinst.\MITYPES]

.. note::
This is the runtime equivalent to :ref:`type closure <type-closure>`.
12 changes: 6 additions & 6 deletions document/core/exec/values.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ The following auxiliary typing rules specify this typing relation relative to a

* Let :math:`\deftype` be the :ref:`defined type <syntax-deftype>` :math:`\structinst.\SITYPE`.

* The :ref:`expansion <aux-expand>` of :math:`\deftype` must be a :ref:`struct type <syntax-structtype>`.
* The :ref:`expansion <aux-expand-deftype>` of :math:`\deftype` must be a :ref:`struct type <syntax-structtype>`.

* Then the value is valid with :ref:`reference type <syntax-reftype>` :math:`(\REF~\deftype)`.

.. math::
\frac{
\deftype = S.\SSTRUCTS[a].\SITYPE
\qquad
\expand(\deftype) = \TSTRUCT~\structtype
\expanddt(\deftype) = \TSTRUCT~\structtype
}{
S \vdashval \REFSTRUCTADDR~a : \REF~\deftype
}
Expand All @@ -109,15 +109,15 @@ The following auxiliary typing rules specify this typing relation relative to a

* Let :math:`\deftype` be the :ref:`defined type <syntax-deftype>` :math:`\arrayinst.\AITYPE`.

* The :ref:`expansion <aux-expand>` of :math:`\deftype` must be an :ref:`array type <syntax-arraytype>`.
* The :ref:`expansion <aux-expand-deftype>` of :math:`\deftype` must be an :ref:`array type <syntax-arraytype>`.

* Then the value is valid with :ref:`reference type <syntax-reftype>` :math:`(\REF~\arraytype)`.

.. math::
\frac{
\deftype = S.\SARRAYS[a].\AITYPE
\qquad
\expand(\deftype) = \TARRAY~\arraytype
\expanddt(\deftype) = \TARRAY~\arraytype
}{
S \vdashval \REFARRAYADDR~a : \REF~\deftype
}
Expand All @@ -132,15 +132,15 @@ The following auxiliary typing rules specify this typing relation relative to a

* Let :math:`\deftype` be the :ref:`defined type <syntax-deftype>` :math:`\funcinst.\FITYPE`.

* The :ref:`expansion <aux-expand>` of :math:`\deftype` must be a :ref:`function type <syntax-functype>`.
* The :ref:`expansion <aux-expand-deftype>` of :math:`\deftype` must be a :ref:`function type <syntax-functype>`.

* Then the value is valid with :ref:`reference type <syntax-reftype>` :math:`(\REF~\functype)`.

.. math::
\frac{
\deftype = S.\SFUNCS[a].\FITYPE
\qquad
\expand(\deftype) = \TFUNC~\functype
\expanddt(\deftype) = \TFUNC~\functype
}{
S \vdashval \REFFUNCADDR~a : \REF~\deftype
}
Expand Down
4 changes: 2 additions & 2 deletions document/core/syntax/instructions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ while |REFASNONNULL| converts a :ref:`nullable <syntax-reftype>` to a non-null o

The |REFEQ| compares two references.

The instructions |REFTEST| and |REFCAST| test the :ref:`dynamic type <syntax-type-dyn>` of a reference operand.
The instructions |REFTEST| and |REFCAST| test the :ref:`dynamic type <type-inst>` of a reference operand.
The former merely returns the result of the test,
while the latter performs a downcast and :ref:`traps <trap>` if the operand's type does not match.

Expand Down Expand Up @@ -491,7 +491,7 @@ while the latter performs a downcast and :ref:`traps <trap>` if the operand's ty
Aggregate Instructions
~~~~~~~~~~~~~~~~~~~~~~

Instructions in this group are concerned with creating and accessing :ref:`references <syntax-reftype>` to :ref:`aggregate <syntax-type-aggregate>` types.
Instructions in this group are concerned with creating and accessing :ref:`references <syntax-reftype>` to :ref:`aggregate <syntax-aggrtype>` types.

.. math::
\begin{array}{llrl}
Expand Down
Loading