Skip to content

Commit

Permalink
[spec] Fix module context for constants (#1712)
Browse files Browse the repository at this point in the history
  • Loading branch information
rossberg committed Apr 10, 2024
1 parent 2bd0759 commit 9e9db5c
Showing 1 changed file with 15 additions and 27 deletions.
42 changes: 15 additions & 27 deletions document/core/valid/modules.rst
Expand Up @@ -536,22 +536,27 @@ Instead, the context :math:`C` for validation of the module's content is constru

* :math:`C.\CREFS` is the set :math:`\freefuncidx(\module \with \MFUNCS = \epsilon \with \MSTART = \epsilon)`, i.e., the set of :ref:`function indices <syntax-funcidx>` occurring in the module, except in its :ref:`functions <syntax-func>` or :ref:`start function <syntax-start>`.

* Let :math:`C'` be the :ref:`context <context>` where:
* Let :math:`C'` be the same :ref:`context <context>` as :math:`C`, except that :math:`C'.\CGLOBALS` is just the sequence :math:`\etglobals(\X{it}^\ast)`.

* :math:`C'.\CGLOBALS` is the sequence :math:`\etglobals(\X{it}^\ast)`,
* For each :math:`\functype_i` in :math:`\module.\MTYPES`,
the :ref:`function type <syntax-functype>` :math:`\functype_i` must be :ref:`valid <valid-functype>`.

* :math:`C'.\CFUNCS` is the same as :math:`C.\CFUNCS`,
* Under the context :math:`C'`:

* :math:`C'.\CTABLES` is the same as :math:`C.\CTABLES`,
* For each :math:`\table_i` in :math:`\module.\MTABLES`,
the definition :math:`\table_i` must be :ref:`valid <valid-table>` with a :ref:`table type <syntax-tabletype>` :math:`\X{tt}_i`.

* :math:`C'.\CMEMS` is the same as :math:`C.\CMEMS`,
* For each :math:`\mem_i` in :math:`\module.\MMEMS`,
the definition :math:`\mem_i` must be :ref:`valid <valid-mem>` with a :ref:`memory type <syntax-memtype>` :math:`\X{mt}_i`.

* :math:`C'.\CREFS` is the same as :math:`C.\CREFS`,
* For each :math:`\global_i` in :math:`\module.\MGLOBALS`,
the definition :math:`\global_i` must be :ref:`valid <valid-global>` with a :ref:`global type <syntax-globaltype>` :math:`\X{gt}_i`.

* all other fields are empty.
* For each :math:`\elem_i` in :math:`\module.\MELEMS`,
the segment :math:`\elem_i` must be :ref:`valid <valid-elem>` with :ref:`reference type <syntax-reftype>` :math:`\X{rt}_i`.

* For each :math:`\functype_i` in :math:`\module.\MTYPES`,
the :ref:`function type <syntax-functype>` :math:`\functype_i` must be :ref:`valid <valid-functype>`.
* For each :math:`\data_i` in :math:`\module.\MDATAS`,
the segment :math:`\data_i` must be :ref:`valid <valid-data>`.

* Under the context :math:`C`:

Expand All @@ -567,23 +572,6 @@ Instead, the context :math:`C` for validation of the module's content is constru
* For each :math:`\export_i` in :math:`\module.\MEXPORTS`,
the segment :math:`\export_i` must be :ref:`valid <valid-export>` with :ref:`external type <syntax-externtype>` :math:`\X{et}_i`.

* Under the context :math:`C'`:

* For each :math:`\table_i` in :math:`\module.\MTABLES`,
the definition :math:`\table_i` must be :ref:`valid <valid-table>` with a :ref:`table type <syntax-tabletype>` :math:`\X{tt}_i`.

* For each :math:`\mem_i` in :math:`\module.\MMEMS`,
the definition :math:`\mem_i` must be :ref:`valid <valid-mem>` with a :ref:`memory type <syntax-memtype>` :math:`\X{mt}_i`.

* For each :math:`\global_i` in :math:`\module.\MGLOBALS`,
the definition :math:`\global_i` must be :ref:`valid <valid-global>` with a :ref:`global type <syntax-globaltype>` :math:`\X{gt}_i`.

* For each :math:`\elem_i` in :math:`\module.\MELEMS`,
the segment :math:`\elem_i` must be :ref:`valid <valid-elem>` with :ref:`reference type <syntax-reftype>` :math:`\X{rt}_i`.

* For each :math:`\data_i` in :math:`\module.\MDATAS`,
the segment :math:`\data_i` must be :ref:`valid <valid-data>`.

* The length of :math:`C.\CMEMS` must not be larger than :math:`1`.

* All export names :math:`\export_i.\ENAME` must be different.
Expand Down Expand Up @@ -639,7 +627,7 @@ Instead, the context :math:`C` for validation of the module's content is constru
\\
C = \{ \CTYPES~\type^\ast, \CFUNCS~\X{ift}^\ast\,\X{ft}^\ast, \CTABLES~\X{itt}^\ast\,\X{tt}^\ast, \CMEMS~\X{imt}^\ast\,\X{mt}^\ast, \CGLOBALS~\X{igt}^\ast\,\X{gt}^\ast, \CELEMS~\X{rt}^\ast, \CDATAS~{\ok}^n, \CREFS~x^\ast \}
\\
C' = \{ \CGLOBALS~\X{igt}^\ast, \CFUNCS~(C.\CFUNCS), \CTABLES~(C.\CTABLES), \CMEMS~(C.\CMEMS), \CREFS~(C.\CREFS) \}
C' = C \with \CGLOBALS = \X{igt}^\ast
\qquad
|C.\CMEMS| \leq 1
\qquad
Expand Down

0 comments on commit 9e9db5c

Please sign in to comment.