wasefire
wasefire copied to clipboard
Virtual memory for the interpreter
It's not clear if needed, but dumping the idea in case a use-case comes up.
Currently, the interpreter doesn't constrain the size of a memory and its growth more than what the specification says. However, if the module accesses memory within what the specification permits but outside the actual available memory allocated for the module, then the module will trap. This is how memories smaller than 64kB (WebAssembly memory page size) are supported. The actual available memory is simply a prefix of the WebAssembly memory.
The proposal would be to have a more dynamic distribution of the actual memory within the WebAssembly memory, using some form of allocate-on-write with page tables (but with pages much smaller than 64kB but big enough to reduce metadata overhead). Such virtual memory would be a mapping from address prefix to a block of actual memory.