Closed fitzgen closed 6 months ago
Consistency with prior art in the text format suggests the following:
Alignment expressed as log2 in the binary format but written out in the text format, as you suggest.
The page size in a memory type has a role (relative to the limits) analogous to the element type in table types. That suggests to position it alike, i.e., put it after the limits. The index type (for memory/table 64) goes before.
As for keyword, I'd avoid the ugly underscore and just say page
.
All together, along with the Wasm 64 proposal, that would give us the following consistent scheme:
(memory i64 1 10 (page 4096))
(table i64 1 10 (ref $t))
The overview is using the following strawperson syntax for specifying a 512-byte page size, where the power-of-two page size is directly written:
This means that text parsers would need to check for and reject non-power-of-two values like
(page_size 7)
.But if we use log-encoding in the binary format, maybe we should also use logs in the text format? Relevant prior art is alignment of memory accesses, which is log-encoded in the binary but the power-of-two alignment is written directly in the text format. And therefore text parsers do need to check for and reject non-power-of-two alignments. I suppose we should do the same thing with page sizes here, unless anyone wants to argue otherwise.
Also feel free to bikeshed the
(page_size N)
syntax, I guess.