diff options
author | Sébastien Doeraene <sjrdoeraene@gmail.com> | 2024-08-21 00:43:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-20 15:43:25 -0700 |
commit | 340ad71810484c279b1a36a9a7e458c9b18855b9 (patch) | |
tree | 4167b08dea6f5ffcdb975d90eb6f3c7925f628e0 /src/ir/possible-contents.h | |
parent | 2c9c74d8b64e1776c6c374af8631995b0be606f1 (diff) | |
download | binaryen-340ad71810484c279b1a36a9a7e458c9b18855b9.tar.gz binaryen-340ad71810484c279b1a36a9a7e458c9b18855b9.tar.bz2 binaryen-340ad71810484c279b1a36a9a7e458c9b18855b9.zip |
[Exceptions] Finish interpreter + optimizer support for try_table. (#6814)
* Add interpreter support for exnref values.
* Fix optimization passes to support try_table.
* Enable the interpreter (but not in V8, see code) on exceptions.
Diffstat (limited to 'src/ir/possible-contents.h')
-rw-r--r-- | src/ir/possible-contents.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/ir/possible-contents.h b/src/ir/possible-contents.h index 5ec4f758f..7b88483cf 100644 --- a/src/ir/possible-contents.h +++ b/src/ir/possible-contents.h @@ -473,6 +473,15 @@ struct TagLocation { } }; +// The location of an exnref materialized by a catch_ref or catch_all_ref clause +// of a try_table. No data is stored here. exnrefs contain a tag and a payload +// at run-time, as well as potential metadata such as stack traces, but we don't +// track that. So this is the same as NullLocation in a way: we just need *a* +// source of contents for places that receive an exnref. +struct CaughtExnRefLocation { + bool operator==(const CaughtExnRefLocation& other) const { return true; } +}; + // A null value. This is used as the location of the default value of a var in a // function, a null written to a struct field in struct.new_with_default, etc. struct NullLocation { @@ -520,6 +529,7 @@ using Location = std::variant<ExpressionLocation, SignatureResultLocation, DataLocation, TagLocation, + CaughtExnRefLocation, NullLocation, ConeReadLocation>; @@ -608,6 +618,12 @@ template<> struct hash<wasm::TagLocation> { } }; +template<> struct hash<wasm::CaughtExnRefLocation> { + size_t operator()(const wasm::CaughtExnRefLocation& loc) const { + return std::hash<const char*>()("caught-exnref-location"); + } +}; + template<> struct hash<wasm::NullLocation> { size_t operator()(const wasm::NullLocation& loc) const { return std::hash<wasm::Type>{}(loc.type); |