diff options
author | Heejin Ahn <aheejin@gmail.com> | 2019-08-13 00:29:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 00:29:26 +0900 |
commit | e2f49d8227f2b71e4dede5cf4074bb9f65e3d77f (patch) | |
tree | 30b132b02824839d1d7718ed32c6b90cc0828151 /scripts | |
parent | 69ad1e8a8d2e1d395e30230433742f4f5668563b (diff) | |
download | binaryen-e2f49d8227f2b71e4dede5cf4074bb9f65e3d77f.tar.gz binaryen-e2f49d8227f2b71e4dede5cf4074bb9f65e3d77f.tar.bz2 binaryen-e2f49d8227f2b71e4dede5cf4074bb9f65e3d77f.zip |
Add basic exception handling support (#2282)
This adds basic support for exception handling instructions, according
to the spec:
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md
This PR includes support for:
- Binary reading/writing
- Wast reading/writing
- Stack IR
- Validation
- binaryen.js + C API
- Few IR routines: branch-utils, type-updating, etc
- Few passes: just enough to make `wasm-opt -O` pass
- Tests
This PR does not include support for many optimization passes, fuzzer,
or interpreter. They will be follow-up PRs.
Try-catch construct is modeled in Binaryen IR in a similar manner to
that of if-else: each of try body and catch body will contain a block,
which can be omitted if there is only a single instruction. This block
will not be emitted in wast or binary, as in if-else. As in if-else,
`class Try` contains two expressions each for try body and catch body,
and `catch` is not modeled as an instruction. `exnref` value pushed by
`catch` is get by `pop` instruction.
`br_on_exn` is special: it returns different types of values when taken
and not taken. We make `exnref`, the type `br_on_exn` pushes if not
taken, as `br_on_exn`'s type.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen-s-parser.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/scripts/gen-s-parser.py b/scripts/gen-s-parser.py index 615febd7d..c98388ad8 100755 --- a/scripts/gen-s-parser.py +++ b/scripts/gen-s-parser.py @@ -423,7 +423,13 @@ instructions = [ ("f32x4.convert_i32x4_s", "makeUnary(s, UnaryOp::ConvertSVecI32x4ToVecF32x4)"), ("f32x4.convert_i32x4_u", "makeUnary(s, UnaryOp::ConvertUVecI32x4ToVecF32x4)"), ("f64x2.convert_i64x2_s", "makeUnary(s, UnaryOp::ConvertSVecI64x2ToVecF64x2)"), - ("f64x2.convert_i64x2_u", "makeUnary(s, UnaryOp::ConvertUVecI64x2ToVecF64x2)") + ("f64x2.convert_i64x2_u", "makeUnary(s, UnaryOp::ConvertUVecI64x2ToVecF64x2)"), + # exception handling instructions + ("try", "makeTry(s)"), + ("throw", "makeThrow(s)"), + ("catch", "makeCatch(s)"), + ("rethrow", "makeRethrow(s)"), + ("br_on_exn", "makeBrOnExn(s)") ] |