5 ms·
What's truly missing for Wasm and WASI to be an alternative to POSIX is dynamic instatiation so that a Wasm program/component can start another Wasm program/com
by Klasiaster 1y ago
What's truly missing for Wasm and WASI to be an alternative to POSIX is dynamic instatiation so that a Wasm program/component can start another Wasm program/component by providing the bytecode at runtime. So far I don't think anyone is working on that.
- packetlost 1y agoI wonder if it hasn't been done because it would break the security model
- xmorse 1y agodoes it? a program would be able to spawn another program only with the exports available to him
- marianoguerra 1y agoin the browser you can compile modules and create instances from arrays of numbers/bytes, here's an obfuscated example: https://wasmgroundup.com/blog/wasm-compiler-in-a-tweet https://wasmgroundup.com/blog/wasm-compiler-in-a-tweet if the host provides the guest wasm module via imports a function to create and run from an array of bytes then it can be done today (if I understand you correctly). Here's some related content: https://github.com/pdubroy/til/blob/main/wasm/2024-02-22-Run-time-code-generation.md https://github.com/pdubroy/til/blob/main/wasm/2024-02-22-Run...
- azakai 1y agoYes, this can be done today, though it needs some gluing together. On the Web (and in Node etc.) you can use JavaScript to create and link the modules, which is how dynamic linking support for wasm works there: https://emscripten.org/docs/compiling/Dynamic-Linking.html https://emscripten.org/docs/compiling/Dynamic-Linking.html
- singularity2001 1y agoThe wasp runtime has a run_wasm host export but I guess that's cheating https://github.com/pannous/wasp https://github.com/pannous/wasp
- yuri91 1y agoOn the Web, you can do that today. This is what https://webvm.io https://webvm.io does for example. It jit-compiles Wasm modules at runtime from the original X86.