Open kgtkr opened 2 years ago
Does the WITX to WIT transition address some of this? I remember seeing a new modularity feature being associated with the transition.
Secondly, I think dynamic code generation is incompatible with static compilation. It would only work during AOT or JIT compilation.
Seems like an interesting idea!
I agree, I expect we will eventually want APIs for dynamic instantiation from module bytes. To do this, we'll likely want first-class type for holding references to dynamically created instances. These instance references could then be passed into other instances, potentially forming reference cycles, which means it'll probably need some form of GC.
Also, the ability to create code dynamically will need to be coordinated with the content-security-policy.
The WITX to WIT transition does not add dynamic instantiation from wasm module bytes.
JavaScript API has
WebAssembly.compile
andWebAssembly.instantiate
. There seems to be no equivalent to this in wasi.For example, if wasi have this, it should be able to realize a JIT compiler by generating a wasm module bytes and instantiating it by passing a function or memory. We can already do this with the JavaScript API.
Module-linking proposal
This looks like a problem that the module-linking proposal doesn't solve.
https://github.com/WebAssembly/module-linking/blob/main/design/proposals/module-linking/Example-SharedEverythingDynamicLinking.md#runtime-dynamic-linking