This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Error out when Emscripten SjLj setjmp is used with Wasm EH
ClosedPublic

Authored by aheejin on Aug 6 2021, 9:49 PM.

Details

Summary

Currently, when Wasm EH is used with Emscripten SjLj, Emscripten SjLj
cannot handle invoke instructions - it assumes all invokes have been
lowered away with Emscripten EH. But in Wasm EH they are lowered in
instruction selection, so they are still present in the IR stage. This
happens when

  1. Wasm EH and Emscripten SjLj are used together
  2. A function that calls setjmp uses exceptions, i.e., has invokes

We were already erroring out with an assertion failure in this case, but
this CL makes it error out more properly with a valid error message.

Wasm EH + Wasm SjLj will not have this restrictions. (it will have
another restriction though, e.g., setjmp cannot be called within
catch. But why would anyone do that..)

Diff Detail

Event Timeline

aheejin created this revision.Aug 6 2021, 9:49 PM
aheejin requested review of this revision.Aug 6 2021, 9:49 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 6 2021, 9:49 PM
dschuff accepted this revision.Aug 12 2021, 12:28 PM
This revision is now accepted and ready to land.Aug 12 2021, 12:28 PM

Actually wait, doesn't report_fatal_error act like a crash, complete with a stacktrace now?

Actually wait, doesn't report_fatal_error act like a crash, complete with a stacktrace now?

Nevermind, I was confused. The test's not --crash actually does check that llc "crashes".
I wish we had a better way to report errors from the backend.

I agree. I'm not sure what more graceful way to report errors to users might be, because report_fatal_error crashes pretty like a bug (which actually in many case it is for) with a giant stack trace and it doesn't look that much different from hitting an assert. But anyway, I think this is still at least slightly better than the previous assertion....

This revision was landed with ongoing or failed builds.Aug 12 2021, 4:19 PM
This revision was automatically updated to reflect the committed changes.