wasmi-labs / wasmi

WebAssembly (Wasm) interpreter.
https://wasmi-labs.github.io/wasmi/
Apache License 2.0
1.61k stars 286 forks source link

Implement the Wasm `custom-page-sizes` proposal #1197

Open Robbepop opened 1 month ago

Robbepop commented 1 month ago

This is about adding support for the custom-page-sizes Wasm proposal.

The custom-page-sizes Wasm proposal has been recently moved to Phase 3 and is moving forward quickly thus stabilization can be expected to happen soon.

Having custom-page-sizes support in Wasmi will be an enabler (in parts) for using Wasmi in even more embedded environments where memory usage is particularly constrained. Not every embedded environment can afford 64kB worth of linear memory for a single Wasm page.

Robbepop commented 1 month ago

Wasmtime introduced the MemoryTypeBuilder in order to set the various properties of a Wasm memory defined on the host side. Since Wasmi tries to implement the Wasmtime API for its users we should introduce the same API even though Wasmi's memory type isn't as complicated, yet.

Link: https://docs.rs/wasmtime/25.0.1/wasmtime/struct.MemoryTypeBuilder.html

danielstuart14 commented 1 week ago

I'm working on it, currently waiting for the change to upstream wasmparser.

Robbepop commented 1 week ago

@danielstuart14 cool! Looking forward to the PR once the #1141 is merged. Unfortunately there is no clear time span for when we can finally merge #1141 because it relies on performance fixes in some parts of wasmparser that are not trivial to understand and refactor. Help there is welcome, too!