summaryrefslogtreecommitdiff
path: root/test/exception-handling.wast
Commit message (Collapse)AuthorAgeFilesLines
* Update Pop text format to handle tuples (#3116)Thomas Lively2020-09-111-3/+3
| | | | | | | | | | | Previously Pops were printed as ({type}.pop), and if the popped type was a tuple, something like ((i32, i64).pop) would get printed. However, the parser didn't support pops of anything besides single basic types. This PR changes the text format to be (pop <type>*) and adds support for parsing pops of tuples of basic types. The text format change is designed to make parsing simpler. This change is necessary for writing Poppy IR tests (see #3059) that contain break or return instructions that consume multiple values, since in Poppy IR that requires tuple-typed pops.
* Update reference types (#3084)Daniel Wirtz2020-09-091-19/+0
| | | | | | | Align with the current state of the reference types proposal: * Remove `nullref` * Remove `externref` and `funcref` subtyping * A `Literal` of a nullable reference type can now represent `null` (previously was type `nullref`) * Update the tests and temporarily comment out those tests relying on subtyping
* Rename anyref to externref to match proposal change (#2900)Jay Phelps2020-06-101-1/+1
| | | | | | | anyref future semantics were changed to only represent opaque host values, and thus renamed to externref. [Chromium](https://bugs.chromium.org/p/v8/issues/detail?id=7748#c360) was just updated to today (not yet released). I couldn't find a Mozilla bugzilla ticket mentioning externref so I don't immediately know if they've updated yet. https://github.com/WebAssembly/reference-types/pull/87
* Make 'do' clause mandatory in 'try' (#2851)Heejin Ahn2020-05-141-0/+2
| | | | | | | | | | | | | | Previously we were able to omit the new syntax `do` when `try` body is empty. This makes `do` clause mandatory, so when a `try` body is empty, the folded text format will be ``` (try (do) (catch ... ) ``` Suggested in https://github.com/WebAssembly/exception-handling/issues/52#issuecomment-626696720.
* Make try body start with 'do' (#2846)Heejin Ahn2020-05-111-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In WebAssembly/exception-handling#52, We decided to put `try` bodies in a `do` clause to be more consistent with `catch`. - Before ```wast (try ... (catch ... ) ) ``` - After ```wast (try (do ... ) (catch ... ) ) ``` Another upside of this change is when there are multiple instructions within a `try` body, we no longer need to wrap them in a `block`.
* Allow subtype in throw instruction (#2568)Heejin Ahn2020-01-061-1/+4
| | | | | This allows subtype for arguments of `throw`. This also renames `shouldBeSubTypeOrUnreachable` to `shouldBeSubTypeOrFirstIsUnreachable`, to be consistent with `shouldBeEqualOrFirstIsUnreachable`.
* Add support for reference types proposal (#2451)Heejin Ahn2019-12-301-0/+16
| | | | | | | | | | | | This adds support for the reference type proposal. This includes support for all reference types (`anyref`, `funcref`(=`anyfunc`), and `nullref`) and four new instructions: `ref.null`, `ref.is_null`, `ref.func`, and new typed `select`. This also adds subtype relationship support between reference types. This does not include table instructions yet. This also does not include wasm2js support. Fixes #2444 and fixes #2447.
* Make try body with multiple instructions roundtrip (#2374)Heejin Ahn2019-10-091-0/+16
| | | | | | | | | Previously we didn't print an additional block when there are multiple instructions within a `try` body, so those wast files cannot be parsed correctly, because the wast parser assumes there are two bodies within a `try` scope: a try body and a catch body. We don't need to print an additional block for a `catch` body because `(catch ...)` itself serves as a scope.
* Add basic exception handling support (#2282)Heejin Ahn2019-08-131-4/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Rename except_ref type to exnref (#2224)Heejin Ahn2019-07-141-1/+1
| | | | In WebAssembly/exception-handling#79 we agreed to rename `except_ref` type to `exnref`.
* Add except_ref type (#2081)Heejin Ahn2019-05-071-0/+6
This adds except_ref type, which is a part of the exception handling proposal.