Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion document/core/appendix/index-rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Construct Judgement
:ref:`Table instance <valid-tableinst>` :math:`S \vdashtableinst \tableinst : \tabletype`
:ref:`Memory instance <valid-meminst>` :math:`S \vdashmeminst \meminst : \memtype`
:ref:`Global instance <valid-globalinst>` :math:`S \vdashglobalinst \globalinst : \globaltype`
:ref:`Element instance <valid-eleminst>` :math:`S \vdasheleminst \eleminst \ok`
:ref:`Element instance <valid-eleminst>` :math:`S \vdasheleminst \eleminst : t`
:ref:`Data instance <valid-datainst>` :math:`S \vdashdatainst \datainst \ok`
:ref:`Export instance <valid-exportinst>` :math:`S \vdashexportinst \exportinst \ok`
:ref:`Module instance <valid-moduleinst>` :math:`S \vdashmoduleinst \moduleinst : C`
Expand Down
24 changes: 15 additions & 9 deletions document/core/appendix/properties.rst
Original file line number Diff line number Diff line change
Expand Up @@ -285,13 +285,13 @@ Module instances are classified by *module contexts*, which are regular :ref:`co

* The :ref:`reference <syntax-ref>` :math:`\reff_i` must be :ref:`valid <valid-ref>` with :ref:`reference type <syntax-reftype>` :math:`t`.

* Then the table instance is valid.
* Then the element instance is valid with :ref:`reference type <syntax-reftype>` :math:`t`.

.. math::
\frac{
(S \vdash \reff : t)^\ast
}{
S \vdasheleminst \{ \EITYPE~t, \EIELEM~\reff^\ast \} \ok
S \vdasheleminst \{ \EITYPE~t, \EIELEM~\reff^\ast \} : t
}


Expand Down Expand Up @@ -346,7 +346,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co

* For each :ref:`element address <syntax-elemaddr>` :math:`\elemaddr_i` in :math:`\moduleinst.\MIELEMS`, the :ref:`element instance <syntax-eleminst>` :math:`S.\SELEMS[\elemaddr_i]` must be :ref:`valid <valid-eleminst>`.

* For each :ref:`data address <syntax-dataaddr>` :math:`\dataaddr_i` in :math:`\moduleinst.\MIDATAS`, the :ref:`data instance <syntax-datainst>` :math:`S.\SDATAS[\dataaddr_i]` must be :ref:`valid <valid-datainst>`.
* For each :ref:`data address <syntax-dataaddr>` :math:`\dataaddr_i` in :math:`\moduleinst.\MIDATAS`, the :ref:`data instance <syntax-datainst>` :math:`S.\SDATAS[\dataaddr_i]` must be :ref:`valid <valid-datainst>` with some :ref:`reference type <syntax-reftype>` :math:`\reftype_i`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a small muddle here. The elems in the line above should be valid with some reference type; the datas here should be checked to have length n to match the datacount section.

Copy link
Member Author

@rossberg rossberg Aug 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, yes, moved to the right place.

The data count section isn't relevant here, as it's handled as a detail of the binary encoding, not appearing in the AST.


* Each :ref:`export instance <syntax-exportinst>` :math:`\exportinst_i` in :math:`\moduleinst.\MIEXPORTS` must be :ref:`valid <valid-exportinst>`.

Expand All @@ -360,8 +360,12 @@ Module instances are classified by *module contexts*, which are regular :ref:`co

* Let :math:`\globaltype^\ast` be the concatenation of all :math:`\globaltype_i` in order.

* | Then the module instance is valid with :ref:`context <context>`
| :math:`\{\CTYPES~\functype^\ast, \CFUNCS~{\functype'}^\ast, \CTABLES~\tabletype^\ast, \CMEMS~\memtype^\ast, \CGLOBALS~\globaltype^\ast\}`.
* Let :math:`\reftype^\ast` be the concatenation of all :math:`\reftype_i` in order.

* Let :math:`n` be the length of :math:`\moduleinst.\MIDATAS`.

* Then the module instance is valid with :ref:`context <context>`
:math:`\{\CTYPES~\functype^\ast,` :math:`\CFUNCS~{\functype'}^\ast,` :math:`\CTABLES~\tabletype^\ast,` :math:`\CMEMS~\memtype^\ast,` :math:`\CGLOBALS~\globaltype^\ast,` :math:`\CELEMS~\reftype^\ast,` :math:`\CDATAS~{\ok}^n\}`.

.. math::
~\\[-1ex]
Expand All @@ -377,9 +381,9 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
\qquad
(S \vdashexternval \EVGLOBAL~\globaladdr : \ETGLOBAL~\globaltype)^\ast
\\
(S \vdasheleminst S.\SELEMS[\elemaddr] \ok)^\ast
(S \vdasheleminst S.\SELEMS[\elemaddr] : \reftype)^\ast
\qquad
(S \vdashdatainst S.\SDATAS[\dataaddr] \ok)^\ast
(S \vdashdatainst S.\SDATAS[\dataaddr] \ok)^n
\\
(S \vdashexportinst \exportinst \ok)^\ast
\qquad
Expand All @@ -394,14 +398,16 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
\MIMEMS & \memaddr^\ast, \\
\MIGLOBALS & \globaladdr^\ast, \\
\MIELEMS & \elemaddr^\ast, \\
\MIDATAS & \dataaddr^\ast, \\
\MIDATAS & \dataaddr^n, \\
\MIEXPORTS & \exportinst^\ast ~\} : \{
\begin{array}[t]{@{}l@{~}l@{}}
\CTYPES & \functype^\ast, \\
\CFUNCS & {\functype'}^\ast, \\
\CTABLES & \tabletype^\ast, \\
\CMEMS & \memtype^\ast, \\
\CGLOBALS & \globaltype^\ast ~\}
\CGLOBALS & \globaltype^\ast, \\
\CELEMS & \reftype^\ast, \\
\CDATAS & {\ok}^n ~\}
\end{array}
\end{array}
}
Expand Down