3 ms·
No. WASM is fundamentally a stack machine. That's how its semantics are defined.
by iammisc 5y ago
No. WASM is fundamentally a stack machine. That's how its semantics are defined.
- sitkack 5y agoIt is a mechanical transformation from stack to registers. In other parts of the thread you mentioned TCO, one can also convert recursion into iteration, tail calls can be handled by the compiler or with a trampoline. The universe is much more flexible than you give it credit for.
- iammisc 5y agoRecursion can be converted to iteration very easily but then you lose all benefits of web assembly (dynamic linking, for example(. The conversion from recursion to iteration mandates that all recursive entry points be known ahead of time so you can build a loop/conditional tree. If you want to dynamically load code, this creates two tiers of languages on the runtime. You really think I haven't thought of this?