diff options
-rw-r--r-- | README.md | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -179,7 +179,11 @@ This is separate from that. `asm2wasm` focuses on compiling asm.js to WebAssembl * How about compiling WebAssembly to asm.js (the opposite direction of `asm2wasm`)? Wouldn't that be useful for polyfilling? -It would be useful, but it is a much harder task, due to some decisions made in WebAssembly. For example, WebAssembly can have control flow nested inside expressions, which can't directly map to asm.js. It could be supported by outlining the code to another function, or to compiling it down into new basic blocks and control-flow-free instructions, but it is hard to do so in a way that is both fast to do and emits code that is fast to execute. On the other hand, compiling asm.js to WebAssembly is almost straightforward. +Experimentation with this is happening, in `wasm2asm`. + +This would be useful, but it is a much harder task, due to some decisions made in WebAssembly. For example, WebAssembly can have control flow nested inside expressions, which can't directly map to asm.js. It could be supported by outlining the code to another function, or to compiling it down into new basic blocks and control-flow-free instructions, but it is hard to do so in a way that is both fast to do and emits code that is fast to execute. On the other hand, compiling asm.js to WebAssembly is almost straightforward. + +We just have to do more work on `wasm2asm` and see how efficient we can make it. * Can `asm2wasm` compile any asm.js code? |