2 ms·
Since you're giving great answers ;) What's the problem with multiple entry points anyway? If we're not using computed goto, or dynamically verifying it when w
by tsegratis 3y ago
Since you're giving great answers ;)
What's the problem with multiple entry points anyway? If we're not using computed goto, or dynamically verifying it when we do, aren't all of our jump targets known, and so inherently safe?
What am i missing?
EDIT: is it just a question of speed of jit for register allocation / dominance frontiers?? But the verifier is providing safety right??
- titzer 3y agoSure, you can still have safe code with irreducible loops. Safety is orthogonal. There is a proposal to add "multi-loop" (https://gist.github.com/conrad-watt/6a620cb8b7d8f0191296e3eb24dffdef https://gist.github.com/conrad-watt/6a620cb8b7d8f0191296e3eb...) to Wasm, but it hasn't been a high priority. Of all the Wasm JITs I know of, none of the Web engine's optimizing compilers can handle irreducible control flow in their backends. Their register allocators and codegen algorithms would need to be modified. I worked on TurboFan, and several parts of it would choke on irreducible control flow. It's likely these engines would fall back to baseline compilation for such functions, which is a bigger perf impact than using state variables.