diff options
author | Alon Zakai <azakai@google.com> | 2021-01-25 18:12:37 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-25 10:12:37 -0800 |
commit | c74acc0baece1296ad58a0ff44119fb36d98d2c6 (patch) | |
tree | a056864640cf5f98211bc05bd3342446c2005c31 /src/wasm.h | |
parent | 27a5a7101d20ce5fc51648e775587ab3d640114e (diff) | |
download | binaryen-c74acc0baece1296ad58a0ff44119fb36d98d2c6.tar.gz binaryen-c74acc0baece1296ad58a0ff44119fb36d98d2c6.tar.bz2 binaryen-c74acc0baece1296ad58a0ff44119fb36d98d2c6.zip |
Debug info handling for new EH try-catch (#3496)
We now have multiple catches in each try, and a possible catch-all.
This changes our "extra delimiter" storage to store either an "else"
(unchanged from before) or an arbitrary list of things - we use that
for catches.
Diffstat (limited to 'src/wasm.h')
-rw-r--r-- | src/wasm.h | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/wasm.h b/src/wasm.h index 0b7a09a3c..7090aeff1 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -1530,20 +1530,15 @@ struct BinaryLocations { // Track the extra delimiter positions that some instructions, in particular // control flow, have, like 'end' for loop and block. We keep these in a // separate map because they are rare and we optimize for the storage space - // for the common type of instruction which just needs a Span. We implement - // this as a simple array with one element at the moment (more elements may - // be necessary in the future). - // TODO: If we are sure we won't need more, make this a single value? - struct DelimiterLocations : public std::array<BinaryLocation, 1> { - DelimiterLocations() { - // Ensure zero-initialization. - for (auto& item : *this) { - item = 0; - } - } - }; + // for the common type of instruction which just needs a Span. + // For "else" (from an if) we use index 0, and for catch (from a try) we use + // indexes 0 and above. + // We use automatic zero-initialization here because that indicates a "null" + // debug value, indicating the information is not present. + using DelimiterLocations = ZeroInitSmallVector<BinaryLocation, 1>; + + enum DelimiterId : size_t { Else = 0, Invalid = size_t(-1) }; - enum DelimiterId { Else = 0, Catch = 0, Invalid = -1 }; std::unordered_map<Expression*, DelimiterLocations> delimiters; // DWARF debug info can refer to multiple interesting positions in a function. |