summaryrefslogtreecommitdiff
path: root/test/lit/passes/code-pushing-eh.wast
Commit message (Collapse)AuthorAgeFilesLines
* Simplify and consolidate type printing (#5816)Thomas Lively2023-08-241-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When printing Binaryen IR, we previously generated names for unnamed heap types based on their structure. This was useful for seeing the structure of simple types at a glance without having to separately go look up their definitions, but it also had two problems: 1. The same name could be generated for multiple types. The generated names did not take into account rec group structure or finality, so types that differed only in these properties would have the same name. Also, generated type names were limited in length, so very large types that shared only some structure could also end up with the same names. Using the same name for multiple types produces incorrect and unparsable output. 2. The generated names were not useful beyond the most trivial examples. Even with length limits, names for nontrivial types were extremely long and visually noisy, which made reading disassembled real-world code more challenging. Fix these problems by emitting simple indexed names for unnamed heap types instead. This regresses readability for very simple examples, but the trade off is worth it. This change also reduces the number of type printing systems we have by one. Previously we had the system in Print.cpp, but we had another, more general and extensible system in wasm-type-printing.h and wasm-type.cpp as well. Remove the old type printing system from Print.cpp and replace it with a much smaller use of the new system. This requires significant refactoring of Print.cpp so that PrintExpressionContents object now holds a reference to a parent PrintSExpression object that holds the type name state. This diff is very large because almost every test output changed slightly. To minimize the diff and ease review, change the type printer in wasm-type.cpp to behave the same as the old type printer in Print.cpp except for the differences in name generation. These changes will be reverted in much smaller PRs in the future to generally improve how types are printed.
* Change the default type system to isorecursive (#5239)Thomas Lively2022-11-231-10/+10
| | | | | | | | | | This makes Binaryen's default type system match the WasmGC spec. Update the way type definitions without supertypes are printed to reduce the output diff for MVP tests that do not involve WasmGC. Also port some type-builder.cpp tests from test/example to test/gtest since they needed to be rewritten to work with isorecursive type anyway. A follow-on PR will remove equirecursive types completely.
* [Exceptions] Optimize in CodePushing even with exceptions thrown (#5028)Alon Zakai2022-09-131-1/+70
| | | | | | | | | | We had some concerns about this not working in the past, but thinking about it now, I believe it is safe to do. Specifically, a throw is either like a break or a return - either it jumps out to an outer scope (like a break) or it jumps out of the function (like a return), and both breaks and returns have already been handled here. This change has some nice effects on J2Wasm output, where there are quite a lot of throws, which we can now optimize around.
* [EH] Support try-delegate in EffectAnalyzer (#4368)Heejin Ahn2021-12-061-10/+122
| | | | | | | | | | | | | | | | This adds support for try-delegate in `EffectAnalyzer`. Without this support, the expresion below has been incorrectly classified as "cannot throw", because the previous code considered everything inside `try`-`catch_all` as "cannot throw". This is not the case when there is a `delegate` that can bypass the `catch_all`. ```wasm try $l0 try try throw $e delegate $l0 catch_all end end
* Generate FileCheck checks for all module items (#3957)Thomas Lively2021-06-281-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | Instead of only generating checks for functions, generate checks for all named top-level module items, such as types, tags, tables, and memories. Because module items can be in different orders in the input and the output but FileCheck checks must follow the order of the output, we need to be slightly clever about when we emit the checks. Consider these types in the input file: ``` (type $A (...)) (type $B (...)) ``` If their order is reversed in the output file, then the checks for $B need to be emitted before the checks for $A, so the resulting module will look like this: ``` ;; CHECK: (type $B (...)) ;; CHECK: (type $A (...)) (type $A (...)) (type $B (...)) ``` Rather than this, which looks nicer but would be incorrect: ``` ;; CHECK: (type $A (...)) (type $A (...)) ;; CHECK: (type $B (...)) (type $B (...)) ```
* Remove (attr 0) from tag text format (#3946)Heejin Ahn2021-06-191-1/+1
| | | | | | | | This attribute is always 0 and reserved for future use. In Binayren's unofficial text format we were writing this field as `(attr 0)`, but we have recently come to the conclusion that this is not necessary. Relevant discussion: https://github.com/WebAssembly/exception-handling/pull/160#discussion_r653254680
* [EH] Replace event with tag (#3937)Heejin Ahn2021-06-181-1/+1
| | | | | | | | | | | We recently decided to change 'event' to 'tag', and to 'event section' to 'tag section', out of the rationale that the section contains a generalized tag that references a type, which may be used for something other than exceptions, and the name 'event' can be confusing in the web context. See - https://github.com/WebAssembly/exception-handling/issues/159#issuecomment-857910130 - https://github.com/WebAssembly/exception-handling/pull/161
* [EH] Convert EH tests into lit tests (#3923)Heejin Ahn2021-06-081-0/+208
This converts most EH tests in test/passes into test/lit/passes. Fixed some files to follow 2-space indentation and improved some comments.