WASM: Support `Custom Page Sizes` proposal
vshymanskyy opened this issue ยท 5 comments
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
This would allow generating really tiny wasm modules ๐
Some notes:
- Virgil currently generates a wasm file that allocates 3 pages of memory even for the simplest module.
- Data goes to the second page, I assume the first page is allocated for the stack.
- I couldn't find
v3c
options that could influence this behaviour (i.e. allocate a single wasm page with a stack of 4KB)
It's a good suggestion. I started implementing custom page sizes in Wizard, but didn't even think of utilizing it in Virgil. Would certainly make it possible to target embedded Wasm with Virgil, and it's not too much work.
WIP, haven't tested it yet: #272
@vshymanskyy What's the status of wasm3's support? I see it as in-progress on the wasm3 repo.
It was merged, but wasn't used with any real wasm modules yet. Virgil may present an opportunity ๐
Welp, at least one test passed on wasmtime, so I merged the PR. I can test more exhaustively later, but I'll close the issue for now. Feel to reopen if you encounter issues!
Thanks much!