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
{{ message }}
This repository was archived by the owner on Nov 3, 2021. It is now read-only.
Copy file name to clipboardExpand all lines: document/core/exec/runtime.rst
+55-5Lines changed: 55 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ Store
60
60
~~~~~
61
61
62
62
The *store* represents all global state that can be manipulated by WebAssembly programs.
63
-
It consists of the runtime representation of all *instances* of :ref:`functions <syntax-funcinst>`, :ref:`tables <syntax-tableinst>`, :ref:`memories <syntax-meminst>`, and :ref:`globals <syntax-globalinst>` that have been :ref:`allocated <alloc>` during the life time of the abstract machine. [#gc]_
63
+
It consists of the runtime representation of all *instances* of :ref:`functions <syntax-funcinst>`, :ref:`tables <syntax-tableinst>`, :ref:`memories <syntax-meminst>`, and :ref:`globals <syntax-globalinst>`, :ref:`element segments <syntax-eleminst>`, and :ref:`data segments <syntax-datainst>` that have been :ref:`allocated <alloc>` during the life time of the abstract machine. [#gc]_
64
64
65
65
Syntactically, the store is defined as a :ref:`record <notation-record>` listing the existing instances of each category:
66
66
@@ -71,7 +71,9 @@ Syntactically, the store is defined as a :ref:`record <notation-record>` listing
71
71
\SFUNCS & \funcinst^\ast, \\
72
72
\STABLES & \tableinst^\ast, \\
73
73
\SMEMS & \meminst^\ast, \\
74
-
\SGLOBALS & \globalinst^\ast ~\} \\
74
+
\SGLOBALS & \globalinst^\ast, \\
75
+
\SELEM & (\eleminst^?)^\ast, \\
76
+
\SDATA & (\datainst^?)^\ast ~\} \\
75
77
\end{array}
76
78
\end{array}
77
79
@@ -87,25 +89,31 @@ Convention
87
89
* The meta variable :math:`S` ranges over stores where clear from context.
88
90
89
91
90
-
.. index:: ! address, store, function instance, table instance, memory instance, global instance, embedder
92
+
.. index:: ! address, store, function instance, table instance, memory instance, global instance, element instance, data instance, embedder
91
93
pair: abstract syntax; function address
92
94
pair: abstract syntax; table address
93
95
pair: abstract syntax; memory address
94
96
pair: abstract syntax; global address
97
+
pair: abstract syntax; element address
98
+
pair: abstract syntax; data address
95
99
pair: function; address
96
100
pair: table; address
97
101
pair: memory; address
98
102
pair: global; address
103
+
pair: element; address
104
+
pair: data; address
99
105
.. _syntax-funcaddr:
100
106
.. _syntax-tableaddr:
101
107
.. _syntax-memaddr:
102
108
.. _syntax-globaladdr:
109
+
.. _syntax-elemaddr:
110
+
.. _syntax-dataaddr:
103
111
.. _syntax-addr:
104
112
105
113
Addresses
106
114
~~~~~~~~~
107
115
108
-
:ref:`Function instances <syntax-funcinst>`, :ref:`table instances <syntax-tableinst>`, :ref:`memory instances <syntax-meminst>`, and :ref:`global instances <syntax-globalinst>` in the :ref:`store <syntax-store>` are referenced with abstract *addresses*.
116
+
:ref:`Function instances <syntax-funcinst>`, :ref:`table instances <syntax-tableinst>`, :ref:`memory instances <syntax-meminst>`, and :ref:`global instances <syntax-globalinst>`, :ref:`element instances <syntax-eleminst>`, and :ref:`data instances <syntax-datainst>` in the :ref:`store <syntax-store>` are referenced with abstract *addresses*.
109
117
These are simply indices into the respective store component.
110
118
111
119
.. math::
@@ -120,6 +128,10 @@ These are simply indices into the respective store component.
120
128
\addr \\
121
129
\production{(global address)} & \globaladdr &::=&
122
130
\addr \\
131
+
\production{(element address)} & \elemaddr &::=&
132
+
\addr \\
133
+
\production{(data address)} & \dataaddr &::=&
134
+
\addr \\
123
135
\end{array}
124
136
125
137
An :ref:`embedder <embedder>` may assign identity to :ref:`exported <syntax-export>` store objects corresponding to their addresses,
@@ -137,7 +149,7 @@ even where this identity is not observable from within WebAssembly code itself
137
149
hence logical addresses can be arbitrarily large natural numbers.
138
150
139
151
140
-
.. index:: ! instance, function type, function instance, table instance, memory instance, global instance, export instance, table address, memory address, global address, index, name
152
+
.. index:: ! instance, function type, function instance, table instance, memory instance, global instance, element instance, data instance, export instance, table address, memory address, global address, element address, data address, index, name
141
153
pair: abstract syntax; module instance
142
154
pair: module; instance
143
155
.. _syntax-moduleinst:
@@ -158,6 +170,8 @@ and collects runtime representations of all entities that are imported, defined,
158
170
\MITABLES & \tableaddr^\ast, \\
159
171
\MIMEMS & \memaddr^\ast, \\
160
172
\MIGLOBALS & \globaladdr^\ast, \\
173
+
\MIELEMS & (\elemaddr^?)^\ast, \\
174
+
\MIDATAS & (\dataaddr^?)^\ast, \\
161
175
\MIEXPORTS & \exportinst^\ast ~\} \\
162
176
\end{array}
163
177
\end{array}
@@ -275,6 +289,42 @@ It holds an individual :ref:`value <syntax-val>` and a flag indicating whether i
275
289
The value of mutable globals can be mutated through :ref:`variable instructions <syntax-instr-variable>` or by external means provided by the :ref:`embedder <embedder>`.
276
290
277
291
292
+
.. index:: ! element instance, element segment, embedder, element expression
293
+
pair: abstract syntax; element instance
294
+
pair: element; instance
295
+
.. _syntax-eleminst:
296
+
297
+
Element Instances
298
+
~~~~~~~~~~~~~~~~~
299
+
300
+
An *element instance* is the runtime representation of an :ref:`element segment <syntax-elem>`.
301
+
It holds a vector of :ref:`element expressions <syntax-elemexpr>`.
302
+
303
+
.. math::
304
+
\begin{array}{llll}
305
+
\production{(element instance)} & \eleminst &::=&
306
+
\{ \EIINIT~\vec(\elemexpr) \} \\
307
+
\end{array}
308
+
309
+
310
+
.. index:: ! data instance, data segment, embedder, byte
311
+
pair: abstract syntax; data instance
312
+
pair: data; instance
313
+
.. _syntax-datainst:
314
+
315
+
Data Instances
316
+
~~~~~~~~~~~~~~
317
+
318
+
An *data instance* is the runtime representation of a :ref:`data segment <syntax-data>`.
319
+
It holds a vector of :ref:`bytes <syntax-byte>`.
320
+
321
+
.. math::
322
+
\begin{array}{llll}
323
+
\production{(data instance)} & \datainst &::=&
324
+
\{ \DIINIT~\vec(\byte) \} \\
325
+
\end{array}
326
+
327
+
278
328
.. index:: ! export instance, export, name, external value
0 commit comments