Skip to content

Commit 9e9db5c

Browse files
authored
[spec] Fix module context for constants (WebAssembly#1712)
1 parent 2bd0759 commit 9e9db5c

File tree

1 file changed

+15
-27
lines changed

1 file changed

+15
-27
lines changed

document/core/valid/modules.rst

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -536,22 +536,27 @@ Instead, the context :math:`C` for validation of the module's content is constru
536536

537537
* :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>`.
538538

539-
* Let :math:`C'` be the :ref:`context <context>` where:
539+
* 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)`.
540540

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

543-
* :math:`C'.\CFUNCS` is the same as :math:`C.\CFUNCS`,
544+
* Under the context :math:`C'`:
544545

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

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

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

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

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

556561
* Under the context :math:`C`:
557562

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

570-
* Under the context :math:`C'`:
571-
572-
* For each :math:`\table_i` in :math:`\module.\MTABLES`,
573-
the definition :math:`\table_i` must be :ref:`valid <valid-table>` with a :ref:`table type <syntax-tabletype>` :math:`\X{tt}_i`.
574-
575-
* For each :math:`\mem_i` in :math:`\module.\MMEMS`,
576-
the definition :math:`\mem_i` must be :ref:`valid <valid-mem>` with a :ref:`memory type <syntax-memtype>` :math:`\X{mt}_i`.
577-
578-
* For each :math:`\global_i` in :math:`\module.\MGLOBALS`,
579-
the definition :math:`\global_i` must be :ref:`valid <valid-global>` with a :ref:`global type <syntax-globaltype>` :math:`\X{gt}_i`.
580-
581-
* For each :math:`\elem_i` in :math:`\module.\MELEMS`,
582-
the segment :math:`\elem_i` must be :ref:`valid <valid-elem>` with :ref:`reference type <syntax-reftype>` :math:`\X{rt}_i`.
583-
584-
* For each :math:`\data_i` in :math:`\module.\MDATAS`,
585-
the segment :math:`\data_i` must be :ref:`valid <valid-data>`.
586-
587575
* The length of :math:`C.\CMEMS` must not be larger than :math:`1`.
588576

589577
* All export names :math:`\export_i.\ENAME` must be different.
@@ -639,7 +627,7 @@ Instead, the context :math:`C` for validation of the module's content is constru
639627
\\
640628
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 \}
641629
\\
642-
C' = \{ \CGLOBALS~\X{igt}^\ast, \CFUNCS~(C.\CFUNCS), \CTABLES~(C.\CTABLES), \CMEMS~(C.\CMEMS), \CREFS~(C.\CREFS) \}
630+
C' = C \with \CGLOBALS = \X{igt}^\ast
643631
\qquad
644632
|C.\CMEMS| \leq 1
645633
\qquad

0 commit comments

Comments
 (0)