We'll want to be able to save a WebAssembly.Module's code in IndexDB (#166481) and postMessage (#166480) the WebAssembly.Module cheaply to other workers without having to patch pointers and duplicate physical pages used for code. This allows us to instantiate the same module waaayyy better.
Right now our implementation has some pointers baked in: &VM.topInstance, and functions for back traces. We'll want to do away with this.
The easiest and fastest thing is probably to store the topInstance in a TLS slot, and then change it when entering js->wasm, doing wasm->wasm calls, and when in a worker (nothing to do here really, it's the same mechanism).
There's also code in the trap handling which needs to be updated. It has ([codebegin, codeend) + VM) structures, and the signal handlers have thunks.
This is done as of: