Add --trap-mode=allow/clamp/js argument to asm2wasm and s2wasm#1210
Add --trap-mode=allow/clamp/js argument to asm2wasm and s2wasm#1210jgravelle-google merged 4 commits intomasterfrom
Conversation
|
I think if |
|
Pretty much. It doesn't sit well with me because it's adding to domain-logic complexity to avoid implementational coupling. But yeah, optional is what I really want here. Or something like Haskell's |
|
Actually maybe the best option is just to throw an exception. Since we already use exceptions in Binaryen, which I seem to always forget. |
| std::cerr << "--no-opts is deprecated (use -O0, etc.)\n"; | ||
| }) | ||
| .add("--emit-potential-traps", "-i", "Emit instructions that might trap, like div/rem of 0", Options::Arguments::Zero, | ||
| .add("--emit-potential-traps", "-i", |
There was a problem hiding this comment.
oh, is this keeping the old flags for compatibility?
There was a problem hiding this comment.
Yeah, should I not? And if so, should I remove --imprecise as well?
Actually if we keep it I should update --imprecise to say "old name for --trap-mode=allow" now, to keep that consistent.
There was a problem hiding this comment.
I think we should consider asm2wasm as an implementation detail of emscripten, and aggressively eliminate legacy compatibility things.
There was a problem hiding this comment.
Yeah, I think these are internal implementation details, just between emcc and asm2wasm. So we can remove old stuff.
But we will need to land this and the emscripten PRs at the same time, and make sure the emscripten one updates the binaryen tag to a new tag on binaryen after that merge, so it uses the new code immediately.
Update command-line arguments to take trap mode itself as a string parameter.
Not sure how reasonable it is to add an
Invalidmode to theTrapModeenum just for error handling. I basically wanted a way to separate the argument string parsing logic from what to do with an error, and this seemed like the least-bad way to do that. Maybe it's moot and I should justexitfrom insidetrapModeFromString. Thoughts?