3 ms·
WASM reflects the usual capabilities of a hardware-based CPU. Just like your usual hardware CPU cannot run Common Lisp directly, neither can WASM. JS, Perl, Py
by garganzol 3y ago
WASM reflects the usual capabilities of a hardware-based CPU. Just like your usual hardware CPU cannot run Common Lisp directly, neither can WASM.
JS, Perl, Python etc. all run well on widespread CPU architectures like ARM and x64. And that's why they will run well on WASM too given an appropriate runtime for that language.
To sum it up, WASM assumes nothing about a language - it's just a CPU, albeit a virtual one.
- ShroudedNight 3y agoMy experience with CPython (a while ago now) was that it ran like a dog on POWER, and that if you didn't account for the idiosyncrasies of the architecture in the interpreter's implementation, running "well" was a pipe dream. Considering WASM actively masks the underlying architecture, what evidence is there that other managed runtimes will naturally run well on WASM?
- garganzol 3y agoThat's an interesting and open question. Especially the ability to JIT the code on the fly, so it could travel, say, Java -> WASM -> Hardware path. It seems that it's technically possible [0] but there will be dragons. [0] https://wingolog.org/archives/2022/08/18/just-in-time-code-generation-within-webassembly https://wingolog.org/archives/2022/08/18/just-in-time-code-g...
- wbl 3y agoObviously Church Turing tells us all substrates are the same in power. So when we talk about running well on X we mean something else. WASM is not like any CPU in common use today. It's a stack machine with structured control flow and strongly typed pointers. The instruction sequence is a graph. Memory is not a flat address space.
- __s 3y agoI wouldn't call it a stack machine. Constraints requiring static stack depth is designed to be converted to SSA which then gets efficient register allocation
- robotresearcher 3y ago> Just like your usual hardware CPU cannot run Common Lisp directly Would be fun to visit the alternate universe where we went that way... https://en.wikipedia.org/wiki/Lisp_machine https://en.wikipedia.org/wiki/Lisp_machine
- mepian 3y ago>Just like your usual hardware CPU cannot run Common Lisp directly, neither can WASM. My usual hardware CPU runs Common Lisp code very well, thanks to this native x86-64 compiler: https://www.sbcl.org/ https://www.sbcl.org/