upvote
On the web you can dynamically create new Wasm modules and use JS APIs to load them, though there are ergonomic issues. There are per-module costs and systems like CheerpJ and CheerpX currently do batching of multiple functions into a module to mitigate the per-module costs.

I've created a proposal to add a fine-grained JIT interface: https://github.com/webassembly/jit-interface

It allows generating new code one function at a time and a robust way to control what the new code can access within the generating module.

reply