Skip to content

Commit 19fac54

Browse files
author
Guy Bedford
committed
fix exportimport descriptor
1 parent 8daa165 commit 19fac54

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

document/core/appendix/embedding.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Modules
263263

264264
4. For each :math:`\export_i` in :math:`\export^\ast` and corresponding :math:`\externtype'_i` in :math:`{\externtype'}^\ast`, do:
265265

266-
a. Let :math:`\import_j = \exportimport(\module, \export_i.\EDESC)`.
266+
a. Let :math:`\import_j = \edexportimport(\module, \export_i.\EDESC)`.
267267

268268
b. If :math:`\import_j = \epsilon`, then append the pair :math:`(\export_i.\ENAME, \externtype'_i)` to :math:`\X{result}`.
269269

@@ -274,7 +274,7 @@ Modules
274274
\begin{array}{lclll}
275275
\F{module\_direct\_exports}(m) &=& (\X{ex}.\ENAME, \externtype')^\ast \\
276276
&& \qquad (\iff \X{ex}^\ast = m.\MEXPORTS \\
277-
&& \qquad\quad \wedge~\exportimport(m, \X{ex}.\EDESC) = \epsilon \\
277+
&& \qquad\quad \wedge~\edexportimport(m, \X{ex}.\EDESC) = \epsilon \\
278278
&& \qquad\quad \wedge~\vdashmodule m : \externtype^\ast \to {\externtype'}^\ast \\
279279
&& \qquad\quad \wedge~\externtype' = \X{ex}.\EDESC) \\
280280
\end{array}
@@ -296,7 +296,7 @@ Modules
296296

297297
5. For each :math:`\export_i` in :math:`\export^\ast`, do:
298298

299-
a. Let :math:`\import_j = \exportimport(\module, \export_i.\EDESC)`.
299+
a. Let :math:`\import_j = \edexportimport(\module, \export_i.\EDESC)`.
300300

301301
b. If :math:`\import_j \neq \epsilon`, then:
302302

@@ -309,7 +309,7 @@ Modules
309309
\begin{array}{lclll}
310310
\F{module\_indirect\_exports}(m) &=& (\X{ex}.\ENAME, \X{im}.\IMODULE, \X{im}.\INAME)^\ast \\
311311
&& \qquad (\iff \X{ex}^\ast = m.\MEXPORTS \\
312-
&& \qquad\quad \wedge~\X{im} = \exportimport(m, \X{ex}.\EDESC) \\
312+
&& \qquad\quad \wedge~\X{im} = \edexportimport(m, \X{ex}.\EDESC) \\
313313
&& \qquad\quad \wedge~\X{im} \neq \epsilon \\
314314
&& \qquad\quad \wedge~\vdashmodule m : \externtype^\ast \to {\externtype'}^\ast) \\
315315
\end{array}

document/core/syntax/modules.rst

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -360,19 +360,23 @@ A *direct export* is one where the export references a function, table, memory,
360360

361361
An *indirect export* (or *re-export*) is one where the export references a function, table, memory, or global that the module imports.
362362

363-
For an export :math:`\export` in module :math:`m`, the export is direct when :math:`\exportimport(m, \export.\EDESC) = \epsilon` and indirect otherwise, where
364-
the import corresponding to an export description is defined by:
363+
For an export :math:`\export` in module :math:`m`, the export is direct when :math:`\edexportimport(m, \export.\EDESC) = \epsilon` and indirect otherwise, where
364+
the import corresponding to an export descriptor is defined by:
365365

366366
.. math::
367367
\begin{array}{lclll}
368368
\F{exportimport}(m, \exportdesc) &=& m.\MIMPORTS[i] && (\iff \exportdesc = \EDFUNC~\funcidx \\
369-
&&&& \quad \wedge~\exists~i~\colon \ m.\MIMPORTS[i].\IDESC = \IDFUNC~\typeidx \\
369+
&&&& \quad \wedge~\exists~i~\colon~\funcidx = |\{j ~|~ j < i \\
370+
&&&& \quad \quad \wedge~m.\MIMPORTS[j].\IDESC = \IDFUNC~\typeidx' \}|) \\
370371
\F{exportimport}(m, \exportdesc) &=& m.\MIMPORTS[i] && (\iff \exportdesc = \EDTABLE~\tableidx \\
371-
&&&& \quad \wedge~\exists~i~\colon \ m.\MIMPORTS[i].\IDESC = \IDTABLE~\tabletype \\
372+
&&&& \quad \wedge~\exists~i~\colon~\tableidx = |\{j ~|~ j < i \\
373+
&&&& \quad \quad \wedge~m.\MIMPORTS[j].\IDESC = \IDTABLE~\tabletype' \}|) \\
372374
\F{exportimport}(m, \exportdesc) &=& m.\MIMPORTS[i] && (\iff \exportdesc = \EDMEM~\memidx \\
373-
&&&& \quad \wedge~\exists~i~\colon \ m.\MIMPORTS[i].\IDESC = \IDMEM~\memtype \\
375+
&&&& \quad \wedge~\exists~i~\colon~\memidx = |\{j ~|~ j < i \\
376+
&&&& \quad \quad \wedge~m.\MIMPORTS[j].\IDESC = \IDMEM~\memtype' \}|) \\
374377
\F{exportimport}(m, \exportdesc) &=& m.\MIMPORTS[i] && (\iff \exportdesc = \EDGLOBAL~\globalidx \\
375-
&&&& \quad \wedge~\exists~i~\colon \ m.\MIMPORTS[i].\IDESC = \IDGLOBAL~\globaltype \\
378+
&&&& \quad \wedge~\exists~i~\colon~\globalidx = |\{j ~|~ j < i \\
379+
&&&& \quad \quad \wedge~m.\MIMPORTS[j].\IDESC = \IDGLOBAL~\globaltype' \}|) \\
376380
\F{exportimport}(m, \exportdesc) &=& \epsilon && (\otherwise) \\
377381
\end{array}
378382

document/core/util/macros.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@
346346
.. |edtables| mathdef:: \xref{syntax/modules}{syntax-exportdesc}{\F{tables}}
347347
.. |edmems| mathdef:: \xref{syntax/modules}{syntax-exportdesc}{\F{mems}}
348348
.. |edglobals| mathdef:: \xref{syntax/modules}{syntax-exportdesc}{\F{globals}}
349-
.. |exportimport| mathdef:: \xref{syntax/modules}{syntax-export}{\F{import\_for\_export}}
349+
.. |edexportimport| mathdef:: \xref{syntax/modules}{syntax-export}{\F{exportimport}}
350350

351351

352352
.. Instructions, terminals

0 commit comments

Comments
 (0)