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/exec/relaxed.rst
+65-32Lines changed: 65 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,41 @@
6
6
Relaxed Memory Model
7
7
--------------------
8
8
9
-
.. todo:: intro, cite [#cite-oopsla2019]_
10
-
.. todo:: link this section with operational semantics
9
+
The execution of a WebAssembly program gives rise to a :ref:`trace <relaxed-trace>` of events. WebAssembly's relaxed memory model constrains the observable behaviours of the program's execution by defining a :ref:`consistency <relaxed-consistent>` condition on the trace of events.
10
+
11
+
.. note::
12
+
A relaxed memory model is necessary to describe the behaviour of programs exhibiting *shared memory concurrency*.
13
+
WebAssembly's relaxed memory model is heavily based on those of C/C++11 and JavaScript.
14
+
The relaxed memory model decribed here is derived from the following article: [#cite-oopsla2019]_.
15
+
16
+
17
+
.. _relaxed-aux:
18
+
19
+
Preliminary Definitions
20
+
~~~~~~~~~~~~~~~~~~~~~~~
21
+
22
+
.. math::
23
+
\begin{array}{lcl}
24
+
\timeevt\ldots & = & \ldots \\
25
+
\\
26
+
\readingact\ldots & = & \ldots \\
27
+
\ordact\ldots & = & \ldots \\
28
+
\overlapact\ldots & = & \ldots \\
29
+
\\
30
+
\readact\ldots & = & \ldots \\
31
+
\\
32
+
\writingact\ldots & = & \ldots \\
33
+
\\
34
+
\writeact\ldots & = & \ldots \\
35
+
\offsetact\ldots & = & \ldots \\
36
+
\\
37
+
\syncact\ldots & = & \ldots \\
38
+
\rangeact\ldots & = & \ldots \\
39
+
\\
40
+
\tearfreeact\ldots & = & \ldots \\
41
+
\end{array}
42
+
43
+
.. todo:: need to refactor len+data in actions
11
44
12
45
13
46
.. _relaxed-trace:
@@ -21,7 +54,7 @@ A trace is a coinductive set of :ref:`events <syntax-evt>`. A trace is considere
Copy file name to clipboardExpand all lines: document/core/exec/runtime.rst
+18-7Lines changed: 18 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -193,6 +193,7 @@ even where this identity is not observable from within WebAssembly code itself
193
193
.. index:: ! time stamp, ! happens-before, thread, event
194
194
.. _syntax-time:
195
195
.. _relaxed-prechb:
196
+
.. _relaxed-prectot:
196
197
197
198
Time Stamps
198
199
~~~~~~~~~~~
@@ -208,8 +209,12 @@ the semantics uses a notion of abstract *time stamps*.
208
209
209
210
Each time stamp denotes a discrete point in time, and is drawn from an infinite set.
210
211
The shape of time stamps is not specified or observable.
211
-
However, time stamps form a partially ordered set:
212
-
a time stamp :math:`\time_1` *happens before* :math:`\time_2`, written :math:`\time_1\prechb\time_2`, if it is known to have occurred earlier in time.
212
+
213
+
Time stamps are associated with a total order -- if a time stamp :math:`\time_1` is *totally ordered before* time stamp :math:`\time_2`, this is written as :math:`\time_1\prectot\time_2`.
214
+
215
+
Time stamps are also associated with a *happens before* partial order -- if a time stamp :math:`\time_1` *happens before* :math:`\time_2`, this is written as :math:`\time_1\prechb\time_2`.
216
+
217
+
During the execution of WebAssembly code, time stamped :ref:`events <syntax-evt>` may be emitted which are related by one or both of these orderings, thus constraining the code's observable behaviours according to WebAssembly's :ref:`relaxed memory model <relaxed>`.
213
218
214
219
.. note:
215
220
@@ -218,9 +223,6 @@ a time stamp :math:`\time_1` *happens before* :math:`\time_2`, written :math:`\t
218
223
219
224
The ordering is partial because some events have an unspecified relative order -- in particular, when they occur in separate threads without intervening synchronisation.
220
225
221
-
.. _relaxed-prectot:
222
-
.. todo:: define prectot here as well?
223
-
224
226
225
227
.. _notation-attime:
226
228
@@ -729,8 +731,8 @@ Its form and meaning is outside the scope of this specification.
729
731
An :ref:`embedder <embedder>` may define a custom set of host actions and respective ordering constraints to model other forms of interactions that are not expressible within WebAssembly, but whose ordering relative to WebAssembly events is relevant for the combined semantics.
730
732
731
733
732
-
Convention
733
-
..........
734
+
Conventions
735
+
...........
734
736
735
737
* The actions :math:`\ARD_{\ord}` and :math:`\AWR_{\ord}` are abbreviated to just :math:`\ARD` and :math:`\AWR` when :math:`\ord` is :math:`\UNORD`.
736
738
@@ -745,6 +747,15 @@ The following auxiliary definition is used to classify whether an access will *t
745
747
746
748
747
749
.. todo:: better description of tearing
750
+
751
+
Relations between time stamps are lifted to relations between events.
0 commit comments