This is an archive of the discontinued LLVM Phabricator instance.

[WebAssembly] Add Wasm exception handling prepare pass
AbandonedPublic

Authored by aheejin on Sep 7 2017, 5:24 PM.

Details

Reviewers
dschuff
Summary

This adds a new 'Wasm' exception handling mode to CodeGen backend, and a
WasmEHPrepare pass that adapts code to be used in WebAssembly exception
handling.

Ref: (Tentative) WebAssembly EH scheme for toolchain

Event Timeline

aheejin created this revision.Sep 7 2017, 5:24 PM
aheejin updated this revision to Diff 114307.Sep 8 2017, 12:24 AM

delete a stray line

aheejin updated this revision to Diff 114308.Sep 8 2017, 12:28 AM

add a line in the test

aheejin updated this revision to Diff 115255.Sep 14 2017, 11:44 AM

wasm_landingpad_context -> wasm_lpad_context

aheejin updated this revision to Diff 116284.Sep 21 2017, 3:34 PM

Add an optimization: We don't store personality function address and LSDA
address at non-top-level landing pads (landing pads that are dominated by
another landing pad), because they have already been stored before.

For the curious, here is in-progress work of WebAssembly EH scheme documentation, which will be merged to the official WebAssembly tool-convention repo later.

dschuff added inline comments.Sep 22 2017, 5:38 PM
lib/CodeGen/DwarfEHPrepare.cpp
52

If we implement resuming as as wasm rethrow, can we make the personality function or its wrapper resume by rethrowing, in cases where it would otherwise have returned _URC_CONTINUE_UNWIND? Then we actually could prune the unreachable resumes.

lib/CodeGen/WasmEHPrepare.cpp
35

Probably want to say "wasm VM" instead of V8 here and instead of "JavaScript Engine" down in line 38.

aheejin updated this revision to Diff 117590.Oct 3 2017, 2:43 PM
aheejin marked an inline comment as done.

JS engine -> VM

lib/CodeGen/DwarfEHPrepare.cpp
52

As we discussed with Karl,

  1. rethrow only works within the same function, static scope.
  2. Even if rethrow works dynamically within callees, it wouldn't work within the factored-out common code, so, it's tricky.
aheejin updated this revision to Diff 117601.Oct 3 2017, 4:53 PM

Rebased to the tip of the svn.

aheejin updated this revision to Diff 117617.Oct 3 2017, 6:32 PM

clang-tidy modernize

@dschuff Do you think we can land this? This is not specifically related to the proposed spec change.

aheejin edited the summary of this revision. (Show Details)Oct 5 2017, 4:28 PM
aheejin updated this revision to Diff 124010.Nov 22 2017, 1:39 PM

+ Disabled storing personality function address at every landing pad
+ Removed hardcoding of '_Unwind_Resume' function name
+ Rebased to the tip of the svn

aheejin abandoned this revision.Feb 7 2018, 4:17 PM

The spec is planned to change significantly, so I will close this CL for now.