diff options
author | Asumu Takikawa <asumu@igalia.com> | 2021-02-18 07:09:32 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-18 07:09:32 -0800 |
commit | ffb22e3c900e8246d806d2e9a765dc14251b33e8 (patch) | |
tree | 45c7d2caef95ac03b237e8b3c2f29fe1db9686b6 /src/binary-reader-ir.cc | |
parent | 036a632a24679062e7fc891e7743195139bfa0a9 (diff) | |
download | wabt-ffb22e3c900e8246d806d2e9a765dc14251b33e8.tar.gz wabt-ffb22e3c900e8246d806d2e9a765dc14251b33e8.tar.bz2 wabt-ffb22e3c900e8246d806d2e9a765dc14251b33e8.zip |
Update rethrow depth handling and catch_all opcode (#1608)
Give `catch_all` its own opcode:
Previously `catch_all` shared an opcode with `else`, but
the spec now allocates it the 0x19 opcode.
Adjust rethrow depth semantics:
Previously this had interpreted the rethrow depth argument
as counting only catch blocks, but the spec has clarified that
it should count all blocks (in a similar fashion as `br` and
related instructions).
Diffstat (limited to 'src/binary-reader-ir.cc')
-rw-r--r-- | src/binary-reader-ir.cc | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc index 53a52233..cdda3311 100644 --- a/src/binary-reader-ir.cc +++ b/src/binary-reader-ir.cc @@ -145,6 +145,7 @@ class BinaryReaderIR : public BinaryReaderNop { Index default_target_depth) override; Result OnCallExpr(Index func_index) override; Result OnCatchExpr(Index event_index) override; + Result OnCatchAllExpr() override; Result OnCallIndirectExpr(Index sig_index, Index table_index) override; Result OnReturnCallExpr(Index func_index) override; Result OnReturnCallIndirectExpr(Index sig_index, Index table_index) override; @@ -759,8 +760,6 @@ Result BinaryReaderIR::OnElseExpr() { if_expr->true_.end_loc = GetLocation(); label->exprs = &if_expr->false_; label->label_type = LabelType::Else; - } else if (label->label_type == LabelType::Try) { - return AppendCatch(Catch(GetLocation())); } else { PrintError("else expression without matching if"); return Result::Error; @@ -1007,6 +1006,10 @@ Result BinaryReaderIR::OnCatchExpr(Index except_index) { return AppendCatch(Catch(Var(except_index, GetLocation()))); } +Result BinaryReaderIR::OnCatchAllExpr() { + return AppendCatch(Catch(GetLocation())); +} + Result BinaryReaderIR::OnUnwindExpr() { LabelNode* label = nullptr; CHECK_RESULT(TopLabel(&label)); |