Conversation
|
The rationale for 64KiB is even though the vast majority of platforms and CPUs provide 4KiB pages, not all CPUs do, and some operating systems further restrict memory mappings to something larger than the physical page size. In particular: sparc: 8KiB |
Rationale.md
Outdated
There was a problem hiding this comment.
This sentence reads a little awkward. Possible suggestion: Programs can depend on this fixed page size and still remain portable across all WebAssembly engines [Full Stop]. And, engines can rely on this invariant to employ efficient virtual memory techniques for bounds checking.
|
lgtm, with just a few minor wording suggestions |
|
Suggestions integrated. |
|
I support this for memory sizing. It might have been useful for a garbage collector written in wasm to be able to use a smaller page size for a write barrier - not sure just how much of a difference this makes. I think the rationale overstates the utility because virtual-memory-based bounds checking seems to only be an option for wasm32 in a 64 bit runtime. It might also simplify a start-of-usable-memory option - a 64k start might be adequate for many systems. Are/could/should data segments be defined to be page aligned. |
|
lgtm, although it might be nice to add a FutureFeatures.md section for "Large page support" linked to by the last sentence of Rationale.md that gives a bit more of the details. |
|
@JSStats Virtual-memory-based sandboxing has numerous potential uses. One example would be an optimizer that combines the checks for several accesses that have the same base but different constant offsets (within a reasonable size), using a guard region to catch offsets that run out of bounds. Another example would be an optimizer that eliminates bounds checks in loops with small-stride access patterns by having a guard page at the end of memory and assuming that either the loop will terminate on its own or it'll hit the guard page, and so it doesn't need any bounds checking inside the loop. |
|
Added links back and forth re: large pages in FutureFeatres. |
Fix the WebAssembly page size at 64KiB.
Removes every trace of existence of page_size from the source, the testfiles and README.md WebAssembly/design#442
This PR updates the design repository to define a fixed WebAssembly page size of 64KiB.
The rationale for this change is to achieve efficient virtual-memory-based bounds checks without resorting to nondeterminism in the page_size operator. Experience has shown that programs tend to become dependent on one particular value of PAGE_SIZE (e.g. 4KB) and not be fastidious users of provided constructs that abstract over varying page sizes. Such programs break on moving from one platform to another, and we'd like to avoid those programs breaking when moving from one engine to another.