sunfishcode closed Issue #993:
I was thinking about support for multiple WASM instances in the same host process. But ran into a problem with functions like
wasi_unstable!proc_exit
which are meant to kill the process rather than returning to the main entry function. Killing the process would not be desired in this case. A general use-case would be if a fork() feature was added which make use of the same host process to spawn copies of the running WASM instance - but when terminating an instance - it should then not impact the remaining instances. I'm looking for just running 'fully' independent instances in the same process for now, though.But to make it possible to run multiple WASM instances - we really need a way to force a return to the instance entry function caller - and ensure the native function stack - but NOT the WASM stack - gets cleaned up. So I think we need a way to create a special termination/not-catchable trap - that just triggers jumps to the next native function call on the stack - but skipping any WASM frames for clean up. The new trap type ensures that WASM cannot recover from the termination request.
This does involve WASM exception handling and WASM C-lib. But I'll start here to see if this would be viable to solve for wasmtime.
Last updated: Nov 22 2024 at 17:03 UTC