diff options
author | Alon Zakai <azakai@google.com> | 2021-01-28 00:18:43 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-27 16:18:43 -0800 |
commit | 53c471a445ef26eac7befc3f3a5e0a53870df8cb (patch) | |
tree | 419fb53072864affda454f942528416c258136c8 /src/wasm/wasm-validator.cpp | |
parent | a5aa66c52e0b92597a3b90cf34ccc3b7dee775d0 (diff) | |
download | binaryen-53c471a445ef26eac7befc3f3a5e0a53870df8cb.tar.gz binaryen-53c471a445ef26eac7befc3f3a5e0a53870df8cb.tar.bz2 binaryen-53c471a445ef26eac7befc3f3a5e0a53870df8cb.zip |
[GC] Update br_on_cast: the text format also no longer has a heap type (#3523)
As a result, we cannot handle a br_on_cast with an unreachable RTT. The
binary format solves the problem by ignoring unreachable code, and this makes
the text format do the same.
A nice benefit of this is that we can remove the castType extra field.
Diffstat (limited to 'src/wasm/wasm-validator.cpp')
-rw-r--r-- | src/wasm/wasm-validator.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index 8def0e529..c6d0d9fe7 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2215,15 +2215,12 @@ void FunctionValidator::visitBrOnCast(BrOnCast* curr) { shouldBeTrue( curr->ref->type.isRef(), curr, "br_on_cast ref must have ref type"); } - if (curr->rtt->type != Type::unreachable) { - shouldBeTrue( - curr->rtt->type.isRtt(), curr, "br_on_cast rtt must have rtt type"); - shouldBeEqual(curr->rtt->type.getHeapType(), - curr->castType.getHeapType(), - curr, - "br_on_cast rtt must have the proper heap type"); - noteBreak(curr->name, curr->castType, curr); - } + // Note that an unreachable rtt is not supported: the text and binary formats + // do not provide the type, so if it's unreachable we should not even create + // a br_on_cast in such a case, as we'd have no idea what it casts to. + shouldBeTrue( + curr->rtt->type.isRtt(), curr, "br_on_cast rtt must have rtt type"); + noteBreak(curr->name, curr->getCastType(), curr); } void FunctionValidator::visitRttCanon(RttCanon* curr) { |