Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experiment: emulate stable memory in WASIMode and WasmMode (to suppor…
…t testing of stable data structures on non-IC targets) (#4256) This PR exploits wasmtime's support for multiple memory and bulk memory instructions to emulate the IC stable memory API (i.e. ExperimentalStableMemory.mo and Regions.mo). The basic idea is to introduce an extra Wasm memory and emulate the low-level `ic0.stable64_grow/size/read/write` operations, using bulk MemoryCopy instructions for data transfer. The goal is to allow users to easily unit-test stable data structures without having to resort to the full IC environment. For example, the third-party StableBTree implementation went to a lot of trouble and was less efficient as a result, just to support testing outside the IC. @rvanasa would this work with your VSCode unit testing support? It does require enabling some additional features on wasmtime (no idea about compatibility with wasmer, if we still use that). The current implementation only adds a 32-bit memory, but it should be possible to add a 64-bit one instead. I just want to get this working first. 32-bit might be all we can support in browsers anyway (not sure). - [x] enable wasmtime flags in base repo so tests compile (this is one reason CI is failing). Alternatively, only add the stable memory if it's used. - [ ] PR to mops to enable additional wasmtime flags
- Loading branch information