Support `Custom Page Sizes` proposal
Currently, the WASM page size is fixed at 64KiB, which is rather expensive in some scenarios.
WebAssembly WG proposed a new feature to handle it nicely: https://github.com/WebAssembly/custom-page-sizes/blob/main/proposals/custom-page-sizes/Overview.md
It should be rather easy to implement, and it would help to catalyse the adoption of this feature: https://github.com/AssemblyScript/assemblyscript/issues/2866
PRs for this would be very welcome.
Hi. I am currently working on including support for this feature in a WebAssembly runtime for MCUs and therefore very interested in the compilation pipeline to WebAssembly supporting this feature. It is currently impossible to run wasm-opt to run extra-optimizations on my wasm module, if the linker generates a memory with a custom page size, so I have to choose now between less waste in the linear memory size and well-optimized wasm bitcode. I am not too familiar with the binaryen code base, but happy to contribute if you expect the implementation to be easy. What are the key tasks/ features to tacke for implementing such support?
@BilelGho This should be fairly easy, but would require changes in various places:
- You would add the page size as a property on the Memory class in
wasm.h, replacing the constantkPageSize. - Find all the places in the codebase that use the constant page size
kPageSizeand make them use the new variable page size. - Add parsing and printing, in both text and binary.