diff --git a/document/core/appendix/index-rules.rst b/document/core/appendix/index-rules.rst index 0da084123c..8fa955d191 100644 --- a/document/core/appendix/index-rules.rst +++ b/document/core/appendix/index-rules.rst @@ -55,7 +55,7 @@ Construct Judgement :ref:`Table instance ` :math:`S \vdashtableinst \tableinst : \tabletype` :ref:`Memory instance ` :math:`S \vdashmeminst \meminst : \memtype` :ref:`Global instance ` :math:`S \vdashglobalinst \globalinst : \globaltype` -:ref:`Element instance ` :math:`S \vdasheleminst \eleminst \ok` +:ref:`Element instance ` :math:`S \vdasheleminst \eleminst : t` :ref:`Data instance ` :math:`S \vdashdatainst \datainst \ok` :ref:`Export instance ` :math:`S \vdashexportinst \exportinst \ok` :ref:`Module instance ` :math:`S \vdashmoduleinst \moduleinst : C` diff --git a/document/core/appendix/properties.rst b/document/core/appendix/properties.rst index 72251114e8..364b5f04ae 100644 --- a/document/core/appendix/properties.rst +++ b/document/core/appendix/properties.rst @@ -87,7 +87,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co * Each :ref:`global instance ` :math:`\globalinst_i` in :math:`S.\SGLOBALS` must be :ref:`valid ` with some :ref:`global type ` :math:`\globaltype_i`. -* Each :ref:`element instance ` :math:`\eleminst_i` in :math:`S.\SELEMS` must be :ref:`valid `. +* Each :ref:`element instance ` :math:`\eleminst_i` in :math:`S.\SELEMS` must be :ref:`valid ` with some :ref:`reference type ` :math:`\reftype_i`. * Each :ref:`data instance ` :math:`\datainst_i` in :math:`S.\SDATAS` must be :ref:`valid `. @@ -105,7 +105,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co \qquad (S \vdashglobalinst \globalinst : \globaltype)^\ast \\ - (S \vdasheleminst \eleminst \ok)^\ast + (S \vdasheleminst \eleminst : \reftype)^\ast \qquad (S \vdashdatainst \datainst \ok)^\ast \\ @@ -285,13 +285,13 @@ Module instances are classified by *module contexts*, which are regular :ref:`co * The :ref:`reference ` :math:`\reff_i` must be :ref:`valid ` with :ref:`reference type ` :math:`t`. -* Then the table instance is valid. +* Then the element instance is valid with :ref:`reference type ` :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 } @@ -344,7 +344,7 @@ Module instances are classified by *module contexts*, which are regular :ref:`co * For each :ref:`global address ` :math:`\globaladdr_i` in :math:`\moduleinst.\MIGLOBALS`, the :ref:`external value ` :math:`\EVGLOBAL~\globaladdr_i` must be :ref:`valid ` with some :ref:`external type ` :math:`\ETGLOBAL~\globaltype_i`. -* For each :ref:`element address ` :math:`\elemaddr_i` in :math:`\moduleinst.\MIELEMS`, the :ref:`element instance ` :math:`S.\SELEMS[\elemaddr_i]` must be :ref:`valid `. +* For each :ref:`element address ` :math:`\elemaddr_i` in :math:`\moduleinst.\MIELEMS`, the :ref:`element instance ` :math:`S.\SELEMS[\elemaddr_i]` must be :ref:`valid ` with some :ref:`reference type ` :math:`\reftype_i`. * For each :ref:`data address ` :math:`\dataaddr_i` in :math:`\moduleinst.\MIDATAS`, the :ref:`data instance ` :math:`S.\SDATAS[\dataaddr_i]` must be :ref:`valid `. @@ -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 ` - | :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 ` + :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] @@ -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 @@ -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} }