4 ms·
I wonder if eventually with some of the stuff like GC in place, you could write a javascript JIT on top of wasm. I'm only half kidding. It would be pretty neat
by hencq 8y ago
I wonder if eventually with some of the stuff like GC in place, you could write a javascript JIT on top of wasm. I'm only half kidding. It would be pretty neat if wasm became a kind of universal IR that different (AOT and JIT) compilers could target.
- jhpriestley 8y agoJIT is pretty hard to do with wasm. There's a strict separation between code and data in wasm, for security reasons. You can't jump into the heap. So the best you could do is to generate your new JITted code as a separate wasm module.
- hencq 8y agoAh interesting, thanks for clarifying. I'm way out of my depth here, but this could become possible if a future version of wasm provided the option to dynamically load code? After some googling, that's what this [1] seems to be talking about. [1] https://webassembly.org/docs/future-features/#platform-independent-just-in-time-jit-compilation https://webassembly.org/docs/future-features/#platform-indep...
- s-macke 8y agoThat's exactly what I was thinking when I tried a more theoretical approach to my web emulator. I wrote a little about my approach in the Wiki [1]. Definitely one of my worst hacks :-) . Unfortunately the demo doesn't work anymore. I need to find out why. [1] https://github.com/s-macke/jor1k/wiki/Breaking-the-1-billion-instructions-per-second-barrier-via-Dynamic-Recompilation-and-WebAssembly https://github.com/s-macke/jor1k/wiki/Breaking-the-1-billion...