4 ms·
> tail-calls has been proposed as an extension to the WebAssembly standard. Do you know why it wasn't in the standard to begin with? Even ECMAScript 6 mandat
by andsoitis 4y ago
> tail-calls has been proposed as an extension to the WebAssembly standard.
Do you know why it wasn't in the standard to begin with?
Even ECMAScript 6 mandates PTC (proper tail call) - article from 2016 on Webkit.org no less - https://webkit.org/blog/6240/ecmascript-6-proper-tail-calls-in-webkit/ https://webkit.org/blog/6240/ecmascript-6-proper-tail-calls-...
- apignotti 4y agoI am unsure, but I can make a guess. The first release of Wasm has been always considered a Minimum Viable Product, which a strong emphasis on Minimum. Pretty much only features already part of the legacy asm.js "standard" made the cut. The fact that WebKit had some level of support for tail calls on the JS side is exactly the reason we choose it as the right platform to invest in.
- pygy_ 4y agoThe standard mandates it, and the V8 team implemented it, shipped it behind a flag, then unshipped based on reasons that initially seemed and ultimately were proven fuddy, when WebKit shipped PTC, and the world didn’t fall down. The reason actual why it was withdrawn is that it would have required expensive changes to Microsoft’s Chakra (the calling conventions were incompatible). Then Edge died... and Google didn’t add it back. Go figure. Firefox also has problems implementing cross-realm tail calls. That could be spec’ed around, but there’s no will to do so.
- silon42 4y agoIf I understand what cross-realm means (code security), then I'm not sure that can be done at all.
- leoc 4y agoThese absolute bozos. A Web Assembler that can't do jumps. What a show.
- pygy_ 4y agoMy comment is about ES6 proper tail calls. WASM is another story
- leoc 4y agoGraaagh, sorry.
- int_19h 4y agoIt's not that much better. Apparently at least some of the idiosyncracies in the design of wasm, such as the lack of regular unstructured branches, is due to the internal implementation details of V8.
- titzer 4y agoEvery optimizing JIT for JavaScript has the same limitations.
- int_19h 4y agoThen maybe we shouldn't be repurposing VMs written for JavaScript for that brand new thing? Ditch the baggage and do it right. Especially given that, if successful, wasm is basically the next JS, and will be around for decades.
- titzer 4y agoI'm all for rewriting things from scratch. That's why I'm doing a new Wasm engine from scratch. But reusing TurboFan is how we took Wasm from concept to near-native performance, shipped in Chrome, in 2.5 years.
- miclill 4y agoThanks for clarifying. What is this PTC you mention?
- pygy_ 4y ago“Proper tail calls”, i.e. tail calls as specified for ES6
- brrrrrm 4y agoHow is ECMAScript 6 (high level language) related to WebAssembly (low level target)?
- afiori 4y agoWasm is meant to run efficiently on the same VM as JavaScript (an ECMAScript implemention), so Wasm features are restricted by browser VM current architectures. (It is probably the main reason why Wasm only has structured control flow)