Use 3 modes for potentially trapping ops in asm2wasm#929
Conversation
…t a potentially trapping op), js (do exactly what js does, even if it takes a slow ffi to do it), and clamp (avoid the trap by clamping as necessary)
|
This looks good to me. Obviously we could micro-optimize some things more if we really wanted, and the choice of what mode to have by default depends on how one weights various criteria, but what's here is a reasonable step forward. |
|
I'm on board with this general idea too. A few comments, and questions to make sure I understand right:
|
|
Actually also just so I understand. It looks like the clamp and JS mode for div/rem do the same thing now? Just return 0? |
|
|
Actually I think |
|
Ok, not my first intuition but I can see how that works too, and shorter is nicer. |
| input = conv; | ||
| } | ||
| // We can handle this in one of two ways: clamping, which is fast, or JS, which | ||
| // is precisely like JS but in order to do that we do a slow ffi |
There was a problem hiding this comment.
This behavior is fine for now; I'd be very interested in seeing how wasm build of __fixsfsi or __fixdfdi compares with FFI+JS version.
|
Ok, how does this look now with the shorter names? |
See emscripten-core/emscripten#4625