You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: document/core/appendix/properties.rst
-35Lines changed: 0 additions & 35 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -156,52 +156,17 @@ Module instances are classified by *module contexts*, which are regular :ref:`co
156
156
157
157
* The :ref:`function type <syntax-functype>` :math:`\functype` must be :ref:`valid <valid-functype>`.
158
158
159
-
* Let :math:`[t_1^\ast] \to [t_2^\ast]` be the :ref:`function type <syntax-functype>` :math:`\functype`.
160
-
161
-
* For every :ref:`valid <valid-store>` :ref:`store <syntax-store>` :math:`S_1` :ref:`extending <extend-store>` :math:`S` and every sequence :math:`\val^\ast` of :ref:`values <syntax-val>` whose :ref:`types <valid-val>` coincide with :math:`t_1^\ast`:
162
-
163
-
* :ref:`Executing <exec-invoke-host>` :math:`\X{hf}` in store :math:`S_1` with arguments :math:`\val^\ast` has a non-empty set of possible outcomes.
164
-
165
-
* For every element :math:`R` of this set:
166
-
167
-
* Either :math:`R` must be :math:`\bot` (i.e., divergence).
168
-
169
-
* Or :math:`R` consists of a :ref:`valid <valid-store>` :ref:`store <syntax-store>` :math:`S_2` :ref:`extending <extend-store>` :math:`S_1` and a :ref:`result <syntax-result>` :math:`\result` whose :ref:`type <valid-result>` coincides with :math:`[t_2^\ast]`.
170
-
171
159
* Then the function instance is valid with :ref:`function type <syntax-functype>` :math:`\functype`.
S \vdashfuncinst \{\FITYPE~[t_1^\ast] \to [t_2^\ast], \FIHOSTCODE~\X{hf}\} : [t_1^\ast] \to [t_2^\ast]
196
168
}
197
169
198
-
.. note::
199
-
This rule states that, if appropriate pre-conditions about store and arguments are satisfied, then executing the host function must satisfy appropriate post-conditions about store and results.
200
-
The post-conditions match the ones in the :ref:`execution rule <exec-invoke-host>` for invoking host functions.
201
-
202
-
Any store under which the function is invoked is assumed to be an extension of the current store.
203
-
That way, the function itself is able to make sufficient assumptions about future stores.
204
-
205
170
206
171
.. index:: table type, table instance, limits, function address
Copy file name to clipboardExpand all lines: document/core/exec/instructions.rst
+1-17Lines changed: 1 addition & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4149,9 +4149,7 @@ During its execution, a host function call may do any of the following.
4149
4149
- Terminate with a list of values that respects the host function's type annotation.
4150
4150
- Terminate with a trap.
4151
4151
4152
-
.. todo:: better prose
4153
-
4154
-
.. todo:: reconcile with old-style host function formulation
4152
+
.. todo:: better prose, evaluate alternative approach where host may directly emit shared memory events
4155
4153
4156
4154
.. math::
4157
4155
~\\[-1ex]
@@ -4189,20 +4187,6 @@ During its execution, a host function call may do any of the following.
4189
4187
\end{array}
4190
4188
\end{array}
4191
4189
4192
-
.. todo:: reconcile with old-style host function formulation
4193
-
4194
-
Here, :math:`\X{hf}(S; \val^n)` denotes the implementation-defined execution of host function :math:`\X{hf}` in current store :math:`S` with arguments :math:`\val^n`.
4195
-
It yields a set of possible outcomes, where each element is either a pair of a modified store :math:`S'` and a :ref:`result <syntax-result>`
4196
-
or the special value :math:`\bot` indicating divergence.
4197
-
A host function is non-deterministic if there is at least one argument for which the set of outcomes is not singular.
4198
-
4199
-
For a WebAssembly implementation to be :ref:`sound <soundness>` in the presence of host functions,
4200
-
every :ref:`host function instance <syntax-funcinst>` must be :ref:`valid <valid-hostfuncinst>`,
4201
-
which means that it adheres to suitable pre- and post-conditions:
4202
-
under a :ref:`valid store <valid-store>` :math:`S`, and given arguments :math:`\val^n` matching the ascribed parameter types :math:`t_1^n`,
4203
-
executing the host function must yield a non-empty set of possible outcomes each of which is either divergence or consists of a valid store :math:`S'` that is an :ref:`extension <extend-store>` of :math:`S` and a result matching the ascribed return types :math:`t_2^m`.
4204
-
All these notions are made precise in the :ref:`Appendix <soundness>`.
4205
-
4206
4190
.. note::
4207
4191
A host function can call back into WebAssembly by :ref:`invoking <exec-invocation>` a function :ref:`exported <syntax-export>` from a :ref:`module <syntax-module>`.
4208
4192
However, the effects of any such call are subsumed by the non-deterministic behavior allowed for the host function.
Copy file name to clipboardExpand all lines: document/core/exec/modules.rst
+17-11Lines changed: 17 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -658,11 +658,15 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
658
658
659
659
4. For each :ref:`external value <syntax-externval>` :math:`\externval_i` in :math:`\externval^n` and :ref:`external type <syntax-externtype>` :math:`\externtype'_i` in :math:`\externtype_{\F{im}}^n`, do:
660
660
661
-
a. If :math:`\externval_i` is not :ref:`valid <valid-externval>` with an :ref:`external type <syntax-externtype>` :math:`\externtype_i` in store :math:`S`, then:
661
+
a. If :math:`\externval_i` is :ref:`valid <valid-externval>` with an :ref:`external type <syntax-externtype>` :math:`\externtype_i` in store :math:`S`, then:
662
+
663
+
i. Assert: in checking the validity of :math:`\externval_i`, the :ref:`shared memory actions <syntax-act>` :math:`\X{act}_i^?` are performed.
664
+
665
+
b. Else:
662
666
663
667
i. Fail.
664
668
665
-
b. If :math:`\externtype_i` does not :ref:`match <match-externtype>` :math:`\externtype'_i`, then:
669
+
c. If :math:`\externtype_i` does not :ref:`match <match-externtype>` :math:`\externtype'_i`, then:
666
670
667
671
i. Fail.
668
672
@@ -698,11 +702,13 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
698
702
699
703
11. Let :math:`\moduleinst` be a new module instance :ref:`allocated <alloc-module>` from :math:`\module` in store :math:`S` with imports :math:`\externval^n`, global initializer values :math:`\val^\ast`, and element segment contents :math:`(\reff^\ast)^\ast`, and let :math:`S'` be the extended store produced by module allocation.
700
704
701
-
12. Let :math:`F` be the auxiliary :ref:`frame <syntax-frame>` :math:`\{ \AMODULE~\moduleinst, \ALOCALS~\epsilon \}`.
705
+
12. Assert: in allocating :math:`\moduleinst`, the :ref:`shared memory actions <syntax-act>` :math:`\X{act_{\F{m}}}^\ast` are performed.
706
+
707
+
13. Let :math:`F` be the auxiliary :ref:`frame <syntax-frame>` :math:`\{ \AMODULE~\moduleinst, \ALOCALS~\epsilon \}`.
702
708
703
-
13. Push the frame :math:`F` to the stack.
709
+
14. Push the frame :math:`F` to the stack.
704
710
705
-
14. For each :ref:`element segment <syntax-elem>` :math:`\elem_i` in :math:`\module.\MELEMS` whose :ref:`mode <syntax-elemmode>` is of the form :math:`\EACTIVE~\{ \ETABLE~\tableidx_i, \EOFFSET~\X{einstr}^\ast_i~\END \}`, do:
711
+
15. For each :ref:`element segment <syntax-elem>` :math:`\elem_i` in :math:`\module.\MELEMS` whose :ref:`mode <syntax-elemmode>` is of the form :math:`\EACTIVE~\{ \ETABLE~\tableidx_i, \EOFFSET~\X{einstr}^\ast_i~\END \}`, do:
706
712
707
713
a. Let :math:`n` be the length of the vector :math:`\elem_i.\EINIT`.
708
714
@@ -716,11 +722,11 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
716
722
717
723
f. :ref:`Execute <exec-elem.drop>` the instruction :math:`\ELEMDROP~i`.
718
724
719
-
15. For each :ref:`element segment <syntax-elem>` :math:`\elem_i` in :math:`\module.\MELEMS` whose :ref:`mode <syntax-elemmode>` is of the form :math:`\EDECLARATIVE`, do:
725
+
16. For each :ref:`element segment <syntax-elem>` :math:`\elem_i` in :math:`\module.\MELEMS` whose :ref:`mode <syntax-elemmode>` is of the form :math:`\EDECLARATIVE`, do:
720
726
721
727
a. :ref:`Execute <exec-elem.drop>` the instruction :math:`\ELEMDROP~i`.
722
728
723
-
16. For each :ref:`data segment <syntax-data>` :math:`\data_i` in :math:`\module.\MDATAS` whose :ref:`mode <syntax-datamode>` is of the form :math:`\DACTIVE~\{ \DMEM~\memidx_i, \DOFFSET~\X{dinstr}^\ast_i~\END \}`, do:
729
+
17. For each :ref:`data segment <syntax-data>` :math:`\data_i` in :math:`\module.\MDATAS` whose :ref:`mode <syntax-datamode>` is of the form :math:`\DACTIVE~\{ \DMEM~\memidx_i, \DOFFSET~\X{dinstr}^\ast_i~\END \}`, do:
724
730
725
731
a. Assert: :math:`\memidx_i` is :math:`0`.
726
732
@@ -736,15 +742,15 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
736
742
737
743
g. :ref:`Execute <exec-data.drop>` the instruction :math:`\DATADROP~i`.
738
744
739
-
17. If the :ref:`start function <syntax-start>` :math:`\module.\MSTART` is not empty, then:
745
+
18. If the :ref:`start function <syntax-start>` :math:`\module.\MSTART` is not empty, then:
740
746
741
747
a. Let :math:`\start` be the :ref:`start function <syntax-start>` :math:`\module.\MSTART`.
742
748
743
749
b. :ref:`Execute <exec-call>` the instruction :math:`\CALL~\start.\SFUNC`.
744
750
745
-
18. Assert: due to :ref:`validation <valid-module>`, the frame :math:`F` is now on the top of the stack.
751
+
19. Assert: due to :ref:`validation <valid-module>`, the frame :math:`F` is now on the top of the stack.
746
752
747
-
19. Pop the frame :math:`F` from the stack.
753
+
20. Pop the frame :math:`F` from the stack.
748
754
749
755
750
756
.. math::
@@ -753,7 +759,7 @@ It is up to the :ref:`embedder <embedder>` to define how such conditions are rep
Copy file name to clipboardExpand all lines: document/core/exec/runtime.rst
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -666,6 +666,7 @@ This definition allows to index active labels surrounding a :ref:`branch <syntax
666
666
.. _syntax-act:
667
667
.. _syntax-ord:
668
668
.. _syntax-loc:
669
+
.. _syntax-reg:
669
670
.. _syntax-fld:
670
671
.. _syntax-storeval:
671
672
@@ -697,10 +698,12 @@ Each event is annotated with a :ref:`time stamp <syntax-time>` that uniquely ide
697
698
\SEQCST ~|~
698
699
\INIT \\
699
700
\production{(location)} & \loc &::=&
701
+
\reg[\u32] \\
702
+
\production{(region)} & \reg &::=&
700
703
\addr.\fld \\
701
704
\production{(field)} & \fld &::=&
702
705
\LLEN ~|~
703
-
\LDATA[\u32] \\
706
+
\LDATA \\
704
707
\production{(store value)} & \storeval &::=&
705
708
\val ~|~
706
709
b^\ast \\
@@ -710,8 +713,7 @@ Each event is annotated with a :ref:`time stamp <syntax-time>` that uniquely ide
710
713
.. todo:: remove spawn from events in a typed way?
711
714
712
715
The access of *mutable* shared state is performed through the |ARD|, |AWR|, and |ARMW| actions.
713
-
Each action accesses an abstract *location*, which consists of an :ref:`address <syntax-addr>` of a :ref:`shared <syntax-shared>` :ref:`memory <syntax-meminst>` instance and a symbolic *field* name in the respective object.
714
-
This is either |LLEN| for the size or |LDATA| for the vector of bytes.
716
+
Each action accesses an abstract *location*, which consists of an :ref:`address <syntax-addr>` of a :ref:`shared <syntax-shared>` :ref:`memory <syntax-meminst>` instance, a symbolic *field* name in the respective object (either |LLEN| for the size or |LDATA| for the vector of bytes), and an offset index into the field.
715
717
716
718
In each case, read and write actions record the *store value* that has been read or written, which is either a regular :ref:`value <syntax-val>` or a sequence of :ref:`bytes <syntax-byte>`, depending on the location accessed.
717
719
An |ARMW| event, performing an atomic read-modify-write access, records both the store values read (first) and written (second);
@@ -736,6 +738,8 @@ Conventions
736
738
737
739
* The actions :math:`\ARD_{\ord}` and :math:`\AWR_{\ord}` are abbreviated to just :math:`\ARD` and :math:`\AWR` when :math:`\ord` is :math:`\UNORD`.
738
740
741
+
* A location may syntactically elide its :math:`[\u32]` offset in the case that it is 0.
742
+
739
743
The following auxiliary definition is used to classify whether an access will *tear*.
0 commit comments