3 ms·
> The weird part of WASM is the control structures. Out of curiosity, what do you find weird about the control structure portion? I just wrote a basic languag
by drew-y 6y ago
> The weird part of WASM is the control structures.
Out of curiosity, what do you find weird about the control structure portion?
I just wrote a basic language that compiles to wasm and found the built in control structures made my life easier.
- klodolph 6y agoOpen any compilers book, WASM will look alien. Control flow analysis is normally done through basic blocks. If you make a toy language and don’t do control flow analysis you won’t notice what’s so weird about WASM. If you take an existing compiler and port it to WASM, you’ll cry, then gather yourself together and read how the relooper algorithm works.
- afiori 6y agoThe reason wasm is like this is that with "normal" control flow chrome would have had to implement itself the relooper algorithm internally before the MVP release. Overall the main negative point seems to be that compilers toward wasm are more complex, but under the constraints of the web moving complexity from the client looks like a valuable positive point. Two other negative points would possibly be performance and code size (which is the reason for a if-then-else specific instruction for example) about which I know very little. Do you think it would have made a difference here?