3 ms·
That was done entirely on purpose, to make validation simpler. It does make things harder for compilers that want to support irreducible control flow, but the w
by Rusky 7y ago
That was done entirely on purpose, to make validation simpler. It does make things harder for compilers that want to support irreducible control flow, but the workaround is a single "relooper" algorithm that doesn't really fundamentally change how those compilers work.
It is possible that in the future this will be relaxed (without giving up on the benefits for validation) via something like this: https://github.com/WebAssembly/funclets https://github.com/WebAssembly/funclets
- deleted 7y ago[deleted]
- FullyFunctional 7y agoIt's not just validation. A lot of things compilers have to do becomes dramatically simpler with structured control flow and simpler means faster. When you operate on an unstructured CFG you first have to analyze the entire graph to find the dominators, loops etc and then you have to propagate the dataflow information in that order. All these complications go away. There's been a few other works that realized this, among them the CORTL IR, suggested by Carl McConnell in his Thesis proposal "Tree Based Optimizations" and the IR used in the Oberon compiler by Michael Franz.
- jnordwick 7y ago1. You can have both. Jumps (conditional or unconditional allow for more complex control flow and different control flow than was immediately thought of. 2 only having structured control flow makes it a difficult target for HLL, which is what was is supposed to be. 3. A few years ago I was working on an array language and was trying to use tree based optimization and code generation, but I put it on hold until i understood more - can you recommend and links or papers? 4. Wasm is an IR, both target and source. Why not add a goto and structured primitive. There are clearly some things that cannot be compiled anywhere remotely performant.