@@ -100,8 +100,52 @@ have to support 32-bit memory addresses in their ABI.
100
100
-----------------------------
101
101
C ⊦ memory.grow : [it] → [it]
102
102
```
103
+ - memory.fill
104
+ - ```
105
+ C.mems[0] = limits it
106
+ -----------------------------
107
+ C ⊦ memory.fill : [it i32 it] → []
108
+ ```
109
+ - memory.copy
110
+ - ```
111
+ C.mems[0] = limits it
112
+ -----------------------------
113
+ C ⊦ memory.copy : [it it it] → []
114
+ ```
115
+ - memory.init x
116
+ - ```
117
+ C.mems[0] = limits it C.datas[x] = ok
118
+ -------------------------------------------
119
+ C ⊦ memory.init : [it i32 i32] → []
120
+ ```
103
121
- (and similar for memory instructions from other proposals)
104
122
123
+ * The [Multi-memory proposal][multi memory] extends each of these instructions
124
+ with one or two memory index immediates. The index type for that memory will
125
+ be used. For example,
126
+ - memory.size x
127
+ - ```
128
+ C.mems[x] = limits it
129
+ ---------------------------
130
+ C ⊦ memory.size x : [] → [it]
131
+ ```
132
+
133
+ `memory.copy` has two memory index immediates, so will have multiple possible
134
+ signatures:
135
+ - memory.copy d s
136
+ - ```
137
+ C.mems[d] = limits it_d C.mems[s] = limits it_s
138
+ --------------------------------------------------------
139
+ C ⊦ memory.copy d s : [it_d it_s f(it_d, it_s)] → []
140
+
141
+ where:
142
+
143
+ f(i32, i32) = i32
144
+ f(i64, i32) = i32
145
+ f(i32, i64) = i32
146
+ f(i64, i64) = i64
147
+ ```
148
+
105
149
* [Data segment validation][valid data] uses the index type
106
150
- ```
107
151
C.mems[0] = limits it C ⊦ expr: [it] C ⊦ expr const
@@ -163,14 +207,24 @@ have to support 32-bit memory addresses in their ABI.
163
207
164
208
### Text format
165
209
210
+ * There is a new index type:
211
+ - ```
212
+ indextype ::= 'i32' | 'i64'
213
+ ```
214
+
166
215
* The [memory type][text memtype] definition is extended to allow an optional
167
216
index type, which must be either `i32` or `i64`
168
217
- ```
169
- memtype ::= lim:limits ⇒ lim i32
170
- | 'i32' lim:limits ⇒ lim i32
171
- | 'i64' lim:limits ⇒ lim i64
218
+ memtype ::= lim:limits ⇒ lim i32
219
+ | it:indextype lim:limits ⇒ lim it
172
220
```
173
221
222
+ * The [memory abbreviation][text memabbrev] definition is extended to allow an
223
+ optional index type too, which must be either `i32` or `i64`
224
+ - ```
225
+ '(' 'memory' id? index_type? '(' 'data' b_n:datastring ')' ')' === ...
226
+ ```
227
+
174
228
175
229
[memory object]: https://webassembly.github.io/spec/core/syntax/modules.html#memories
176
230
[memory page]: https://webassembly.github.io/spec/core/exec/runtime.html#page-size
@@ -192,3 +246,5 @@ have to support 32-bit memory addresses in their ABI.
192
246
[binary memtype]: https://webassembly.github.io/spec/core/binary/types.html#memory-types
193
247
[binary memarg]: https://webassembly.github.io/spec/core/binary/instructions.html#binary-memarg
194
248
[text memtype]: https://webassembly.github.io/spec/core/text/types.html#text-memtype
249
+ [text memabbrev]: https://webassembly.github.io/spec/core/text/modules.html#text-mem-abbrev
250
+ [multi memory]: https://github.com/webassembly/multi-memory
0 commit comments