diff options
author | Soni L. <EnderMoneyMod@gmail.com> | 2024-11-20 14:51:48 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-11-20 09:51:48 -0800 |
commit | a0b7abef00b59eeafed58c774195189425d020b0 (patch) | |
tree | 6f7b0747d3a3ef435bda9ac14ca22d417877796b /src/shared-validator.cc | |
parent | 958d0a72030227bf3133c8b99c7c670bcdbc7636 (diff) | |
download | wabt-a0b7abef00b59eeafed58c774195189425d020b0.tar.gz wabt-a0b7abef00b59eeafed58c774195189425d020b0.tar.bz2 wabt-a0b7abef00b59eeafed58c774195189425d020b0.zip |
binary/wat: Implement EHv4 (#2470)
This pull request implements EHv4. Binary is mostly untested until
interp is working.
Diffstat (limited to 'src/shared-validator.cc')
-rw-r--r-- | src/shared-validator.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/shared-validator.cc b/src/shared-validator.cc index 6492cbeb..bdf6eb71 100644 --- a/src/shared-validator.cc +++ b/src/shared-validator.cc @@ -1219,6 +1219,12 @@ Result SharedValidator::OnThrow(const Location& loc, Var tag_var) { return result; } +Result SharedValidator::OnThrowRef(const Location& loc) { + Result result = CheckInstr(Opcode::ThrowRef, loc); + result |= typechecker_.OnThrowRef(); + return result; +} + Result SharedValidator::OnTry(const Location& loc, Type sig_type) { Result result = CheckInstr(Opcode::Try, loc); TypeVector param_types, result_types; @@ -1228,6 +1234,40 @@ Result SharedValidator::OnTry(const Location& loc, Type sig_type) { return result; } +Result SharedValidator::BeginTryTable(const Location& loc, Type sig_type) { + Result result = CheckInstr(Opcode::TryTable, loc); + TypeVector param_types, result_types; + result |= CheckBlockSignature(loc, Opcode::TryTable, sig_type, ¶m_types, + &result_types); + result |= typechecker_.BeginTryTable(param_types); + return result; +} + +Result SharedValidator::OnTryTableCatch(const Location& loc, + const TableCatch& catch_) { + Result result = Result::Ok; + TagType tag_type; + expr_loc_ = loc; + if (!catch_.IsCatchAll()) { + result |= CheckTagIndex(catch_.tag, &tag_type); + } + if (catch_.IsRef()) { + tag_type.params.push_back(Type::ExnRef); + } + result |= + typechecker_.OnTryTableCatch(tag_type.params, catch_.target.index()); + return result; +} + +Result SharedValidator::EndTryTable(const Location& loc, Type sig_type) { + Result result = CheckInstr(Opcode::TryTable, loc); + TypeVector param_types, result_types; + result |= CheckBlockSignature(loc, Opcode::TryTable, sig_type, ¶m_types, + &result_types); + result |= typechecker_.EndTryTable(param_types, result_types); + return result; +} + Result SharedValidator::OnUnary(const Location& loc, Opcode opcode) { Result result = CheckInstr(opcode, loc); result |= typechecker_.OnUnary(opcode); |