A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Increase minimum heap length to 64kb

luke
2014-08-14

The heap length size restrictions are chosen to allow (but certainly not require) page protection tricks to avoid out-of-bounds checks on some platforms. We’re starting to see 64kb page sizes (viz., an option on ARM64), so we might as well switch to that; in practice, virtually all asm.js apps should have much bigger heaps.

Note: if the platform has a page size bigger than the heap, we can still offset the heap inside the page so that the ends line up (although this could potentially inhibit other future optimizations). Thus, with this choice of minimum heap size, we’re just trying to simplify the job of the JS engine by allowing it to avoid handling degenerate cases on all popular current and coming platforms; in a future where a >64kb page-sized platform becomes popular, we can still handle it w/o undue loss of optimization.

azakai
2014-08-14

Do we need to change not just the minimum, but the multiple? That is, minimum 64kb or a multiple of 64kb? Or just the minimum needs to change?

luke
2014-08-14

Just the lower bound. So the only change would be changing “12” to “16” in the byteLength bullet in Section 7.

azakai
2014-08-14

Ok, sounds good to me. Pushing the minimum size to emscripten to 64k now. (I doubt anyone would need to use less, and if so, they can still use smaller sizes in emscripten programs if they disable full asm.js support.)