Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 4477d04

Browse files
committed
Fill in overview todos
1 parent 79c9aa3 commit 4477d04

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

proposals/multi-memory/Overview.md

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,43 @@ The design of this extension is almost entirely canonical. Concretely:
4444

4545
### Instructions
4646

47-
#### Loads and Stores
47+
Except where noted, the following changes apply to each `load` and `store` instruction as well as to `memory.size` and `memory.grow`. Corresponding changes will be necessary for the new instructions introduced by the bulk memory proposal.instructions.
4848

49-
TODO
49+
Abstract syntax:
5050

51-
#### Other Memory Instructions
51+
* Add a memory index immediate.
5252

53-
TODO
53+
Validation:
54+
55+
* Check the memory index immediate instead of index 0.
56+
57+
Execution:
58+
59+
* Access the memory according to their index immediate instead of memory 0.
60+
61+
Binary format:
62+
63+
* For loads and stores: Reinterpret the alignment value in the `memarg` as a bitfield; if bit 6 (the MSB of the first LEB byte) is set, then an `i32` memory index follows after the offset immediate (even with SIMD, alignment must not currently be larger than 4 in the logarithmic encoding, i.e., taking up the lower 3 bits, so this is more than safe).
64+
65+
* For other memory instructions: Replace the hard-coded `0x00` bytes with an `i32` memory index.
66+
67+
Text format:
68+
69+
* Add an optional `memidx` immediate that defaults to 0 if absent (for backwards compatibility). In the case of loads and stores, this index must occur before the optional alignment and offset immediates.
5470

5571

5672
### Modules
5773

58-
#### Data Segments
74+
#### Data Segments and Memory Exports
5975

60-
TODO
76+
The abstract syntax for data segments and memory exports already carry a memory index that is checked and used accordingly (even though it currently is known to be 0). Binary and text format also already have the corresponding index parameter (which is optional and defaults to 0 in the case of data segments).
6177

62-
#### Exports
78+
So technically, no spec change is necessary, though implementations now need to deal with the possibility that the index is not 0.
6379

64-
TODO
6580

6681
#### Modules
6782

68-
TODO
83+
* Validation for modules no longer checks that there is at most 1 memory defined or imported.
6984

7085

7186
## Implementation

0 commit comments

Comments
 (0)