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