Skip to content

Commit f23e5e9

Browse files
authored
Update overview (#7)
Includes changes for bulk memory instructions and memory abbreviations. See WebAssembly/memory64#5 and WebAssembly/memory64#6.
1 parent c49b677 commit f23e5e9

File tree

1 file changed

+59
-3
lines changed

1 file changed

+59
-3
lines changed

proposals/memory64/Overview.md

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,52 @@ have to support 32-bit memory addresses in their ABI.
100100
-----------------------------
101101
C ⊦ memory.grow : [it] → [it]
102102
```
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+
```
103121
- (and similar for memory instructions from other proposals)
104122
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+
105149
* [Data segment validation][valid data] uses the index type
106150
- ```
107151
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.
163207
164208
### Text format
165209
210+
* There is a new index type:
211+
- ```
212+
indextype ::= 'i32' | 'i64'
213+
```
214+
166215
* The [memory type][text memtype] definition is extended to allow an optional
167216
index type, which must be either `i32` or `i64`
168217
- ```
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
172220
```
173221
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+
174228
175229
[memory object]: https://webassembly.github.io/spec/core/syntax/modules.html#memories
176230
[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.
192246
[binary memtype]: https://webassembly.github.io/spec/core/binary/types.html#memory-types
193247
[binary memarg]: https://webassembly.github.io/spec/core/binary/instructions.html#binary-memarg
194248
[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

Comments
 (0)