@@ -6,6 +6,10 @@ This page describes a proposal to support linear memory of sizes larger than
6
6
2<sup >32</sup > bits. It provides no new instructions, but instead extends the
7
7
currently existing instructions to allow 64-bit indexes.
8
8
9
+ In addition, in order to support source languages with 64-bit pointer width,
10
+ this proposal also extends tables to allow 64-bit indexes. This addition was
11
+ made during phase 3 of the proposal and we refer to this addition as "table64".
12
+
9
13
### Implementation Status
10
14
11
15
- spec interpreter: Done
@@ -16,6 +20,16 @@ currently existing instructions to allow 64-bit indexes.
16
20
- binaryen: [ Done] ( https://github.com/WebAssembly/binaryen/pull/3202 )
17
21
- emscripten: [ Done] ( https://github.com/emscripten-core/emscripten/pull/17803 )
18
22
23
+ ### Implementation Status (table64)
24
+
25
+ - spec interpreter: -
26
+ - v8/chrome: -
27
+ - Firefox: -
28
+ - Safari: -
29
+ - wabt: -
30
+ - binaryen: -
31
+ - emscripten: -
32
+
19
33
## Motivation
20
34
21
35
[ WebAssembly linear memory objects] [ memory object ] have sizes measured in
@@ -52,11 +66,10 @@ have to support 32-bit memory addresses in their ABI.
52
66
- ` limits(iv) ::= {min iv, max iv?} `
53
67
The parameter is omitted where it is immaterial.
54
68
55
- * The [ table type] [ syntax tabletype ] continues to use i32 indices
56
- - ` tabletype ::= limits(i32) elemtype `
57
-
58
- * The [ memory type] [ syntax memtype ] structure is extended to have an index type
69
+ * The [ memory type] [ syntax memtype ] and [ table type] [ syntax tabletype ]
70
+ structures are extended to include an index type
59
71
- ` memtype ::= idxtype limits(type(iv)) `
72
+ - ` tabletype ::= idxtype limits(type(iv)) reftype `
60
73
- where
61
74
```
62
75
type(\i32) = \I32
@@ -66,7 +79,6 @@ have to support 32-bit memory addresses in their ABI.
66
79
* The [memarg][syntax memarg] immediate is changed to allow a 64-bit offset
67
80
- `memarg ::= {offset u64, align u32}`
68
81
69
-
70
82
### Validation
71
83
72
84
* Index types are classified by their value range:
@@ -79,14 +91,15 @@ have to support 32-bit memory addresses in their ABI.
79
91
⊦ i64 : 2**48
80
92
```
81
93
82
- * [Memory page limits][valid limits] are classified by their index types
94
+ * [Memory page limits][valid limits] and [Table entry limits][valid limits] are
95
+ classified by their respective index types
83
96
- ```
84
97
⊦ it : k n <= k (m <= k)? (n < m)?
85
98
-------------------------------------------
86
99
⊦ { min n, max m? } : it
87
100
```
88
101
89
- * Memory types are validated accordingly:
102
+ * Memory and Table types are validated accordingly:
90
103
- ```
91
104
⊦ limits : it
92
105
--------------
@@ -151,6 +164,56 @@ have to support 32-bit memory addresses in their ABI.
151
164
```
152
165
- (and similar for memory instructions from other proposals)
153
166
167
+ * [Table instructions][valid tableinst] are changed to use the index type
168
+ - call_indirect x y
169
+ - ```
170
+ C.tables[x] = it limits t C.types[y] = [t1*] → [t2*]
171
+ -------------------------------------------------------
172
+ C ⊦ call_indirect x y : [t1* it] → [t2*]
173
+ ```
174
+ - table.get x
175
+ - ```
176
+ C.tables[x] = it limits t
177
+ ------------------------------
178
+ C ⊦ table.get x : [it] → [t]
179
+ ```
180
+ - table.set x
181
+ - ```
182
+ C.tables[x] = it limits t
183
+ ------------------------------
184
+ C ⊦ table.set x : [it] → [t]
185
+ ```
186
+ - table.size x
187
+ - ```
188
+ C.tables[x] = it limits t
189
+ ------------------------------
190
+ C ⊦ table.size x : [] → [it]
191
+ ```
192
+ - table.grow x
193
+ - ```
194
+ C.tables[x] = it limits t
195
+ -------------------------------
196
+ C ⊦ table.grow x : [it] → [it]
197
+ ```
198
+ - table.fill x
199
+ - ```
200
+ C.tables[x] = it limits t
201
+ ----------------------------------
202
+ C ⊦ tables.fill x : [it t it] → []
203
+ ```
204
+ - table.copy x y
205
+ - ```
206
+ C.tables[x] = it limits t
207
+ ----------------------------------
208
+ C ⊦ table.copy x : [it it it] → []
209
+ ```
210
+ - table.init x y
211
+ - ```
212
+ C.tables[x] = it limits t C.elems[y] = ok
213
+ -----------------------------------------------
214
+ C ⊦ table.init x y : [it i32 i32] → []
215
+ ```
216
+
154
217
* The [SIMD proposal][simd] extends `t.load memarg` and `t.store memarg`
155
218
above such that `t` may now also be `v128`, which accesses a 16-byte quantity
156
219
in memory that is also 16-byte aligned.
@@ -329,6 +392,7 @@ have to support 32-bit memory addresses in their ABI.
329
392
[syntax memarg]: https://webassembly.github.io/spec/core/syntax/instructions.html#syntax-memarg
330
393
[valid limits]: https://webassembly.github.io/spec/core/valid/types.html#limits
331
394
[valid meminst]: https://webassembly.github.io/spec/core/valid/instructions.html#memory-instructions
395
+ [valid tableinst]: https://webassembly.github.io/spec/core/valid/instructions.html#table-instructions
332
396
[valid data]: https://webassembly.github.io/spec/core/valid/modules.html#data-segments
333
397
[exec mem]: https://webassembly.github.io/spec/core/exec/runtime.html#memory-instances
334
398
[exec meminst]: https://webassembly.github.io/spec/core/exec/instructions.html#memory-instructions
0 commit comments