From 036a632a24679062e7fc891e7743195139bfa0a9 Mon Sep 17 00:00:00 2001 From: Asumu Takikawa Date: Tue, 9 Feb 2021 12:12:01 -0800 Subject: [PATCH] Update exception handling support to current proposal (#1596) This PR updates the support of exception handling to the latest proposal (that is compatible with future 2-phase exception handling) described in https://github.com/WebAssembly/exception-handling/pull/137 and https://github.com/WebAssembly/exception-handling/pull/143. * Adds back tagged `catch $e`, `catch_all`, and `rethrow N` from a previous version of wabt, but with updates to match the current spec (e.g., `catch_all` shares an opcode with `else`, `rethrow`'s depth indexes only catch blocks, etc). * Adds `unwind` and `delegate` instructions. * Removes `exnref` and `br_on_exn`. * Updates relevant tests. There are some details that could still change (e.g., maybe how `delegate`'s depth is validated), but I'd be happy to submit further PRs if the spec details change. --- src/apply-names.cc | 30 +- src/binary-reader-ir.cc | 98 +- src/binary-reader-logging.cc | 7 +- src/binary-reader-logging.h | 7 +- src/binary-reader-nop.h | 9 +- src/binary-reader-objdump.cc | 11 + src/binary-reader.cc | 33 +- src/binary-reader.h | 7 +- src/binary-writer.cc | 43 +- src/c-writer.cc | 1 - src/common.h | 3 +- src/decompiler-ls.h | 1 - src/expr-visitor.cc | 68 +- src/expr-visitor.h | 14 +- src/interp/interp-util.cc | 3 - src/interp/interp.cc | 6 +- src/interp/istream.cc | 3 +- src/ir-util.cc | 3 - src/ir.cc | 1 - src/ir.h | 39 +- src/lexer-keywords.txt | 6 +- src/opcode-code-table.c | 1 + src/opcode.cc | 3 +- src/opcode.def | 3 +- src/opcode.h | 1 + src/prebuilt/lexer-keywords.cc | 2518 ++++++++--------- src/resolve-names.cc | 29 +- src/shared-validator.cc | 42 +- src/shared-validator.h | 7 +- src/token.def | 6 +- src/tools/spectest-interp.cc | 2 - src/type-checker.cc | 118 +- src/type-checker.h | 11 +- src/type.h | 7 +- src/validator.cc | 28 +- src/wast-parser.cc | 136 +- src/wast-parser.h | 2 + src/wat-writer.cc | 81 +- test/binary/bad-multiple-catch-all.txt | 23 + test/desugar/try.txt | 4 +- test/dump/rethrow.txt | 28 +- test/dump/{br_on_exn.txt => try-delegate.txt} | 64 +- test/dump/try-multi.txt | 157 +- test/dump/try-unwind.txt | 90 + test/dump/try.txt | 105 +- test/gen-wasm.py | 4 + test/parse/expr/bad-try-delegate.txt | 15 + test/parse/expr/bad-try-multiple-catch.txt | 20 +- test/parse/expr/bad-try-no-catch.txt | 2 +- test/parse/expr/bad-try-unwind.txt | 38 + test/parse/expr/br_on_exn.txt | 14 - test/parse/expr/rethrow.txt | 4 +- test/parse/expr/try-catch-all.txt | 18 + test/parse/expr/try-delegate.txt | 16 + test/parse/expr/try-multi.txt | 8 +- test/parse/expr/try-unwind.txt | 15 + test/parse/expr/try.txt | 8 +- test/parse/func/local-exnref.txt | 3 - test/parse/func/param-exnref.txt | 3 - test/parse/func/result-exnref.txt | 3 - test/parse/module/global-exnref.txt | 3 - test/roundtrip/fold-br_on_exn.txt | 29 - test/roundtrip/fold-rethrow.txt | 8 +- test/roundtrip/fold-try-delegate.txt | 28 + test/roundtrip/fold-try-unwind.txt | 25 + test/roundtrip/fold-try.txt | 6 +- test/roundtrip/rethrow.txt | 8 +- .../bad-br_on_exn-label-type-mismatch.txt | 16 - test/typecheck/bad-br_on_exn-mismatch.txt | 14 - .../bad-br_on_exn-result-mismatch.txt | 15 - test/typecheck/bad-delegate-depth.txt | 19 + test/typecheck/bad-empty-catch-all.txt | 15 + test/typecheck/bad-empty-catch.txt | 9 +- test/typecheck/bad-rethrow-depth.txt | 22 + test/typecheck/bad-rethrow-not-in-catch.txt | 17 + test/typecheck/delegate.txt | 33 + test/typecheck/rethrow.txt | 29 + 77 files changed, 2542 insertions(+), 1784 deletions(-) create mode 100644 test/binary/bad-multiple-catch-all.txt rename test/dump/{br_on_exn.txt => try-delegate.txt} (65%) create mode 100644 test/dump/try-unwind.txt create mode 100644 test/parse/expr/bad-try-delegate.txt create mode 100644 test/parse/expr/bad-try-unwind.txt delete mode 100644 test/parse/expr/br_on_exn.txt create mode 100644 test/parse/expr/try-catch-all.txt create mode 100644 test/parse/expr/try-delegate.txt create mode 100644 test/parse/expr/try-unwind.txt delete mode 100644 test/parse/func/local-exnref.txt delete mode 100644 test/parse/func/param-exnref.txt delete mode 100644 test/parse/func/result-exnref.txt delete mode 100644 test/parse/module/global-exnref.txt delete mode 100644 test/roundtrip/fold-br_on_exn.txt create mode 100644 test/roundtrip/fold-try-delegate.txt create mode 100644 test/roundtrip/fold-try-unwind.txt delete mode 100644 test/typecheck/bad-br_on_exn-label-type-mismatch.txt delete mode 100644 test/typecheck/bad-br_on_exn-mismatch.txt delete mode 100644 test/typecheck/bad-br_on_exn-result-mismatch.txt create mode 100644 test/typecheck/bad-delegate-depth.txt create mode 100644 test/typecheck/bad-empty-catch-all.txt create mode 100644 test/typecheck/bad-rethrow-depth.txt create mode 100644 test/typecheck/bad-rethrow-not-in-catch.txt create mode 100644 test/typecheck/delegate.txt create mode 100644 test/typecheck/rethrow.txt diff --git a/src/apply-names.cc b/src/apply-names.cc index 95868176f..0159091fa 100644 --- a/src/apply-names.cc +++ b/src/apply-names.cc @@ -39,7 +39,6 @@ class NameApplier : public ExprVisitor::DelegateNop { Result EndBlockExpr(BlockExpr*) override; Result OnBrExpr(BrExpr*) override; Result OnBrIfExpr(BrIfExpr*) override; - Result OnBrOnExnExpr(BrOnExnExpr*) override; Result OnBrTableExpr(BrTableExpr*) override; Result OnCallExpr(CallExpr*) override; Result OnRefFuncExpr(RefFuncExpr*) override; @@ -67,7 +66,10 @@ class NameApplier : public ExprVisitor::DelegateNop { Result OnTableFillExpr(TableFillExpr*) override; Result BeginTryExpr(TryExpr*) override; Result EndTryExpr(TryExpr*) override; + Result OnCatchExpr(TryExpr*, Catch*) override; + Result OnDelegateExpr(TryExpr*) override; Result OnThrowExpr(ThrowExpr*) override; + Result OnRethrowExpr(RethrowExpr*) override; private: void PushLabel(const std::string& label); @@ -310,13 +312,6 @@ Result NameApplier::OnBrIfExpr(BrIfExpr* expr) { return Result::Ok; } -Result NameApplier::OnBrOnExnExpr(BrOnExnExpr* expr) { - string_view label = FindLabelByVar(&expr->label_var); - UseNameForVar(label, &expr->label_var); - CHECK_RESULT(UseNameForEventVar(&expr->event_var)); - return Result::Ok; -} - Result NameApplier::OnBrTableExpr(BrTableExpr* expr) { for (Var& target : expr->targets) { string_view label = FindLabelByVar(&target); @@ -338,11 +333,30 @@ Result NameApplier::EndTryExpr(TryExpr*) { return Result::Ok; } +Result NameApplier::OnCatchExpr(TryExpr*, Catch* expr) { + if (!expr->IsCatchAll()) { + CHECK_RESULT(UseNameForEventVar(&expr->var)); + } + return Result::Ok; +} + +Result NameApplier::OnDelegateExpr(TryExpr* expr) { + string_view label = FindLabelByVar(&expr->delegate_target); + UseNameForVar(label, &expr->delegate_target); + return Result::Ok; +} + Result NameApplier::OnThrowExpr(ThrowExpr* expr) { CHECK_RESULT(UseNameForEventVar(&expr->var)); return Result::Ok; } +Result NameApplier::OnRethrowExpr(RethrowExpr* expr) { + string_view label = FindLabelByVar(&expr->var); + UseNameForVar(label, &expr->var); + return Result::Ok; +} + Result NameApplier::OnCallExpr(CallExpr* expr) { CHECK_RESULT(UseNameForFuncVar(&expr->var)); return Result::Ok; diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc index b59598c41..53a522334 100644 --- a/src/binary-reader-ir.cc +++ b/src/binary-reader-ir.cc @@ -140,17 +140,17 @@ class BinaryReaderIR : public BinaryReaderNop { Result OnBlockExpr(Type sig_type) override; Result OnBrExpr(Index depth) override; Result OnBrIfExpr(Index depth) override; - Result OnBrOnExnExpr(Index depth, Index event_index) override; Result OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) override; Result OnCallExpr(Index func_index) override; - Result OnCatchExpr() override; + Result OnCatchExpr(Index event_index) 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; Result OnCompareExpr(Opcode opcode) override; Result OnConvertExpr(Opcode opcode) override; + Result OnDelegateExpr(Index depth) override; Result OnDropExpr() override; Result OnElseExpr() override; Result OnEndExpr() override; @@ -187,7 +187,7 @@ class BinaryReaderIR : public BinaryReaderNop { Result OnRefNullExpr(Type type) override; Result OnRefIsNullExpr() override; Result OnNopExpr() override; - Result OnRethrowExpr() override; + Result OnRethrowExpr(Index depth) override; Result OnReturnExpr() override; Result OnSelectExpr(Index result_count, Type* result_types) override; Result OnStoreExpr(Opcode opcode, @@ -198,6 +198,7 @@ class BinaryReaderIR : public BinaryReaderNop { Result OnUnaryExpr(Opcode opcode) override; Result OnTernaryExpr(Opcode opcode) override; Result OnUnreachableExpr() override; + Result OnUnwindExpr() override; Result EndFunctionBody(Index index) override; Result OnSimdLaneOpExpr(Opcode opcode, uint64_t value) override; Result OnSimdShuffleOpExpr(Opcode opcode, v128 value) override; @@ -274,6 +275,7 @@ class BinaryReaderIR : public BinaryReaderNop { Result TopLabel(LabelNode** label); Result TopLabelExpr(LabelNode** label, Expr** expr); Result AppendExpr(std::unique_ptr expr); + Result AppendCatch(Catch&& catch_); void SetFuncDeclaration(FuncDeclaration* decl, Var var); void SetBlockDeclaration(BlockDeclaration* decl, Type sig_type); @@ -701,13 +703,6 @@ Result BinaryReaderIR::OnBrIfExpr(Index depth) { return AppendExpr(MakeUnique(Var(depth))); } -Result BinaryReaderIR::OnBrOnExnExpr(Index depth, Index event_index) { - auto expr = MakeUnique(); - expr->label_var = Var(depth); - expr->event_var = Var(event_index); - return AppendExpr(std::move(expr)); -} - Result BinaryReaderIR::OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) { @@ -764,6 +759,8 @@ 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; @@ -795,6 +792,7 @@ Result BinaryReaderIR::OnEndExpr() { case LabelType::Func: case LabelType::Catch: + case LabelType::Unwind: break; } @@ -929,8 +927,8 @@ Result BinaryReaderIR::OnNopExpr() { return AppendExpr(MakeUnique()); } -Result BinaryReaderIR::OnRethrowExpr() { - return AppendExpr(MakeUnique()); +Result BinaryReaderIR::OnRethrowExpr(Index depth) { + return AppendExpr(MakeUnique(Var(depth, GetLocation()))); } Result BinaryReaderIR::OnReturnExpr() { @@ -977,19 +975,81 @@ Result BinaryReaderIR::OnTryExpr(Type sig_type) { return Result::Ok; } -Result BinaryReaderIR::OnCatchExpr() { - LabelNode* label; +Result BinaryReaderIR::AppendCatch(Catch&& catch_) { + LabelNode* label = nullptr; CHECK_RESULT(TopLabel(&label)); + if (label->label_type != LabelType::Try) { - PrintError("catch expression without matching try"); + PrintError("catch not inside try block"); return Result::Error; } - LabelNode* parent_label; - CHECK_RESULT(GetLabelAt(&parent_label, 1)); + auto* try_ = cast(label->context); + + if (catch_.IsCatchAll() && !try_->catches.empty() && try_->catches.back().IsCatchAll()) { + PrintError("only one catch_all allowed in try block"); + return Result::Error; + } + + if (try_->kind == TryKind::Invalid) { + try_->kind = TryKind::Catch; + } else if (try_->kind != TryKind::Catch) { + PrintError("catch not allowed in try-unwind or try-delegate"); + return Result::Error; + } + + try_->catches.push_back(std::move(catch_)); + label->exprs = &try_->catches.back().exprs; + return Result::Ok; +} + +Result BinaryReaderIR::OnCatchExpr(Index except_index) { + return AppendCatch(Catch(Var(except_index, GetLocation()))); +} + +Result BinaryReaderIR::OnUnwindExpr() { + LabelNode* label = nullptr; + CHECK_RESULT(TopLabel(&label)); + + if (label->label_type != LabelType::Try) { + PrintError("unwind not inside try block"); + return Result::Error; + } + + auto* try_ = cast(label->context); + + if (try_->kind == TryKind::Invalid) { + try_->kind = TryKind::Unwind; + } else if (try_->kind != TryKind::Unwind) { + PrintError("unwind not allowed in try-catch or try-delegate"); + return Result::Error; + } + + label->exprs = &try_->unwind; + return Result::Ok; +} + +Result BinaryReaderIR::OnDelegateExpr(Index depth) { + LabelNode* label = nullptr; + CHECK_RESULT(TopLabel(&label)); + + if (label->label_type != LabelType::Try) { + PrintError("delegate not inside try block"); + return Result::Error; + } + + auto* try_ = cast(label->context); + + if (try_->kind == TryKind::Invalid) { + try_->kind = TryKind::Delegate; + } else if (try_->kind != TryKind::Delegate) { + PrintError("delegate not allowed in try-catch or try-unwind"); + return Result::Error; + } + + try_->delegate_target = Var(depth, GetLocation()); - label->label_type = LabelType::Catch; - label->exprs = &cast(&parent_label->exprs->back())->catch_; + PopLabel(); return Result::Ok; } diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc index 8090c95b3..2c2d1e7f0 100644 --- a/src/binary-reader-logging.cc +++ b/src/binary-reader-logging.cc @@ -790,13 +790,13 @@ DEFINE_LOAD_STORE_OPCODE(OnAtomicStoreExpr); DEFINE_LOAD_STORE_OPCODE(OnAtomicWaitExpr); DEFINE_INDEX_DESC(OnAtomicFenceExpr, "consistency_model"); DEFINE_LOAD_STORE_OPCODE(OnAtomicNotifyExpr); -DEFINE_INDEX_INDEX(OnBrOnExnExpr, "depth", "event_index"); DEFINE_OPCODE(OnBinaryExpr) DEFINE_INDEX_DESC(OnCallExpr, "func_index") DEFINE_INDEX_INDEX(OnCallIndirectExpr, "sig_index", "table_index") -DEFINE0(OnCatchExpr); +DEFINE_INDEX_DESC(OnCatchExpr, "event_index"); DEFINE_OPCODE(OnCompareExpr) DEFINE_OPCODE(OnConvertExpr) +DEFINE_INDEX_DESC(OnDelegateExpr, "depth"); DEFINE0(OnDropExpr) DEFINE0(OnElseExpr) DEFINE0(OnEndExpr) @@ -824,7 +824,7 @@ DEFINE_INDEX(OnRefFuncExpr) DEFINE_TYPE(OnRefNullExpr) DEFINE0(OnRefIsNullExpr) DEFINE0(OnNopExpr) -DEFINE0(OnRethrowExpr); +DEFINE_INDEX_DESC(OnRethrowExpr, "depth"); DEFINE_INDEX_DESC(OnReturnCallExpr, "func_index") DEFINE_INDEX_INDEX(OnReturnCallIndirectExpr, "sig_index", "table_index") @@ -833,6 +833,7 @@ DEFINE_LOAD_STORE_OPCODE(OnLoadSplatExpr); DEFINE_LOAD_STORE_OPCODE(OnStoreExpr); DEFINE_INDEX_DESC(OnThrowExpr, "event_index") DEFINE0(OnUnreachableExpr) +DEFINE0(OnUnwindExpr) DEFINE_OPCODE(OnUnaryExpr) DEFINE_OPCODE(OnTernaryExpr) DEFINE_END(EndCodeSection) diff --git a/src/binary-reader-logging.h b/src/binary-reader-logging.h index 909b0ce70..30dc0712e 100644 --- a/src/binary-reader-logging.h +++ b/src/binary-reader-logging.h @@ -159,15 +159,15 @@ class BinaryReaderLogging : public BinaryReaderDelegate { Result OnBlockExpr(Type sig_type) override; Result OnBrExpr(Index depth) override; Result OnBrIfExpr(Index depth) override; - Result OnBrOnExnExpr(Index depth, Index event_index) override; Result OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) override; Result OnCallExpr(Index func_index) override; - Result OnCatchExpr() override; + Result OnCatchExpr(Index event_index) override; Result OnCallIndirectExpr(Index sig_index, Index table_index) override; Result OnCompareExpr(Opcode opcode) override; Result OnConvertExpr(Opcode opcode) override; + Result OnDelegateExpr(Index depth) override; Result OnDropExpr() override; Result OnElseExpr() override; Result OnEndExpr() override; @@ -205,7 +205,7 @@ class BinaryReaderLogging : public BinaryReaderDelegate { Result OnRefNullExpr(Type type) override; Result OnRefIsNullExpr() override; Result OnNopExpr() override; - Result OnRethrowExpr() override; + Result OnRethrowExpr(Index depth) override; Result OnReturnCallExpr(Index func_index) override; Result OnReturnCallIndirectExpr(Index sig_index, Index table_index) override; Result OnReturnExpr() override; @@ -218,6 +218,7 @@ class BinaryReaderLogging : public BinaryReaderDelegate { Result OnUnaryExpr(Opcode opcode) override; Result OnTernaryExpr(Opcode opcode) override; Result OnUnreachableExpr() override; + Result OnUnwindExpr() override; Result OnAtomicWaitExpr(Opcode opcode, Address alignment_log2, Address offset) override; diff --git a/src/binary-reader-nop.h b/src/binary-reader-nop.h index 72cd1b2b4..1f29a6708 100644 --- a/src/binary-reader-nop.h +++ b/src/binary-reader-nop.h @@ -226,9 +226,6 @@ class BinaryReaderNop : public BinaryReaderDelegate { Result OnBlockExpr(Type sig_type) override { return Result::Ok; } Result OnBrExpr(Index depth) override { return Result::Ok; } Result OnBrIfExpr(Index depth) override { return Result::Ok; } - Result OnBrOnExnExpr(Index depth, Index event_index) override { - return Result::Ok; - } Result OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) override { @@ -236,9 +233,10 @@ class BinaryReaderNop : public BinaryReaderDelegate { } Result OnCallExpr(Index func_index) override { return Result::Ok; } Result OnCallIndirectExpr(Index sig_index, Index table_index) override { return Result::Ok; } - Result OnCatchExpr() override { return Result::Ok; } + Result OnCatchExpr(Index event_index) override { return Result::Ok; } Result OnCompareExpr(Opcode opcode) override { return Result::Ok; } Result OnConvertExpr(Opcode opcode) override { return Result::Ok; } + Result OnDelegateExpr(Index depth) override { return Result::Ok; } Result OnDropExpr() override { return Result::Ok; } Result OnElseExpr() override { return Result::Ok; } Result OnEndExpr() override { return Result::Ok; } @@ -282,7 +280,7 @@ class BinaryReaderNop : public BinaryReaderDelegate { Result OnRefNullExpr(Type type) override { return Result::Ok; } Result OnRefIsNullExpr() override { return Result::Ok; } Result OnNopExpr() override { return Result::Ok; } - Result OnRethrowExpr() override { return Result::Ok; } + Result OnRethrowExpr(Index depth) override { return Result::Ok; } Result OnReturnCallExpr(Index sig_index) override { return Result::Ok; } Result OnReturnCallIndirectExpr(Index sig_index, Index table_index) override { return Result::Ok; } Result OnReturnExpr() override { return Result::Ok; } @@ -299,6 +297,7 @@ class BinaryReaderNop : public BinaryReaderDelegate { Result OnUnaryExpr(Opcode opcode) override { return Result::Ok; } Result OnTernaryExpr(Opcode opcode) override { return Result::Ok; } Result OnUnreachableExpr() override { return Result::Ok; } + Result OnUnwindExpr() override { return Result::Ok; } Result EndFunctionBody(Index index) override { return Result::Ok; } Result EndCodeSection() override { return Result::Ok; } Result OnSimdLaneOpExpr(Opcode opcode, uint64_t value) override { diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index 77d207d22..f03283e75 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -475,6 +475,7 @@ class BinaryReaderObjdumpDisassemble : public BinaryReaderObjdumpBase { Result OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) override; + Result OnDelegateExpr(Index) override; Result OnEndExpr() override; Result OnEndFunc() override; @@ -595,6 +596,7 @@ void BinaryReaderObjdumpDisassemble::LogOpcode(size_t data_size, switch (current_opcode) { case Opcode::Else: case Opcode::Catch: + case Opcode::Unwind: indent_level--; default: break; @@ -741,6 +743,15 @@ Result BinaryReaderObjdumpDisassemble::OnBrTableExpr( return Result::Ok; } +Result BinaryReaderObjdumpDisassemble::OnDelegateExpr(Index depth) { + // Because `delegate` ends the block we need to dedent here, and + // we don't need to dedent it in LogOpcode. + if (indent_level > 0) { + indent_level--; + } + return Result::Ok; +} + Result BinaryReaderObjdumpDisassemble::OnEndFunc() { LogOpcode(0, nullptr); return Result::Ok; diff --git a/src/binary-reader.cc b/src/binary-reader.cc index 0cf06a0eb..495de3063 100644 --- a/src/binary-reader.cc +++ b/src/binary-reader.cc @@ -447,9 +447,6 @@ bool BinaryReader::IsConcreteType(Type type) { case Type::ExternRef: return options_.features.reference_types_enabled(); - case Type::ExnRef: - return options_.features.exceptions_enabled(); - default: return false; } @@ -1337,32 +1334,40 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { } case Opcode::Catch: { - CALLBACK0(OnCatchExpr); - CALLBACK0(OnOpcodeBare); + Index index; + CHECK_RESULT(ReadIndex(&index, "event index")); + CALLBACK(OnCatchExpr, index); + CALLBACK(OnOpcodeIndex, index); break; } - case Opcode::Rethrow: { - CALLBACK0(OnRethrowExpr); + case Opcode::Unwind: { + CALLBACK0(OnUnwindExpr); CALLBACK0(OnOpcodeBare); break; } - case Opcode::Throw: { + case Opcode::Delegate: { Index index; - CHECK_RESULT(ReadIndex(&index, "event index")); - CALLBACK(OnThrowExpr, index); + CHECK_RESULT(ReadIndex(&index, "depth")); + CALLBACK(OnDelegateExpr, index); CALLBACK(OnOpcodeIndex, index); break; } - case Opcode::BrOnExn: { + case Opcode::Rethrow: { Index depth; + CHECK_RESULT(ReadIndex(&depth, "catch depth")); + CALLBACK(OnRethrowExpr, depth); + CALLBACK(OnOpcodeIndex, depth); + break; + } + + case Opcode::Throw: { Index index; - CHECK_RESULT(ReadIndex(&depth, "br_on_exn depth")); CHECK_RESULT(ReadIndex(&index, "event index")); - CALLBACK(OnBrOnExnExpr, depth, index); - CALLBACK(OnOpcodeIndexIndex, depth, index); + CALLBACK(OnThrowExpr, index); + CALLBACK(OnOpcodeIndex, index); break; } diff --git a/src/binary-reader.h b/src/binary-reader.h index a7fa78421..6ba4c9b7a 100644 --- a/src/binary-reader.h +++ b/src/binary-reader.h @@ -225,15 +225,15 @@ class BinaryReaderDelegate { virtual Result OnBlockExpr(Type sig_type) = 0; virtual Result OnBrExpr(Index depth) = 0; virtual Result OnBrIfExpr(Index depth) = 0; - virtual Result OnBrOnExnExpr(Index depth, Index event_index) = 0; virtual Result OnBrTableExpr(Index num_targets, Index* target_depths, Index default_target_depth) = 0; virtual Result OnCallExpr(Index func_index) = 0; virtual Result OnCallIndirectExpr(Index sig_index, Index table_index) = 0; - virtual Result OnCatchExpr() = 0; + virtual Result OnCatchExpr(Index event_index) = 0; virtual Result OnCompareExpr(Opcode opcode) = 0; virtual Result OnConvertExpr(Opcode opcode) = 0; + virtual Result OnDelegateExpr(Index depth) = 0; virtual Result OnDropExpr() = 0; virtual Result OnElseExpr() = 0; virtual Result OnEndExpr() = 0; @@ -271,7 +271,7 @@ class BinaryReaderDelegate { virtual Result OnRefNullExpr(Type type) = 0; virtual Result OnRefIsNullExpr() = 0; virtual Result OnNopExpr() = 0; - virtual Result OnRethrowExpr() = 0; + virtual Result OnRethrowExpr(Index depth) = 0; virtual Result OnReturnExpr() = 0; virtual Result OnReturnCallExpr(Index func_index) = 0; virtual Result OnReturnCallIndirectExpr(Index sig_index, @@ -286,6 +286,7 @@ class BinaryReaderDelegate { virtual Result OnUnaryExpr(Opcode opcode) = 0; virtual Result OnTernaryExpr(Opcode opcode) = 0; virtual Result OnUnreachableExpr() = 0; + virtual Result OnUnwindExpr() = 0; virtual Result EndFunctionBody(Index index) = 0; virtual Result EndCodeSection() = 0; diff --git a/src/binary-writer.cc b/src/binary-writer.cc index 68d32c839..6ef3e71d3 100644 --- a/src/binary-writer.cc +++ b/src/binary-writer.cc @@ -691,15 +691,6 @@ void BinaryWriter::WriteExpr(const Func* func, const Expr* expr) { WriteU32Leb128(stream_, GetLabelVarDepth(&cast(expr)->var), "break depth"); break; - case ExprType::BrOnExn: { - auto* br_on_exn_expr = cast(expr); - WriteOpcode(stream_, Opcode::BrOnExn); - WriteU32Leb128(stream_, GetLabelVarDepth(&br_on_exn_expr->label_var), - "break depth"); - WriteU32Leb128(stream_, module_->GetEventIndex(br_on_exn_expr->event_var), - "event index"); - break; - } case ExprType::BrTable: { auto* br_table_expr = cast(expr); WriteOpcode(stream_, Opcode::BrTable); @@ -948,6 +939,8 @@ void BinaryWriter::WriteExpr(const Func* func, const Expr* expr) { break; case ExprType::Rethrow: WriteOpcode(stream_, Opcode::Rethrow); + WriteU32Leb128(stream_, GetLabelVarDepth(&cast(expr)->var), + "rethrow depth"); break; case ExprType::Return: WriteOpcode(stream_, Opcode::Return); @@ -979,9 +972,35 @@ void BinaryWriter::WriteExpr(const Func* func, const Expr* expr) { WriteOpcode(stream_, Opcode::Try); WriteBlockDecl(try_expr->block.decl); WriteExprList(func, try_expr->block.exprs); - WriteOpcode(stream_, Opcode::Catch); - WriteExprList(func, try_expr->catch_); - WriteOpcode(stream_, Opcode::End); + switch (try_expr->kind) { + case TryKind::Catch: + for (const Catch& catch_ : try_expr->catches) { + if (catch_.IsCatchAll()) { + WriteOpcode(stream_, Opcode::Else); + } else { + WriteOpcode(stream_, Opcode::Catch); + WriteU32Leb128(stream_, GetEventVarDepth(&catch_.var), + "catch event"); + } + WriteExprList(func, catch_.exprs); + } + WriteOpcode(stream_, Opcode::End); + break; + case TryKind::Unwind: + WriteOpcode(stream_, Opcode::Unwind); + WriteExprList(func, try_expr->unwind); + WriteOpcode(stream_, Opcode::End); + break; + case TryKind::Delegate: + WriteOpcode(stream_, Opcode::Delegate); + WriteU32Leb128(stream_, + GetLabelVarDepth(&try_expr->delegate_target), + "delegate depth"); + break; + case TryKind::Invalid: + // Should not occur. + break; + } break; } case ExprType::Unary: diff --git a/src/c-writer.cc b/src/c-writer.cc index 843abf262..d1129b204 100644 --- a/src/c-writer.cc +++ b/src/c-writer.cc @@ -1592,7 +1592,6 @@ void CWriter::Write(const ExprList& exprs) { case ExprType::AtomicWait: case ExprType::AtomicFence: case ExprType::AtomicNotify: - case ExprType::BrOnExn: case ExprType::Rethrow: case ExprType::ReturnCall: case ExprType::ReturnCallIndirect: diff --git a/src/common.h b/src/common.h index 45b75afd4..dbac0a895 100644 --- a/src/common.h +++ b/src/common.h @@ -228,9 +228,10 @@ enum class LabelType { Else, Try, Catch, + Unwind, First = Func, - Last = Catch, + Last = Unwind, }; static const int kLabelTypeCount = WABT_ENUM_COUNT(LabelType); diff --git a/src/decompiler-ls.h b/src/decompiler-ls.h index b9261e8b9..f622e3fd9 100644 --- a/src/decompiler-ls.h +++ b/src/decompiler-ls.h @@ -39,7 +39,6 @@ inline const char *GetDecompTypeName(Type t) { case Type::Func: return "func"; case Type::FuncRef: return "funcref"; case Type::ExternRef: return "externref"; - case Type::ExnRef: return "exnref"; case Type::Void: return "void"; default: return "ILLEGAL"; } diff --git a/src/expr-visitor.cc b/src/expr-visitor.cc index 448bca005..af80e7052 100644 --- a/src/expr-visitor.cc +++ b/src/expr-visitor.cc @@ -27,6 +27,7 @@ Result ExprVisitor::VisitExpr(Expr* root_expr) { state_stack_.clear(); expr_stack_.clear(); expr_iter_stack_.clear(); + catch_index_stack_.clear(); PushDefault(root_expr); @@ -95,21 +96,56 @@ Result ExprVisitor::VisitExpr(Expr* root_expr) { if (iter != try_expr->block.exprs.end()) { PushDefault(&*iter++); } else { - CHECK_RESULT(delegate_->OnCatchExpr(try_expr)); PopExprlist(); - if (try_expr->catch_.empty()) { - CHECK_RESULT(delegate_->EndTryExpr(try_expr)); - } else { - PushExprlist(State::Catch, expr, try_expr->catch_); + switch (try_expr->kind) { + case TryKind::Catch: + if (!try_expr->catches.empty()) { + Catch& catch_ = try_expr->catches[0]; + CHECK_RESULT(delegate_->OnCatchExpr(try_expr, &catch_)); + PushCatch(expr, 0, catch_.exprs); + } else { + CHECK_RESULT(delegate_->EndTryExpr(try_expr)); + } + break; + case TryKind::Unwind: + CHECK_RESULT(delegate_->OnUnwindExpr(try_expr)); + PushExprlist(State::Unwind, expr, try_expr->unwind); + break; + case TryKind::Delegate: + CHECK_RESULT(delegate_->OnDelegateExpr(try_expr)); + break; + case TryKind::Invalid: + // Should not happen. + break; } } break; } case State::Catch: { + auto try_expr = cast(expr); + Index catch_index = catch_index_stack_.back(); + auto& iter = expr_iter_stack_.back(); + if (iter != try_expr->catches[catch_index].exprs.end()) { + PushDefault(&*iter++); + } else { + PopCatch(); + catch_index++; + if (catch_index < try_expr->catches.size()) { + Catch& catch_ = try_expr->catches[catch_index]; + CHECK_RESULT(delegate_->OnCatchExpr(try_expr, &catch_)); + PushCatch(expr, catch_index, catch_.exprs); + } else { + CHECK_RESULT(delegate_->EndTryExpr(try_expr)); + } + } + break; + } + + case State::Unwind: { auto try_expr = cast(expr); auto& iter = expr_iter_stack_.back(); - if (iter != try_expr->catch_.end()) { + if (iter != try_expr->unwind.end()) { PushDefault(&*iter++); } else { CHECK_RESULT(delegate_->EndTryExpr(try_expr)); @@ -183,10 +219,6 @@ Result ExprVisitor::HandleDefaultState(Expr* expr) { CHECK_RESULT(delegate_->OnBrIfExpr(cast(expr))); break; - case ExprType::BrOnExn: - CHECK_RESULT(delegate_->OnBrOnExnExpr(cast(expr))); - break; - case ExprType::BrTable: CHECK_RESULT(delegate_->OnBrTableExpr(cast(expr))); break; @@ -415,4 +447,20 @@ void ExprVisitor::PopExprlist() { expr_iter_stack_.pop_back(); } +void ExprVisitor::PushCatch(Expr* expr, + Index catch_index, + ExprList& expr_list) { + state_stack_.emplace_back(State::Catch); + expr_stack_.emplace_back(expr); + expr_iter_stack_.emplace_back(expr_list.begin()); + catch_index_stack_.emplace_back(catch_index); +} + +void ExprVisitor::PopCatch() { + state_stack_.pop_back(); + expr_stack_.pop_back(); + expr_iter_stack_.pop_back(); + catch_index_stack_.pop_back(); +} + } // namespace wabt diff --git a/src/expr-visitor.h b/src/expr-visitor.h index c4880bf01..f30607ce9 100644 --- a/src/expr-visitor.h +++ b/src/expr-visitor.h @@ -42,6 +42,7 @@ class ExprVisitor { Loop, Try, Catch, + Unwind, }; Result HandleDefaultState(Expr*); @@ -49,6 +50,8 @@ class ExprVisitor { void PopDefault(); void PushExprlist(State state, Expr*, ExprList&); void PopExprlist(); + void PushCatch(Expr*, Index catch_index, ExprList&); + void PopCatch(); Delegate* delegate_; @@ -58,6 +61,7 @@ class ExprVisitor { std::vector state_stack_; std::vector expr_stack_; std::vector expr_iter_stack_; + std::vector catch_index_stack_; }; class ExprVisitor::Delegate { @@ -69,7 +73,6 @@ class ExprVisitor::Delegate { virtual Result EndBlockExpr(BlockExpr*) = 0; virtual Result OnBrExpr(BrExpr*) = 0; virtual Result OnBrIfExpr(BrIfExpr*) = 0; - virtual Result OnBrOnExnExpr(BrOnExnExpr*) = 0; virtual Result OnBrTableExpr(BrTableExpr*) = 0; virtual Result OnCallExpr(CallExpr*) = 0; virtual Result OnCallIndirectExpr(CallIndirectExpr*) = 0; @@ -114,7 +117,9 @@ class ExprVisitor::Delegate { virtual Result OnUnaryExpr(UnaryExpr*) = 0; virtual Result OnUnreachableExpr(UnreachableExpr*) = 0; virtual Result BeginTryExpr(TryExpr*) = 0; - virtual Result OnCatchExpr(TryExpr*) = 0; + virtual Result OnCatchExpr(TryExpr*, Catch*) = 0; + virtual Result OnUnwindExpr(TryExpr*) = 0; + virtual Result OnDelegateExpr(TryExpr*) = 0; virtual Result EndTryExpr(TryExpr*) = 0; virtual Result OnThrowExpr(ThrowExpr*) = 0; virtual Result OnRethrowExpr(RethrowExpr*) = 0; @@ -138,7 +143,6 @@ class ExprVisitor::DelegateNop : public ExprVisitor::Delegate { Result EndBlockExpr(BlockExpr*) override { return Result::Ok; } Result OnBrExpr(BrExpr*) override { return Result::Ok; } Result OnBrIfExpr(BrIfExpr*) override { return Result::Ok; } - Result OnBrOnExnExpr(BrOnExnExpr*) override { return Result::Ok; } Result OnBrTableExpr(BrTableExpr*) override { return Result::Ok; } Result OnCallExpr(CallExpr*) override { return Result::Ok; } Result OnCallIndirectExpr(CallIndirectExpr*) override { return Result::Ok; } @@ -185,7 +189,9 @@ class ExprVisitor::DelegateNop : public ExprVisitor::Delegate { Result OnUnaryExpr(UnaryExpr*) override { return Result::Ok; } Result OnUnreachableExpr(UnreachableExpr*) override { return Result::Ok; } Result BeginTryExpr(TryExpr*) override { return Result::Ok; } - Result OnCatchExpr(TryExpr*) override { return Result::Ok; } + Result OnCatchExpr(TryExpr*, Catch*) override { return Result::Ok; } + Result OnUnwindExpr(TryExpr*) override { return Result::Ok; } + Result OnDelegateExpr(TryExpr*) override { return Result::Ok; } Result EndTryExpr(TryExpr*) override { return Result::Ok; } Result OnThrowExpr(ThrowExpr*) override { return Result::Ok; } Result OnRethrowExpr(RethrowExpr*) override { return Result::Ok; } diff --git a/src/interp/interp-util.cc b/src/interp/interp-util.cc index 5b9e702bc..001b2d900 100644 --- a/src/interp/interp-util.cc +++ b/src/interp/interp-util.cc @@ -55,9 +55,6 @@ std::string TypedValueToString(const TypedValue& tv) { case Type::ExternRef: return StringPrintf("externref:%" PRIzd, tv.value.Get().index); - case Type::ExnRef: - return StringPrintf("exnref:%" PRIzd, tv.value.Get().index); - case Type::Func: case Type::Struct: case Type::Array: diff --git a/src/interp/interp.cc b/src/interp/interp.cc index 8d8ccc996..ce1897bb0 100644 --- a/src/interp/interp.cc +++ b/src/interp/interp.cc @@ -217,8 +217,6 @@ bool Store::HasValueType(Ref ref, ValueType type) const { case ValueType::FuncRef: return obj->kind() == ObjectKind::DefinedFunc || obj->kind() == ObjectKind::HostFunc; - case ValueType::ExnRef: // TODO - return false; default: return false; } @@ -1738,9 +1736,10 @@ RunResult Thread::StepInternal(Trap::Ptr* out_trap) { case O::Try: case O::Catch: + case O::Unwind: + case O::Delegate: case O::Throw: case O::Rethrow: - case O::BrOnExn: case O::InterpData: case O::Invalid: WABT_UNREACHABLE; @@ -2277,7 +2276,6 @@ std::string Thread::TraceSource::Pick(Index index, Instr instr) { case ValueType::FuncRef: reftype = "funcref"; break; case ValueType::ExternRef: reftype = "externref"; break; - case ValueType::ExnRef: reftype = "exnref"; break; default: WABT_UNREACHABLE; diff --git a/src/interp/istream.cc b/src/interp/istream.cc index e4693c116..6c531a885 100644 --- a/src/interp/istream.cc +++ b/src/interp/istream.cc @@ -692,8 +692,8 @@ Instr Istream::Read(Offset* offset) const { break; case Opcode::Block: - case Opcode::BrOnExn: case Opcode::Catch: + case Opcode::Delegate: case Opcode::Else: case Opcode::End: case Opcode::If: @@ -703,6 +703,7 @@ Instr Istream::Read(Offset* offset) const { case Opcode::Rethrow: case Opcode::Throw: case Opcode::Try: + case Opcode::Unwind: case Opcode::ReturnCall: // Not used. break; diff --git a/src/ir-util.cc b/src/ir-util.cc index 8b1e415e0..ef1c9a205 100644 --- a/src/ir-util.cc +++ b/src/ir-util.cc @@ -120,9 +120,6 @@ ModuleContext::Arities ModuleContext::GetExprArity(const Expr& expr) const { return { arity + 1, arity }; } - case ExprType::BrOnExn: - return { 1, 1 }; - case ExprType::BrTable: return { GetLabelArity(cast(&expr)->default_target) + 1, 1, true }; diff --git a/src/ir.cc b/src/ir.cc index 633f236a2..c74b98e50 100644 --- a/src/ir.cc +++ b/src/ir.cc @@ -36,7 +36,6 @@ const char* ExprTypeName[] = { "Block", "Br", "BrIf", - "BrOnExn", "BrTable", "Call", "CallIndirect", diff --git a/src/ir.h b/src/ir.h index cb155454c..6742aee10 100644 --- a/src/ir.h +++ b/src/ir.h @@ -292,7 +292,6 @@ enum class ExprType { Block, Br, BrIf, - BrOnExn, BrTable, Call, CallIndirect, @@ -362,6 +361,26 @@ struct Block { Location end_loc; }; +struct Catch { + explicit Catch(const Location& loc = Location()) : loc(loc) {} + explicit Catch(const Var& var, const Location& loc = Location()) + : loc(loc), var(var) {} + Location loc; + Var var; + ExprList exprs; + bool IsCatchAll() const { + return var.is_index() && var.index() == kInvalidIndex; + } +}; +typedef std::vector CatchVector; + +enum class TryKind { + Invalid, + Catch, + Unwind, + Delegate +}; + class Expr : public intrusive_list_base { public: WABT_DISALLOW_COPY_AND_ASSIGN(Expr); @@ -395,7 +414,6 @@ typedef ExprMixin MemorySizeExpr; typedef ExprMixin MemoryCopyExpr; typedef ExprMixin MemoryFillExpr; typedef ExprMixin NopExpr; -typedef ExprMixin RethrowExpr; typedef ExprMixin ReturnExpr; typedef ExprMixin UnreachableExpr; @@ -464,6 +482,7 @@ typedef VarExpr LocalSetExpr; typedef VarExpr LocalTeeExpr; typedef VarExpr ReturnCallExpr; typedef VarExpr ThrowExpr; +typedef VarExpr RethrowExpr; typedef VarExpr MemoryInitExpr; typedef VarExpr DataDropExpr; @@ -548,19 +567,13 @@ class IfExpr : public ExprMixin { class TryExpr : public ExprMixin { public: explicit TryExpr(const Location& loc = Location()) - : ExprMixin(loc) {} + : ExprMixin(loc), kind(TryKind::Invalid) {} + TryKind kind; Block block; - ExprList catch_; -}; - -class BrOnExnExpr : public ExprMixin { - public: - BrOnExnExpr(const Location& loc = Location()) - : ExprMixin(loc) {} - - Var label_var; - Var event_var; + CatchVector catches; + ExprList unwind; + Var delegate_target; }; class BrTableExpr : public ExprMixin { diff --git a/src/lexer-keywords.txt b/src/lexer-keywords.txt index caf3ec194..b62c28b3b 100644 --- a/src/lexer-keywords.txt +++ b/src/lexer-keywords.txt @@ -28,16 +28,17 @@ atomic.fence, TokenType::AtomicFence, Opcode::AtomicFence binary, TokenType::Bin block, TokenType::Block, Opcode::Block br_if, TokenType::BrIf, Opcode::BrIf -br_on_exn, TokenType::BrOnExn, Opcode::BrOnExn br_table, TokenType::BrTable, Opcode::BrTable br, TokenType::Br, Opcode::Br call_indirect, TokenType::CallIndirect, Opcode::CallIndirect call, TokenType::Call, Opcode::Call catch, TokenType::Catch, Opcode::Catch +catch_all, TokenType::CatchAll, Opcode::CatchAll current_memory, TokenType::MemorySize, Opcode::MemorySize data.drop, TokenType::DataDrop, Opcode::DataDrop data, TokenType::Data declare, TokenType::Declare +delegate, TokenType::Delegate do, TokenType::Do drop, TokenType::Drop, Opcode::Drop elem.drop, TokenType::ElemDrop, Opcode::ElemDrop @@ -45,8 +46,6 @@ elem, TokenType::Elem else, TokenType::Else, Opcode::Else end, TokenType::End, Opcode::End event, TokenType::Event -exn, Type::ExnRef, TokenType::Exn -exnref, Type::ExnRef extern, Type::ExternRef, TokenType::Extern externref, Type::ExternRef export, TokenType::Export @@ -583,3 +582,4 @@ i64.trunc_u:sat/f64, TokenType::Convert, Opcode::I64TruncSatF64U set_global, TokenType::GlobalSet, Opcode::GlobalSet set_local, TokenType::LocalSet, Opcode::LocalSet tee_local, TokenType::LocalTee, Opcode::LocalTee +unwind, TokenType::Unwind, Opcode::Unwind diff --git a/src/opcode-code-table.c b/src/opcode-code-table.c index c3e06d036..6a746c5ef 100644 --- a/src/opcode-code-table.c +++ b/src/opcode-code-table.c @@ -27,6 +27,7 @@ typedef enum WabtOpcodeEnum { #include "opcode.def" #undef WABT_OPCODE Invalid, + CatchAll = Else, } WabtOpcodeEnum; WABT_STATIC_ASSERT(Invalid <= WABT_OPCODE_CODE_TABLE_SIZE); diff --git a/src/opcode.cc b/src/opcode.cc index ed3d92805..03d247973 100644 --- a/src/opcode.cc +++ b/src/opcode.cc @@ -65,9 +65,10 @@ bool Opcode::IsEnabled(const Features& features) const { switch (enum_) { case Opcode::Try: case Opcode::Catch: + case Opcode::Unwind: + case Opcode::Delegate: case Opcode::Throw: case Opcode::Rethrow: - case Opcode::BrOnExn: return features.exceptions_enabled(); case Opcode::ReturnCallIndirect: diff --git a/src/opcode.def b/src/opcode.def index bfd5ecc87..2156f1184 100644 --- a/src/opcode.def +++ b/src/opcode.def @@ -45,7 +45,7 @@ WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x06, Try, "try", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x07, Catch, "catch", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x08, Throw, "throw", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x09, Rethrow, "rethrow", "") -WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x0a, BrOnExn, "br_on_exn", "") +WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x0a, Unwind, "unwind", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x0b, End, "end", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x0c, Br, "br", "") WABT_OPCODE(___, I32, ___, ___, 0, 0, 0x0d, BrIf, "br_if", "") @@ -55,6 +55,7 @@ WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x10, Call, "call", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x11, CallIndirect, "call_indirect", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x12, ReturnCall, "return_call", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x13, ReturnCallIndirect, "return_call_indirect", "") +WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x18, Delegate, "delegate", "") WABT_OPCODE(___, ___, ___, ___, 0, 0, 0x1a, Drop, "drop", "") WABT_OPCODE(___, ___, ___, I32, 0, 0, 0x1b, Select, "select", "") WABT_OPCODE(___, ___, ___, I32, 0, 0, 0x1c, SelectT, "select", "") diff --git a/src/opcode.h b/src/opcode.h index 94cd4cb8f..80d3181bd 100644 --- a/src/opcode.h +++ b/src/opcode.h @@ -39,6 +39,7 @@ struct Opcode { #include "src/opcode.def" #undef WABT_OPCODE Invalid, + CatchAll = Else, }; // Static opcode objects. diff --git a/src/prebuilt/lexer-keywords.cc b/src/prebuilt/lexer-keywords.cc index d45c5cb40..8fa70e288 100644 --- a/src/prebuilt/lexer-keywords.cc +++ b/src/prebuilt/lexer-keywords.cc @@ -48,7 +48,7 @@ struct TokenInfo { Opcode opcode; }; }; -/* maximum key range = 2614, duplicates = 0 */ +/* maximum key range = 2532, duplicates = 0 */ class Perfect_Hash { @@ -63,32 +63,32 @@ Perfect_Hash::hash (const char *str, size_t len) { static unsigned short asso_values[] = { - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 17, 213, 2637, 254, - 10, 92, 9, 9, 65, 423, 96, 733, 9, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 9, 9, 39, 49, 102, - 68, 15, 9, 595, 668, 12, 14, 11, 28, 10, - 11, 94, 422, 114, 143, 9, 9, 11, 107, 31, - 294, 477, 273, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, 2637, - 2637, 2637, 2637, 2637, 2637, 2637, 2637 + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 12, 216, 2549, 20, + 7, 28, 6, 214, 124, 365, 259, 677, 19, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 7, 12, 111, 36, 111, + 9, 6, 6, 594, 573, 9, 13, 15, 71, 111, + 31, 8, 405, 495, 7, 9, 9, 25, 113, 126, + 314, 430, 60, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, 2549, + 2549, 2549, 2549, 2549, 2549, 2549, 2549 }; unsigned int hval = len; @@ -155,1476 +155,1462 @@ Perfect_Hash::InWordSet (const char *str, size_t len) TOTAL_KEYWORDS = 565, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 26, - MIN_HASH_VALUE = 23, - MAX_HASH_VALUE = 2636 + MIN_HASH_VALUE = 17, + MAX_HASH_VALUE = 2548 }; static struct TokenInfo wordlist[] = { {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, -#line 472 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 471 "src/lexer-keywords.txt" {"if", TokenType::If, Opcode::If}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 139 "src/lexer-keywords.txt" + {""}, +#line 42 "src/lexer-keywords.txt" + {"do", TokenType::Do}, + {""}, +#line 138 "src/lexer-keywords.txt" {"f64", Type::F64}, -#line 492 "src/lexer-keywords.txt" - {"mut", TokenType::Mut}, -#line 82 "src/lexer-keywords.txt" + {""}, +#line 81 "src/lexer-keywords.txt" {"f32", Type::F32}, -#line 421 "src/lexer-keywords.txt" +#line 420 "src/lexer-keywords.txt" {"i64", Type::I64}, - {""}, -#line 291 "src/lexer-keywords.txt" +#line 46 "src/lexer-keywords.txt" + {"else", TokenType::Else, Opcode::Else}, +#line 290 "src/lexer-keywords.txt" {"i32", Type::I32}, +#line 47 "src/lexer-keywords.txt" + {"end", TokenType::End, Opcode::End}, + {""}, {""}, {""}, {""}, +#line 164 "src/lexer-keywords.txt" + {"field", TokenType::Field}, + {""}, {""}, {""}, {""}, {""}, +#line 131 "src/lexer-keywords.txt" + {"f64.ne", TokenType::Compare, Opcode::F64Ne}, +#line 75 "src/lexer-keywords.txt" + {"f32.ne", TokenType::Compare, Opcode::F32Ne}, + {""}, +#line 396 "src/lexer-keywords.txt" + {"i64.ne", TokenType::Compare, Opcode::I64Ne}, +#line 267 "src/lexer-keywords.txt" + {"i32.ne", TokenType::Compare, Opcode::I32Ne}, + {""}, +#line 495 "src/lexer-keywords.txt" + {"offset", TokenType::Offset}, +#line 32 "src/lexer-keywords.txt" + {"br", TokenType::Br, Opcode::Br}, {""}, {""}, {""}, -#line 522 "src/lexer-keywords.txt" +#line 512 "src/lexer-keywords.txt" + {"struct", Type::Struct, TokenType::Struct}, +#line 521 "src/lexer-keywords.txt" {"then", TokenType::Then}, #line 48 "src/lexer-keywords.txt" - {"exn", Type::ExnRef, TokenType::Exn}, -#line 476 "src/lexer-keywords.txt" - {"item", TokenType::Item}, -#line 109 "src/lexer-keywords.txt" - {"f32x4", TokenType::F32X4}, -#line 45 "src/lexer-keywords.txt" - {"else", TokenType::Else, Opcode::Else}, -#line 44 "src/lexer-keywords.txt" - {"elem", TokenType::Elem}, -#line 323 "src/lexer-keywords.txt" - {"i32x4", TokenType::I32X4}, + {"event", TokenType::Event}, +#line 163 "src/lexer-keywords.txt" + {"f64x2", TokenType::F64X2}, + {""}, {""}, +#line 433 "src/lexer-keywords.txt" + {"i64x2", TokenType::I64X2}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 126 "src/lexer-keywords.txt" - {"f64.lt", TokenType::Compare, Opcode::F64Lt}, -#line 70 "src/lexer-keywords.txt" - {"f32.lt", TokenType::Compare, Opcode::F32Lt}, +#line 520 "src/lexer-keywords.txt" + {"table", TokenType::Table}, +#line 403 "src/lexer-keywords.txt" + {"i64.rotr", TokenType::Binary, Opcode::I64Rotr}, +#line 274 "src/lexer-keywords.txt" + {"i32.rotr", TokenType::Binary, Opcode::I32Rotr}, {""}, -#line 47 "src/lexer-keywords.txt" - {"event", TokenType::Event}, - {""}, {""}, {""}, -#line 49 "src/lexer-keywords.txt" - {"exnref", Type::ExnRef}, +#line 135 "src/lexer-keywords.txt" + {"f64.store", TokenType::Store, Opcode::F64Store}, +#line 78 "src/lexer-keywords.txt" + {"f32.store", TokenType::Store, Opcode::F32Store}, + {""}, +#line 410 "src/lexer-keywords.txt" + {"i64.store", TokenType::Store, Opcode::I64Store}, +#line 280 "src/lexer-keywords.txt" + {"i32.store", TokenType::Store, Opcode::I32Store}, +#line 165 "src/lexer-keywords.txt" + {"funcref", Type::FuncRef}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 408 "src/lexer-keywords.txt" + {"i64.store32", TokenType::Store, Opcode::I64Store32}, + {""}, {""}, +#line 110 "src/lexer-keywords.txt" + {"f64.add", TokenType::Binary, Opcode::F64Add}, +#line 53 "src/lexer-keywords.txt" + {"f32.add", TokenType::Binary, Opcode::F32Add}, {""}, +#line 330 "src/lexer-keywords.txt" + {"i64.add", TokenType::Binary, Opcode::I64Add}, +#line 215 "src/lexer-keywords.txt" + {"i32.add", TokenType::Binary, Opcode::I32Add}, + {""}, {""}, #line 50 "src/lexer-keywords.txt" + {"externref", Type::ExternRef}, + {""}, {""}, +#line 49 "src/lexer-keywords.txt" {"extern", Type::ExternRef, TokenType::Extern}, +#line 508 "src/lexer-keywords.txt" + {"return", TokenType::Return, Opcode::Return}, {""}, {""}, -#line 124 "src/lexer-keywords.txt" +#line 112 "src/lexer-keywords.txt" + {"f64.const", TokenType::Const, Opcode::F64Const}, +#line 55 "src/lexer-keywords.txt" + {"f32.const", TokenType::Const, Opcode::F32Const}, + {""}, +#line 369 "src/lexer-keywords.txt" + {"i64.const", TokenType::Const, Opcode::I64Const}, +#line 245 "src/lexer-keywords.txt" + {"i32.const", TokenType::Const, Opcode::I32Const}, + {""}, {""}, +#line 155 "src/lexer-keywords.txt" + {"f64x2.ne", TokenType::Compare, Opcode::F64X2Ne}, + {""}, +#line 518 "src/lexer-keywords.txt" + {"table.set", TokenType::TableSet, Opcode::TableSet}, + {""}, +#line 331 "src/lexer-keywords.txt" + {"i64.and", TokenType::Binary, Opcode::I64And}, +#line 216 "src/lexer-keywords.txt" + {"i32.and", TokenType::Binary, Opcode::I32And}, +#line 109 "src/lexer-keywords.txt" + {"f64.abs", TokenType::Unary, Opcode::F64Abs}, +#line 52 "src/lexer-keywords.txt" + {"f32.abs", TokenType::Unary, Opcode::F32Abs}, + {""}, {""}, +#line 509 "src/lexer-keywords.txt" + {"select", TokenType::Select, Opcode::Select}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 127 "src/lexer-keywords.txt" + {"f64.min", TokenType::Binary, Opcode::F64Min}, +#line 71 "src/lexer-keywords.txt" + {"f32.min", TokenType::Binary, Opcode::F32Min}, + {""}, {""}, +#line 136 "src/lexer-keywords.txt" + {"f64.sub", TokenType::Binary, Opcode::F64Sub}, +#line 79 "src/lexer-keywords.txt" + {"f32.sub", TokenType::Binary, Opcode::F32Sub}, +#line 45 "src/lexer-keywords.txt" + {"elem", TokenType::Elem}, +#line 411 "src/lexer-keywords.txt" + {"i64.sub", TokenType::Binary, Opcode::I64Sub}, +#line 281 "src/lexer-keywords.txt" + {"i32.sub", TokenType::Binary, Opcode::I32Sub}, +#line 475 "src/lexer-keywords.txt" + {"item", TokenType::Item}, +#line 517 "src/lexer-keywords.txt" + {"table.init", TokenType::TableInit, Opcode::TableInit}, +#line 491 "src/lexer-keywords.txt" + {"mut", TokenType::Mut}, +#line 39 "src/lexer-keywords.txt" + {"data", TokenType::Data}, + {""}, +#line 29 "src/lexer-keywords.txt" + {"block", TokenType::Block, Opcode::Block}, + {""}, {""}, {""}, {""}, {""}, +#line 123 "src/lexer-keywords.txt" {"f64.le", TokenType::Compare, Opcode::F64Le}, -#line 68 "src/lexer-keywords.txt" +#line 67 "src/lexer-keywords.txt" {"f32.le", TokenType::Compare, Opcode::F32Le}, +#line 148 "src/lexer-keywords.txt" + {"f64x2.le", TokenType::Compare, Opcode::F64X2Le}, {""}, {""}, {""}, +#line 125 "src/lexer-keywords.txt" + {"f64.lt", TokenType::Compare, Opcode::F64Lt}, +#line 69 "src/lexer-keywords.txt" + {"f32.lt", TokenType::Compare, Opcode::F32Lt}, +#line 149 "src/lexer-keywords.txt" + {"f64x2.lt", TokenType::Compare, Opcode::F64X2Lt}, +#line 510 "src/lexer-keywords.txt" + {"shared", TokenType::Shared}, +#line 504 "src/lexer-keywords.txt" + {"result", TokenType::Result}, #line 166 "src/lexer-keywords.txt" - {"funcref", Type::FuncRef}, -#line 128 "src/lexer-keywords.txt" - {"f64.min", TokenType::Binary, Opcode::F64Min}, -#line 72 "src/lexer-keywords.txt" - {"f32.min", TokenType::Binary, Opcode::F32Min}, + {"func", Type::FuncRef, TokenType::Func}, {""}, -#line 512 "src/lexer-keywords.txt" - {"start", TokenType::Start}, +#line 496 "src/lexer-keywords.txt" + {"output", TokenType::Output}, + {""}, {""}, +#line 519 "src/lexer-keywords.txt" + {"table.size", TokenType::TableSize, Opcode::TableSize}, {""}, -#line 394 "src/lexer-keywords.txt" - {"i64.lt_s", TokenType::Compare, Opcode::I64LtS}, -#line 265 "src/lexer-keywords.txt" - {"i32.lt_s", TokenType::Compare, Opcode::I32LtS}, +#line 511 "src/lexer-keywords.txt" + {"start", TokenType::Start}, +#line 370 "src/lexer-keywords.txt" + {"i64.ctz", TokenType::Unary, Opcode::I64Ctz}, +#line 246 "src/lexer-keywords.txt" + {"i32.ctz", TokenType::Unary, Opcode::I32Ctz}, +#line 145 "src/lexer-keywords.txt" + {"f64x2.floor", TokenType::Unary, Opcode::F64X2Floor}, {""}, {""}, -#line 395 "src/lexer-keywords.txt" - {"i64.lt_u", TokenType::Compare, Opcode::I64LtU}, -#line 266 "src/lexer-keywords.txt" - {"i32.lt_u", TokenType::Compare, Opcode::I32LtU}, -#line 385 "src/lexer-keywords.txt" +#line 384 "src/lexer-keywords.txt" {"i64.le_s", TokenType::Compare, Opcode::I64LeS}, -#line 258 "src/lexer-keywords.txt" +#line 257 "src/lexer-keywords.txt" {"i32.le_s", TokenType::Compare, Opcode::I32LeS}, - {""}, {""}, -#line 386 "src/lexer-keywords.txt" - {"i64.le_u", TokenType::Compare, Opcode::I64LeU}, -#line 259 "src/lexer-keywords.txt" - {"i32.le_u", TokenType::Compare, Opcode::I32LeU}, -#line 521 "src/lexer-keywords.txt" - {"table", TokenType::Table}, - {""}, {""}, {""}, -#line 401 "src/lexer-keywords.txt" +#line 161 "src/lexer-keywords.txt" + {"f64x2.sub", TokenType::Binary, Opcode::F64X2Sub}, +#line 393 "src/lexer-keywords.txt" + {"i64.lt_s", TokenType::Compare, Opcode::I64LtS}, +#line 264 "src/lexer-keywords.txt" + {"i32.lt_s", TokenType::Compare, Opcode::I32LtS}, +#line 432 "src/lexer-keywords.txt" + {"i64x2.sub", TokenType::Binary, Opcode::I64X2Sub}, + {""}, {""}, {""}, {""}, +#line 400 "src/lexer-keywords.txt" {"i64.rem_s", TokenType::Binary, Opcode::I64RemS}, -#line 272 "src/lexer-keywords.txt" +#line 271 "src/lexer-keywords.txt" {"i32.rem_s", TokenType::Binary, Opcode::I32RemS}, - {""}, -#line 101 "src/lexer-keywords.txt" - {"f32x4.ne", TokenType::Compare, Opcode::F32X4Ne}, -#line 402 "src/lexer-keywords.txt" - {"i64.rem_u", TokenType::Binary, Opcode::I64RemU}, -#line 273 "src/lexer-keywords.txt" - {"i32.rem_u", TokenType::Binary, Opcode::I32RemU}, -#line 316 "src/lexer-keywords.txt" - {"i32x4.ne", TokenType::Compare, Opcode::I32X4Ne}, -#line 97 "src/lexer-keywords.txt" - {"f32x4.min", TokenType::Binary, Opcode::F32X4Min}, -#line 95 "src/lexer-keywords.txt" - {"f32x4.lt", TokenType::Compare, Opcode::F32X4Lt}, - {""}, {""}, {""}, +#line 371 "src/lexer-keywords.txt" + {"i64.div_s", TokenType::Binary, Opcode::I64DivS}, +#line 247 "src/lexer-keywords.txt" + {"i32.div_s", TokenType::Binary, Opcode::I32DivS}, #line 129 "src/lexer-keywords.txt" - {"f64.mul", TokenType::Binary, Opcode::F64Mul}, + {"f64.nearest", TokenType::Unary, Opcode::F64Nearest}, #line 73 "src/lexer-keywords.txt" - {"f32.mul", TokenType::Binary, Opcode::F32Mul}, + {"f32.nearest", TokenType::Unary, Opcode::F32Nearest}, {""}, -#line 396 "src/lexer-keywords.txt" - {"i64.mul", TokenType::Binary, Opcode::I64Mul}, -#line 267 "src/lexer-keywords.txt" - {"i32.mul", TokenType::Binary, Opcode::I32Mul}, - {""}, {""}, -#line 312 "src/lexer-keywords.txt" - {"i32x4.min_s", TokenType::Binary, Opcode::I32X4MinS}, -#line 94 "src/lexer-keywords.txt" - {"f32x4.le", TokenType::Compare, Opcode::F32X4Le}, -#line 165 "src/lexer-keywords.txt" - {"field", TokenType::Field}, -#line 308 "src/lexer-keywords.txt" - {"i32x4.lt_s", TokenType::Compare, Opcode::I32X4LtS}, -#line 313 "src/lexer-keywords.txt" - {"i32x4.min_u", TokenType::Binary, Opcode::I32X4MinU}, -#line 309 "src/lexer-keywords.txt" - {"i32x4.lt_u", TokenType::Compare, Opcode::I32X4LtU}, - {""}, {""}, {""}, -#line 304 "src/lexer-keywords.txt" - {"i32x4.le_s", TokenType::Compare, Opcode::I32X4LeS}, -#line 39 "src/lexer-keywords.txt" - {"data", TokenType::Data}, -#line 305 "src/lexer-keywords.txt" - {"i32x4.le_u", TokenType::Compare, Opcode::I32X4LeU}, - {""}, {""}, -#line 491 "src/lexer-keywords.txt" - {"module", TokenType::Module}, -#line 164 "src/lexer-keywords.txt" - {"f64x2", TokenType::F64X2}, -#line 167 "src/lexer-keywords.txt" - {"func", Type::FuncRef, TokenType::Func}, - {""}, -#line 434 "src/lexer-keywords.txt" - {"i64x2", TokenType::I64X2}, -#line 510 "src/lexer-keywords.txt" - {"select", TokenType::Select, Opcode::Select}, - {""}, -#line 98 "src/lexer-keywords.txt" - {"f32x4.mul", TokenType::Binary, Opcode::F32X4Mul}, - {""}, {""}, -#line 314 "src/lexer-keywords.txt" - {"i32x4.mul", TokenType::Binary, Opcode::I32X4Mul}, -#line 519 "src/lexer-keywords.txt" - {"table.set", TokenType::TableSet, Opcode::TableSet}, -#line 496 "src/lexer-keywords.txt" - {"offset", TokenType::Offset}, - {""}, -#line 518 "src/lexer-keywords.txt" - {"table.init", TokenType::TableInit, Opcode::TableInit}, +#line 40 "src/lexer-keywords.txt" + {"declare", TokenType::Declare}, +#line 585 "src/lexer-keywords.txt" + {"unwind", TokenType::Unwind, Opcode::Unwind}, {""}, {""}, -#line 110 "src/lexer-keywords.txt" - {"f64.abs", TokenType::Unary, Opcode::F64Abs}, -#line 53 "src/lexer-keywords.txt" - {"f32.abs", TokenType::Unary, Opcode::F32Abs}, -#line 137 "src/lexer-keywords.txt" - {"f64.sub", TokenType::Binary, Opcode::F64Sub}, -#line 80 "src/lexer-keywords.txt" - {"f32.sub", TokenType::Binary, Opcode::F32Sub}, - {""}, -#line 412 "src/lexer-keywords.txt" - {"i64.sub", TokenType::Binary, Opcode::I64Sub}, -#line 282 "src/lexer-keywords.txt" - {"i32.sub", TokenType::Binary, Opcode::I32Sub}, -#line 132 "src/lexer-keywords.txt" - {"f64.ne", TokenType::Compare, Opcode::F64Ne}, -#line 76 "src/lexer-keywords.txt" - {"f32.ne", TokenType::Compare, Opcode::F32Ne}, - {""}, -#line 397 "src/lexer-keywords.txt" - {"i64.ne", TokenType::Compare, Opcode::I64Ne}, -#line 268 "src/lexer-keywords.txt" - {"i32.ne", TokenType::Compare, Opcode::I32Ne}, - {""}, -#line 46 "src/lexer-keywords.txt" - {"end", TokenType::End, Opcode::End}, - {""}, {""}, {""}, {""}, {""}, -#line 83 "src/lexer-keywords.txt" - {"f32x4.abs", TokenType::Unary, Opcode::F32X4Abs}, - {""}, -#line 35 "src/lexer-keywords.txt" - {"call", TokenType::Call, Opcode::Call}, -#line 293 "src/lexer-keywords.txt" - {"i32x4.abs", TokenType::Unary, Opcode::I32X4Abs}, -#line 41 "src/lexer-keywords.txt" - {"do", TokenType::Do}, -#line 99 "src/lexer-keywords.txt" - {"f32x4.nearest", TokenType::Unary, Opcode::F32X4Nearest}, - {""}, {""}, {""}, {""}, {""}, -#line 515 "src/lexer-keywords.txt" - {"table.fill", TokenType::TableFill, Opcode::TableFill}, -#line 107 "src/lexer-keywords.txt" - {"f32x4.sub", TokenType::Binary, Opcode::F32X4Sub}, -#line 480 "src/lexer-keywords.txt" - {"local", TokenType::Local}, - {""}, -#line 322 "src/lexer-keywords.txt" - {"i32x4.sub", TokenType::Binary, Opcode::I32X4Sub}, -#line 156 "src/lexer-keywords.txt" - {"f64x2.ne", TokenType::Compare, Opcode::F64X2Ne}, -#line 112 "src/lexer-keywords.txt" +#line 111 "src/lexer-keywords.txt" {"f64.ceil", TokenType::Unary, Opcode::F64Ceil}, -#line 55 "src/lexer-keywords.txt" +#line 54 "src/lexer-keywords.txt" {"f32.ceil", TokenType::Unary, Opcode::F32Ceil}, - {""}, -#line 152 "src/lexer-keywords.txt" - {"f64x2.min", TokenType::Binary, Opcode::F64X2Min}, -#line 150 "src/lexer-keywords.txt" - {"f64x2.lt", TokenType::Compare, Opcode::F64X2Lt}, - {""}, -#line 475 "src/lexer-keywords.txt" - {"invoke", TokenType::Invoke}, - {""}, {""}, -#line 505 "src/lexer-keywords.txt" - {"result", TokenType::Result}, -#line 29 "src/lexer-keywords.txt" - {"block", TokenType::Block, Opcode::Block}, - {""}, -#line 509 "src/lexer-keywords.txt" - {"return", TokenType::Return, Opcode::Return}, - {""}, + {""}, {""}, {""}, +#line 402 "src/lexer-keywords.txt" + {"i64.rotl", TokenType::Binary, Opcode::I64Rotl}, +#line 273 "src/lexer-keywords.txt" + {"i32.rotl", TokenType::Binary, Opcode::I32Rotl}, + {""}, {""}, {""}, {""}, +#line 385 "src/lexer-keywords.txt" + {"i64.le_u", TokenType::Compare, Opcode::I64LeU}, +#line 258 "src/lexer-keywords.txt" + {"i32.le_u", TokenType::Compare, Opcode::I32LeU}, +#line 140 "src/lexer-keywords.txt" + {"f64x2.add", TokenType::Binary, Opcode::F64X2Add}, +#line 394 "src/lexer-keywords.txt" + {"i64.lt_u", TokenType::Compare, Opcode::I64LtU}, +#line 265 "src/lexer-keywords.txt" + {"i32.lt_u", TokenType::Compare, Opcode::I32LtU}, +#line 421 "src/lexer-keywords.txt" + {"i64x2.add", TokenType::Binary, Opcode::I64X2Add}, + {""}, {""}, {""}, +#line 31 "src/lexer-keywords.txt" + {"br_table", TokenType::BrTable, Opcode::BrTable}, +#line 401 "src/lexer-keywords.txt" + {"i64.rem_u", TokenType::Binary, Opcode::I64RemU}, +#line 272 "src/lexer-keywords.txt" + {"i32.rem_u", TokenType::Binary, Opcode::I32RemU}, #line 372 "src/lexer-keywords.txt" - {"i64.div_s", TokenType::Binary, Opcode::I64DivS}, -#line 248 "src/lexer-keywords.txt" - {"i32.div_s", TokenType::Binary, Opcode::I32DivS}, -#line 149 "src/lexer-keywords.txt" - {"f64x2.le", TokenType::Compare, Opcode::F64X2Le}, -#line 33 "src/lexer-keywords.txt" - {"br", TokenType::Br, Opcode::Br}, -#line 373 "src/lexer-keywords.txt" {"i64.div_u", TokenType::Binary, Opcode::I64DivU}, -#line 249 "src/lexer-keywords.txt" +#line 248 "src/lexer-keywords.txt" {"i32.div_u", TokenType::Binary, Opcode::I32DivU}, -#line 403 "src/lexer-keywords.txt" - {"i64.rotl", TokenType::Binary, Opcode::I64Rotl}, -#line 274 "src/lexer-keywords.txt" - {"i32.rotl", TokenType::Binary, Opcode::I32Rotl}, -#line 511 "src/lexer-keywords.txt" - {"shared", TokenType::Shared}, +#line 474 "src/lexer-keywords.txt" + {"invoke", TokenType::Invoke}, + {""}, {""}, {""}, {""}, {""}, +#line 128 "src/lexer-keywords.txt" + {"f64.mul", TokenType::Binary, Opcode::F64Mul}, +#line 72 "src/lexer-keywords.txt" + {"f32.mul", TokenType::Binary, Opcode::F32Mul}, {""}, -#line 297 "src/lexer-keywords.txt" - {"i32x4.bitmask", TokenType::Unary, Opcode::I32X4Bitmask}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 478 "src/lexer-keywords.txt" - {"local.set", TokenType::LocalSet, Opcode::LocalSet}, - {""}, {""}, {""}, -#line 85 "src/lexer-keywords.txt" - {"f32x4.ceil", TokenType::Unary, Opcode::F32X4Ceil}, -#line 153 "src/lexer-keywords.txt" - {"f64x2.mul", TokenType::Binary, Opcode::F64X2Mul}, +#line 395 "src/lexer-keywords.txt" + {"i64.mul", TokenType::Binary, Opcode::I64Mul}, +#line 266 "src/lexer-keywords.txt" + {"i32.mul", TokenType::Binary, Opcode::I32Mul}, +#line 368 "src/lexer-keywords.txt" + {"i64.clz", TokenType::Unary, Opcode::I64Clz}, +#line 244 "src/lexer-keywords.txt" + {"i32.clz", TokenType::Unary, Opcode::I32Clz}, {""}, {""}, -#line 426 "src/lexer-keywords.txt" - {"i64x2.mul", TokenType::Binary, Opcode::I64X2Mul}, -#line 535 "src/lexer-keywords.txt" - {"v128", Type::V128}, +#line 139 "src/lexer-keywords.txt" + {"f64x2.abs", TokenType::Unary, Opcode::F64X2Abs}, + {""}, {""}, {""}, +#line 514 "src/lexer-keywords.txt" + {"table.fill", TokenType::TableFill, Opcode::TableFill}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 108 "src/lexer-keywords.txt" + {"f32x4", TokenType::F32X4}, {""}, {""}, -#line 479 "src/lexer-keywords.txt" - {"local.tee", TokenType::LocalTee, Opcode::LocalTee}, - {""}, -#line 32 "src/lexer-keywords.txt" - {"br_table", TokenType::BrTable, Opcode::BrTable}, - {""}, -#line 332 "src/lexer-keywords.txt" - {"i64.and", TokenType::Binary, Opcode::I64And}, -#line 217 "src/lexer-keywords.txt" - {"i32.and", TokenType::Binary, Opcode::I32And}, +#line 322 "src/lexer-keywords.txt" + {"i32x4", TokenType::I32X4}, {""}, -#line 113 "src/lexer-keywords.txt" - {"f64.const", TokenType::Const, Opcode::F64Const}, -#line 56 "src/lexer-keywords.txt" - {"f32.const", TokenType::Const, Opcode::F32Const}, -#line 51 "src/lexer-keywords.txt" - {"externref", Type::ExternRef}, -#line 370 "src/lexer-keywords.txt" - {"i64.const", TokenType::Const, Opcode::I64Const}, -#line 246 "src/lexer-keywords.txt" - {"i32.const", TokenType::Const, Opcode::I32Const}, +#line 151 "src/lexer-keywords.txt" + {"f64x2.min", TokenType::Binary, Opcode::F64X2Min}, {""}, {""}, -#line 497 "src/lexer-keywords.txt" - {"output", TokenType::Output}, +#line 153 "src/lexer-keywords.txt" + {"f64x2.nearest", TokenType::Unary, Opcode::F64X2Nearest}, {""}, {""}, -#line 499 "src/lexer-keywords.txt" - {"quote", TokenType::Quote}, +#line 490 "src/lexer-keywords.txt" + {"module", TokenType::Module}, {""}, -#line 26 "src/lexer-keywords.txt" - {"assert_unlinkable", TokenType::AssertUnlinkable}, +#line 501 "src/lexer-keywords.txt" + {"ref.is_null", TokenType::RefIsNull, Opcode::RefIsNull}, {""}, {""}, -#line 140 "src/lexer-keywords.txt" - {"f64x2.abs", TokenType::Unary, Opcode::F64X2Abs}, +#line 367 "src/lexer-keywords.txt" + {"i64.atomic.store", TokenType::AtomicStore, Opcode::I64AtomicStore}, +#line 243 "src/lexer-keywords.txt" + {"i32.atomic.store", TokenType::AtomicStore, Opcode::I32AtomicStore}, {""}, -#line 513 "src/lexer-keywords.txt" - {"struct", Type::Struct, TokenType::Struct}, - {""}, {""}, -#line 154 "src/lexer-keywords.txt" - {"f64x2.nearest", TokenType::Unary, Opcode::F64X2Nearest}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 162 "src/lexer-keywords.txt" - {"f64x2.sub", TokenType::Binary, Opcode::F64X2Sub}, - {""}, {""}, -#line 433 "src/lexer-keywords.txt" - {"i64x2.sub", TokenType::Binary, Opcode::I64X2Sub}, - {""}, {""}, {""}, -#line 120 "src/lexer-keywords.txt" - {"f64.eq", TokenType::Compare, Opcode::F64Eq}, -#line 64 "src/lexer-keywords.txt" - {"f32.eq", TokenType::Compare, Opcode::F32Eq}, +#line 34 "src/lexer-keywords.txt" + {"call", TokenType::Call, Opcode::Call}, {""}, -#line 374 "src/lexer-keywords.txt" - {"i64.eq", TokenType::Compare, Opcode::I64Eq}, -#line 250 "src/lexer-keywords.txt" - {"i32.eq", TokenType::Compare, Opcode::I32Eq}, -#line 119 "src/lexer-keywords.txt" +#line 141 "src/lexer-keywords.txt" + {"f64x2.ceil", TokenType::Unary, Opcode::F64X2Ceil}, +#line 118 "src/lexer-keywords.txt" {"f64.div", TokenType::Binary, Opcode::F64Div}, -#line 63 "src/lexer-keywords.txt" +#line 62 "src/lexer-keywords.txt" {"f32.div", TokenType::Binary, Opcode::F32Div}, - {""}, {""}, {""}, {""}, {""}, -#line 502 "src/lexer-keywords.txt" - {"ref.is_null", TokenType::RefIsNull, Opcode::RefIsNull}, {""}, {""}, {""}, -#line 62 "src/lexer-keywords.txt" - {"f32.demote_f64", TokenType::Convert, Opcode::F32DemoteF64}, -#line 111 "src/lexer-keywords.txt" - {"f64.add", TokenType::Binary, Opcode::F64Add}, -#line 54 "src/lexer-keywords.txt" - {"f32.add", TokenType::Binary, Opcode::F32Add}, - {""}, -#line 331 "src/lexer-keywords.txt" - {"i64.add", TokenType::Binary, Opcode::I64Add}, -#line 216 "src/lexer-keywords.txt" - {"i32.add", TokenType::Binary, Opcode::I32Add}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, -#line 142 "src/lexer-keywords.txt" - {"f64x2.ceil", TokenType::Unary, Opcode::F64X2Ceil}, - {""}, -#line 89 "src/lexer-keywords.txt" - {"f32x4.eq", TokenType::Compare, Opcode::F32X4Eq}, -#line 84 "src/lexer-keywords.txt" - {"f32x4.add", TokenType::Binary, Opcode::F32X4Add}, +#line 24 "src/lexer-keywords.txt" + {"assert_return", TokenType::AssertReturn}, {""}, -#line 298 "src/lexer-keywords.txt" - {"i32x4.eq", TokenType::Compare, Opcode::I32X4Eq}, -#line 294 "src/lexer-keywords.txt" - {"i32x4.add", TokenType::Binary, Opcode::I32X4Add}, - {""}, {""}, {""}, {""}, -#line 125 "src/lexer-keywords.txt" +#line 502 "src/lexer-keywords.txt" + {"ref.null", TokenType::RefNull, Opcode::RefNull}, +#line 124 "src/lexer-keywords.txt" {"f64.load", TokenType::Load, Opcode::F64Load}, -#line 69 "src/lexer-keywords.txt" +#line 68 "src/lexer-keywords.txt" {"f32.load", TokenType::Load, Opcode::F32Load}, - {""}, -#line 393 "src/lexer-keywords.txt" +#line 365 "src/lexer-keywords.txt" + {"i64.atomic.store32", TokenType::AtomicStore, Opcode::I64AtomicStore32}, +#line 392 "src/lexer-keywords.txt" {"i64.load", TokenType::Load, Opcode::I64Load}, -#line 264 "src/lexer-keywords.txt" +#line 263 "src/lexer-keywords.txt" {"i32.load", TokenType::Load, Opcode::I32Load}, -#line 135 "src/lexer-keywords.txt" - {"f64.sqrt", TokenType::Unary, Opcode::F64Sqrt}, -#line 78 "src/lexer-keywords.txt" - {"f32.sqrt", TokenType::Unary, Opcode::F32Sqrt}, -#line 136 "src/lexer-keywords.txt" - {"f64.store", TokenType::Store, Opcode::F64Store}, -#line 79 "src/lexer-keywords.txt" - {"f32.store", TokenType::Store, Opcode::F32Store}, {""}, -#line 411 "src/lexer-keywords.txt" - {"i64.store", TokenType::Store, Opcode::I64Store}, -#line 281 "src/lexer-keywords.txt" - {"i32.store", TokenType::Store, Opcode::I32Store}, +#line 113 "src/lexer-keywords.txt" + {"f64.convert_i32_s", TokenType::Convert, Opcode::F64ConvertI32S}, +#line 56 "src/lexer-keywords.txt" + {"f32.convert_i32_s", TokenType::Convert, Opcode::F32ConvertI32S}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 546 "src/lexer-keywords.txt" - {"i64.atomic.wait", TokenType::AtomicWait, Opcode::MemoryAtomicWait64}, -#line 545 "src/lexer-keywords.txt" - {"i32.atomic.wait", TokenType::AtomicWait, Opcode::MemoryAtomicWait32}, +#line 412 "src/lexer-keywords.txt" + {"i64.trunc_f32_s", TokenType::Convert, Opcode::I64TruncF32S}, +#line 282 "src/lexer-keywords.txt" + {"i32.trunc_f32_s", TokenType::Convert, Opcode::I32TruncF32S}, {""}, {""}, -#line 409 "src/lexer-keywords.txt" - {"i64.store32", TokenType::Store, Opcode::I64Store32}, +#line 100 "src/lexer-keywords.txt" + {"f32x4.ne", TokenType::Compare, Opcode::F32X4Ne}, {""}, -#line 506 "src/lexer-keywords.txt" +#line 505 "src/lexer-keywords.txt" {"rethrow", TokenType::Rethrow, Opcode::Rethrow}, - {""}, {""}, -#line 22 "src/lexer-keywords.txt" - {"assert_invalid", TokenType::AssertInvalid}, -#line 584 "src/lexer-keywords.txt" - {"set_local", TokenType::LocalSet, Opcode::LocalSet}, +#line 315 "src/lexer-keywords.txt" + {"i32x4.ne", TokenType::Compare, Opcode::I32X4Ne}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 413 "src/lexer-keywords.txt" + {"i64.trunc_f32_u", TokenType::Convert, Opcode::I64TruncF32U}, +#line 283 "src/lexer-keywords.txt" + {"i32.trunc_f32_u", TokenType::Convert, Opcode::I32TruncF32U}, {""}, -#line 106 "src/lexer-keywords.txt" - {"f32x4.sqrt", TokenType::Unary, Opcode::F32X4Sqrt}, - {""}, {""}, {""}, -#line 585 "src/lexer-keywords.txt" - {"tee_local", TokenType::LocalTee, Opcode::LocalTee}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, -#line 88 "src/lexer-keywords.txt" - {"f32x4.div", TokenType::Binary, Opcode::F32X4Div}, -#line 503 "src/lexer-keywords.txt" - {"ref.null", TokenType::RefNull, Opcode::RefNull}, -#line 295 "src/lexer-keywords.txt" - {"i32x4.all_true", TokenType::Unary, Opcode::I32X4AllTrue}, - {""}, {""}, -#line 130 "src/lexer-keywords.txt" - {"f64.nearest", TokenType::Unary, Opcode::F64Nearest}, -#line 74 "src/lexer-keywords.txt" - {"f32.nearest", TokenType::Unary, Opcode::F32Nearest}, - {""}, {""}, -#line 391 "src/lexer-keywords.txt" - {"i64.load8_s", TokenType::Load, Opcode::I64Load8S}, -#line 262 "src/lexer-keywords.txt" - {"i32.load8_s", TokenType::Load, Opcode::I32Load8S}, - {""}, {""}, -#line 392 "src/lexer-keywords.txt" - {"i64.load8_u", TokenType::Load, Opcode::I64Load8U}, -#line 263 "src/lexer-keywords.txt" - {"i32.load8_u", TokenType::Load, Opcode::I32Load8U}, -#line 389 "src/lexer-keywords.txt" - {"i64.load32_s", TokenType::Load, Opcode::I64Load32S}, - {""}, {""}, {""}, -#line 390 "src/lexer-keywords.txt" - {"i64.load32_u", TokenType::Load, Opcode::I64Load32U}, - {""}, {""}, -#line 368 "src/lexer-keywords.txt" - {"i64.atomic.store", TokenType::AtomicStore, Opcode::I64AtomicStore}, -#line 244 "src/lexer-keywords.txt" - {"i32.atomic.store", TokenType::AtomicStore, Opcode::I32AtomicStore}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 144 "src/lexer-keywords.txt" - {"f64x2.eq", TokenType::Compare, Opcode::F64X2Eq}, -#line 141 "src/lexer-keywords.txt" - {"f64x2.add", TokenType::Binary, Opcode::F64X2Add}, +#line 142 "src/lexer-keywords.txt" + {"f64x2.div", TokenType::Binary, Opcode::F64X2Div}, + {""}, {""}, {""}, {""}, {""}, +#line 386 "src/lexer-keywords.txt" + {"i64.load16_s", TokenType::Load, Opcode::I64Load16S}, +#line 259 "src/lexer-keywords.txt" + {"i32.load16_s", TokenType::Load, Opcode::I32Load16S}, +#line 407 "src/lexer-keywords.txt" + {"i64.store16", TokenType::Store, Opcode::I64Store16}, +#line 278 "src/lexer-keywords.txt" + {"i32.store16", TokenType::Store, Opcode::I32Store16}, + {""}, +#line 61 "src/lexer-keywords.txt" + {"f32.demote_f64", TokenType::Convert, Opcode::F32DemoteF64}, {""}, {""}, -#line 422 "src/lexer-keywords.txt" - {"i64x2.add", TokenType::Binary, Opcode::I64X2Add}, +#line 388 "src/lexer-keywords.txt" + {"i64.load32_s", TokenType::Load, Opcode::I64Load32S}, {""}, {""}, {""}, -#line 366 "src/lexer-keywords.txt" - {"i64.atomic.store32", TokenType::AtomicStore, Opcode::I64AtomicStore32}, - {""}, {""}, -#line 508 "src/lexer-keywords.txt" - {"return_call", TokenType::ReturnCall, Opcode::ReturnCall}, -#line 34 "src/lexer-keywords.txt" - {"call_indirect", TokenType::CallIndirect, Opcode::CallIndirect}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 410 "src/lexer-keywords.txt" +#line 409 "src/lexer-keywords.txt" {"i64.store8", TokenType::Store, Opcode::I64Store8}, -#line 280 "src/lexer-keywords.txt" +#line 279 "src/lexer-keywords.txt" {"i32.store8", TokenType::Store, Opcode::I32Store8}, -#line 40 "src/lexer-keywords.txt" - {"declare", TokenType::Declare}, - {""}, {""}, {""}, -#line 520 "src/lexer-keywords.txt" - {"table.size", TokenType::TableSize, Opcode::TableSize}, + {""}, +#line 162 "src/lexer-keywords.txt" + {"f64x2.trunc", TokenType::Unary, Opcode::F64X2Trunc}, {""}, {""}, {""}, -#line 138 "src/lexer-keywords.txt" +#line 93 "src/lexer-keywords.txt" + {"f32x4.le", TokenType::Compare, Opcode::F32X4Le}, +#line 137 "src/lexer-keywords.txt" {"f64.trunc", TokenType::Unary, Opcode::F64Trunc}, -#line 81 "src/lexer-keywords.txt" +#line 80 "src/lexer-keywords.txt" {"f32.trunc", TokenType::Unary, Opcode::F32Trunc}, {""}, {""}, {""}, -#line 161 "src/lexer-keywords.txt" - {"f64x2.sqrt", TokenType::Unary, Opcode::F64X2Sqrt}, +#line 94 "src/lexer-keywords.txt" + {"f32x4.lt", TokenType::Compare, Opcode::F32X4Lt}, {""}, {""}, -#line 415 "src/lexer-keywords.txt" - {"i64.trunc_f64_s", TokenType::Convert, Opcode::I64TruncF64S}, -#line 285 "src/lexer-keywords.txt" - {"i32.trunc_f64_s", TokenType::Convert, Opcode::I32TruncF64S}, -#line 416 "src/lexer-keywords.txt" - {"i64.trunc_f64_u", TokenType::Convert, Opcode::I64TruncF64U}, -#line 286 "src/lexer-keywords.txt" - {"i32.trunc_f64_u", TokenType::Convert, Opcode::I32TruncF64U}, - {""}, -#line 310 "src/lexer-keywords.txt" - {"i32x4.max_s", TokenType::Binary, Opcode::I32X4MaxS}, +#line 152 "src/lexer-keywords.txt" + {"f64x2.mul", TokenType::Binary, Opcode::F64X2Mul}, {""}, -#line 24 "src/lexer-keywords.txt" - {"assert_return", TokenType::AssertReturn}, -#line 108 "src/lexer-keywords.txt" - {"f32x4.trunc", TokenType::Unary, Opcode::F32X4Trunc}, -#line 311 "src/lexer-keywords.txt" - {"i32x4.max_u", TokenType::Binary, Opcode::I32X4MaxU}, - {""}, {""}, -#line 404 "src/lexer-keywords.txt" - {"i64.rotr", TokenType::Binary, Opcode::I64Rotr}, -#line 275 "src/lexer-keywords.txt" - {"i32.rotr", TokenType::Binary, Opcode::I32Rotr}, +#line 478 "src/lexer-keywords.txt" + {"local.tee", TokenType::LocalTee, Opcode::LocalTee}, +#line 425 "src/lexer-keywords.txt" + {"i64x2.mul", TokenType::Binary, Opcode::I64X2Mul}, +#line 387 "src/lexer-keywords.txt" + {"i64.load16_u", TokenType::Load, Opcode::I64Load16U}, +#line 260 "src/lexer-keywords.txt" + {"i32.load16_u", TokenType::Load, Opcode::I32Load16U}, +#line 303 "src/lexer-keywords.txt" + {"i32x4.le_s", TokenType::Compare, Opcode::I32X4LeS}, {""}, -#line 143 "src/lexer-keywords.txt" - {"f64x2.div", TokenType::Binary, Opcode::F64X2Div}, +#line 477 "src/lexer-keywords.txt" + {"local.set", TokenType::LocalSet, Opcode::LocalSet}, +#line 307 "src/lexer-keywords.txt" + {"i32x4.lt_s", TokenType::Compare, Opcode::I32X4LtS}, +#line 90 "src/lexer-keywords.txt" + {"f32x4.floor", TokenType::Unary, Opcode::F32X4Floor}, {""}, -#line 408 "src/lexer-keywords.txt" - {"i64.store16", TokenType::Store, Opcode::I64Store16}, -#line 279 "src/lexer-keywords.txt" - {"i32.store16", TokenType::Store, Opcode::I32Store16}, -#line 27 "src/lexer-keywords.txt" - {"atomic.fence", TokenType::AtomicFence, Opcode::AtomicFence}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 413 "src/lexer-keywords.txt" - {"i64.trunc_f32_s", TokenType::Convert, Opcode::I64TruncF32S}, -#line 283 "src/lexer-keywords.txt" - {"i32.trunc_f32_s", TokenType::Convert, Opcode::I32TruncF32S}, -#line 414 "src/lexer-keywords.txt" - {"i64.trunc_f32_u", TokenType::Convert, Opcode::I64TruncF32U}, -#line 284 "src/lexer-keywords.txt" - {"i32.trunc_f32_u", TokenType::Convert, Opcode::I32TruncF32U}, +#line 389 "src/lexer-keywords.txt" + {"i64.load32_u", TokenType::Load, Opcode::I64Load32U}, + {""}, {""}, +#line 106 "src/lexer-keywords.txt" + {"f32x4.sub", TokenType::Binary, Opcode::F32X4Sub}, + {""}, {""}, +#line 321 "src/lexer-keywords.txt" + {"i32x4.sub", TokenType::Binary, Opcode::I32X4Sub}, {""}, {""}, {""}, -#line 525 "src/lexer-keywords.txt" - {"type", TokenType::Type}, - {""}, -#line 116 "src/lexer-keywords.txt" +#line 304 "src/lexer-keywords.txt" + {"i32x4.le_u", TokenType::Compare, Opcode::I32X4LeU}, + {""}, {""}, +#line 308 "src/lexer-keywords.txt" + {"i32x4.lt_u", TokenType::Compare, Opcode::I32X4LtU}, +#line 532 "src/lexer-keywords.txt" + {"v128.or", TokenType::Binary, Opcode::V128Or}, + {""}, {""}, {""}, +#line 479 "src/lexer-keywords.txt" + {"local", TokenType::Local}, +#line 115 "src/lexer-keywords.txt" {"f64.convert_i64_s", TokenType::Convert, Opcode::F64ConvertI64S}, -#line 59 "src/lexer-keywords.txt" +#line 58 "src/lexer-keywords.txt" {"f32.convert_i64_s", TokenType::Convert, Opcode::F32ConvertI64S}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 414 "src/lexer-keywords.txt" + {"i64.trunc_f64_s", TokenType::Convert, Opcode::I64TruncF64S}, +#line 284 "src/lexer-keywords.txt" + {"i32.trunc_f64_s", TokenType::Convert, Opcode::I32TruncF64S}, +#line 534 "src/lexer-keywords.txt" + {"v128", Type::V128}, {""}, -#line 494 "src/lexer-keywords.txt" - {"nan:canonical", TokenType::NanCanonical}, -#line 336 "src/lexer-keywords.txt" +#line 533 "src/lexer-keywords.txt" + {"v128.store", TokenType::Store, Opcode::V128Store}, +#line 83 "src/lexer-keywords.txt" + {"f32x4.add", TokenType::Binary, Opcode::F32X4Add}, + {""}, {""}, +#line 293 "src/lexer-keywords.txt" + {"i32x4.add", TokenType::Binary, Opcode::I32X4Add}, + {""}, {""}, {""}, {""}, +#line 114 "src/lexer-keywords.txt" + {"f64.convert_i32_u", TokenType::Convert, Opcode::F64ConvertI32U}, +#line 57 "src/lexer-keywords.txt" + {"f32.convert_i32_u", TokenType::Convert, Opcode::F32ConvertI32U}, +#line 499 "src/lexer-keywords.txt" + {"ref.extern", TokenType::RefExtern}, +#line 415 "src/lexer-keywords.txt" + {"i64.trunc_f64_u", TokenType::Convert, Opcode::I64TruncF64U}, +#line 285 "src/lexer-keywords.txt" + {"i32.trunc_f64_u", TokenType::Convert, Opcode::I32TruncF64U}, + {""}, +#line 33 "src/lexer-keywords.txt" + {"call_indirect", TokenType::CallIndirect, Opcode::CallIndirect}, +#line 531 "src/lexer-keywords.txt" + {"v128.not", TokenType::Unary, Opcode::V128Not}, +#line 27 "src/lexer-keywords.txt" + {"atomic.fence", TokenType::AtomicFence, Opcode::AtomicFence}, + {""}, {""}, {""}, {""}, {""}, +#line 22 "src/lexer-keywords.txt" + {"assert_invalid", TokenType::AssertInvalid}, + {""}, {""}, {""}, {""}, +#line 82 "src/lexer-keywords.txt" + {"f32x4.abs", TokenType::Unary, Opcode::F32X4Abs}, +#line 335 "src/lexer-keywords.txt" {"i64.atomic.load", TokenType::AtomicLoad, Opcode::I64AtomicLoad}, -#line 220 "src/lexer-keywords.txt" +#line 219 "src/lexer-keywords.txt" {"i32.atomic.load", TokenType::AtomicLoad, Opcode::I32AtomicLoad}, +#line 292 "src/lexer-keywords.txt" + {"i32x4.abs", TokenType::Unary, Opcode::I32X4Abs}, + {""}, {""}, {""}, {""}, {""}, +#line 311 "src/lexer-keywords.txt" + {"i32x4.min_s", TokenType::Binary, Opcode::I32X4MinS}, {""}, -#line 474 "src/lexer-keywords.txt" - {"input", TokenType::Input}, +#line 524 "src/lexer-keywords.txt" + {"type", TokenType::Type}, {""}, -#line 532 "src/lexer-keywords.txt" - {"v128.not", TokenType::Unary, Opcode::V128Not}, - {""}, {""}, {""}, {""}, {""}, -#line 473 "src/lexer-keywords.txt" - {"import", TokenType::Import}, - {""}, {""}, -#line 52 "src/lexer-keywords.txt" - {"export", TokenType::Export}, +#line 43 "src/lexer-keywords.txt" + {"drop", TokenType::Drop, Opcode::Drop}, + {""}, {""}, {""}, +#line 96 "src/lexer-keywords.txt" + {"f32x4.min", TokenType::Binary, Opcode::F32X4Min}, {""}, {""}, -#line 91 "src/lexer-keywords.txt" - {"f32x4.floor", TokenType::Unary, Opcode::F32X4Floor}, - {""}, {""}, {""}, {""}, {""}, -#line 114 "src/lexer-keywords.txt" - {"f64.convert_i32_s", TokenType::Convert, Opcode::F64ConvertI32S}, -#line 57 "src/lexer-keywords.txt" - {"f32.convert_i32_s", TokenType::Convert, Opcode::F32ConvertI32S}, -#line 552 "src/lexer-keywords.txt" - {"f32.demote/f64", TokenType::Convert, Opcode::F32DemoteF64}, -#line 523 "src/lexer-keywords.txt" - {"throw", TokenType::Throw, Opcode::Throw}, +#line 98 "src/lexer-keywords.txt" + {"f32x4.nearest", TokenType::Unary, Opcode::F32X4Nearest}, + {""}, {""}, {""}, {""}, +#line 507 "src/lexer-keywords.txt" + {"return_call", TokenType::ReturnCall, Opcode::ReturnCall}, + {""}, +#line 397 "src/lexer-keywords.txt" + {"i64.or", TokenType::Binary, Opcode::I64Or}, +#line 268 "src/lexer-keywords.txt" + {"i32.or", TokenType::Binary, Opcode::I32Or}, {""}, {""}, -#line 419 "src/lexer-keywords.txt" - {"i64.trunc_sat_f64_s", TokenType::Convert, Opcode::I64TruncSatF64S}, -#line 289 "src/lexer-keywords.txt" - {"i32.trunc_sat_f64_s", TokenType::Convert, Opcode::I32TruncSatF64S}, +#line 51 "src/lexer-keywords.txt" + {"export", TokenType::Export}, {""}, -#line 527 "src/lexer-keywords.txt" - {"v128.andnot", TokenType::Binary, Opcode::V128Andnot}, -#line 420 "src/lexer-keywords.txt" - {"i64.trunc_sat_f64_u", TokenType::Convert, Opcode::I64TruncSatF64U}, -#line 290 "src/lexer-keywords.txt" - {"i32.trunc_sat_f64_u", TokenType::Convert, Opcode::I32TruncSatF64U}, - {""}, {""}, {""}, {""}, -#line 378 "src/lexer-keywords.txt" - {"i64.extend8_s", TokenType::Unary, Opcode::I64Extend8S}, -#line 253 "src/lexer-keywords.txt" - {"i32.extend8_s", TokenType::Unary, Opcode::I32Extend8S}, -#line 365 "src/lexer-keywords.txt" - {"i64.atomic.store16", TokenType::AtomicStore, Opcode::I64AtomicStore16}, -#line 242 "src/lexer-keywords.txt" - {"i32.atomic.store16", TokenType::AtomicStore, Opcode::I32AtomicStore16}, +#line 84 "src/lexer-keywords.txt" + {"f32x4.ceil", TokenType::Unary, Opcode::F32X4Ceil}, +#line 472 "src/lexer-keywords.txt" + {"import", TokenType::Import}, {""}, {""}, -#line 31 "src/lexer-keywords.txt" - {"br_on_exn", TokenType::BrOnExn, Opcode::BrOnExn}, -#line 377 "src/lexer-keywords.txt" +#line 416 "src/lexer-keywords.txt" + {"i64.trunc_sat_f32_s", TokenType::Convert, Opcode::I64TruncSatF32S}, +#line 286 "src/lexer-keywords.txt" + {"i32.trunc_sat_f32_s", TokenType::Convert, Opcode::I32TruncSatF32S}, + {""}, +#line 473 "src/lexer-keywords.txt" + {"input", TokenType::Input}, +#line 312 "src/lexer-keywords.txt" + {"i32x4.min_u", TokenType::Binary, Opcode::I32X4MinU}, +#line 376 "src/lexer-keywords.txt" {"i64.extend32_s", TokenType::Unary, Opcode::I64Extend32S}, - {""}, {""}, -#line 163 "src/lexer-keywords.txt" - {"f64x2.trunc", TokenType::Unary, Opcode::F64X2Trunc}, + {""}, {""}, {""}, +#line 296 "src/lexer-keywords.txt" + {"i32x4.bitmask", TokenType::Unary, Opcode::I32X4Bitmask}, + {""}, +#line 522 "src/lexer-keywords.txt" + {"throw", TokenType::Throw, Opcode::Throw}, {""}, {""}, {""}, {""}, -#line 103 "src/lexer-keywords.txt" - {"f32x4.pmin", TokenType::Binary, Opcode::F32X4PMin}, - {""}, {""}, {""}, -#line 355 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8SubU}, -#line 232 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8SubU}, -#line 379 "src/lexer-keywords.txt" +#line 378 "src/lexer-keywords.txt" {"i64.extend_i32_s", TokenType::Convert, Opcode::I64ExtendI32S}, +#line 26 "src/lexer-keywords.txt" + {"assert_unlinkable", TokenType::AssertUnlinkable}, {""}, -#line 335 "src/lexer-keywords.txt" - {"i64.atomic.load8_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad8U}, -#line 219 "src/lexer-keywords.txt" - {"i32.atomic.load8_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad8U}, -#line 380 "src/lexer-keywords.txt" - {"i64.extend_i32_u", TokenType::Convert, Opcode::I64ExtendI32U}, - {""}, {""}, {""}, -#line 528 "src/lexer-keywords.txt" - {"v128.and", TokenType::Binary, Opcode::V128And}, -#line 387 "src/lexer-keywords.txt" - {"i64.load16_s", TokenType::Load, Opcode::I64Load16S}, -#line 260 "src/lexer-keywords.txt" - {"i32.load16_s", TokenType::Load, Opcode::I32Load16S}, +#line 36 "src/lexer-keywords.txt" + {"catch_all", TokenType::CatchAll, Opcode::CatchAll}, +#line 545 "src/lexer-keywords.txt" + {"i64.atomic.wait", TokenType::AtomicWait, Opcode::MemoryAtomicWait64}, +#line 544 "src/lexer-keywords.txt" + {"i32.atomic.wait", TokenType::AtomicWait, Opcode::MemoryAtomicWait32}, {""}, {""}, -#line 388 "src/lexer-keywords.txt" - {"i64.load16_u", TokenType::Load, Opcode::I64Load16U}, -#line 261 "src/lexer-keywords.txt" - {"i32.load16_u", TokenType::Load, Opcode::I32Load16U}, +#line 434 "src/lexer-keywords.txt" + {"i64.xor", TokenType::Binary, Opcode::I64Xor}, +#line 329 "src/lexer-keywords.txt" + {"i32.xor", TokenType::Binary, Opcode::I32Xor}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 417 "src/lexer-keywords.txt" + {"i64.trunc_sat_f32_u", TokenType::Convert, Opcode::I64TruncSatF32U}, +#line 287 "src/lexer-keywords.txt" + {"i32.trunc_sat_f32_u", TokenType::Convert, Opcode::I32TruncSatF32U}, {""}, -#line 23 "src/lexer-keywords.txt" - {"assert_malformed", TokenType::AssertMalformed}, -#line 105 "src/lexer-keywords.txt" - {"f32x4.splat", TokenType::Unary, Opcode::F32X4Splat}, - {""}, {""}, -#line 321 "src/lexer-keywords.txt" - {"i32x4.splat", TokenType::Unary, Opcode::I32X4Splat}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, -#line 481 "src/lexer-keywords.txt" +#line 360 "src/lexer-keywords.txt" + {"i64.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I64AtomicRmwOr}, +#line 237 "src/lexer-keywords.txt" + {"i32.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I32AtomicRmwOr}, + {""}, +#line 480 "src/lexer-keywords.txt" {"loop", TokenType::Loop, Opcode::Loop}, -#line 507 "src/lexer-keywords.txt" - {"return_call_indirect", TokenType::ReturnCallIndirect, Opcode::ReturnCallIndirect}, - {""}, {""}, -#line 117 "src/lexer-keywords.txt" + {""}, +#line 116 "src/lexer-keywords.txt" {"f64.convert_i64_u", TokenType::Convert, Opcode::F64ConvertI64U}, -#line 60 "src/lexer-keywords.txt" +#line 59 "src/lexer-keywords.txt" {"f32.convert_i64_u", TokenType::Convert, Opcode::F32ConvertI64U}, +#line 87 "src/lexer-keywords.txt" + {"f32x4.div", TokenType::Binary, Opcode::F32X4Div}, + {""}, {""}, +#line 574 "src/lexer-keywords.txt" + {"i64.trunc_s/f32", TokenType::Convert, Opcode::I64TruncF32S}, +#line 562 "src/lexer-keywords.txt" + {"i32.trunc_s/f32", TokenType::Convert, Opcode::I32TruncF32S}, {""}, -#line 146 "src/lexer-keywords.txt" - {"f64x2.floor", TokenType::Unary, Opcode::F64X2Floor}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 530 "src/lexer-keywords.txt" - {"v128.const", TokenType::Const, Opcode::V128Const}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 352 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AndU}, -#line 229 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AndU}, -#line 488 "src/lexer-keywords.txt" - {"memory.init", TokenType::MemoryInit, Opcode::MemoryInit}, - {""}, {""}, {""}, -#line 115 "src/lexer-keywords.txt" - {"f64.convert_i32_u", TokenType::Convert, Opcode::F64ConvertI32U}, -#line 58 "src/lexer-keywords.txt" - {"f32.convert_i32_u", TokenType::Convert, Opcode::F32ConvertI32U}, - {""}, {""}, {""}, {""}, -#line 489 "src/lexer-keywords.txt" - {"memory.size", TokenType::MemorySize, Opcode::MemorySize}, +#line 379 "src/lexer-keywords.txt" + {"i64.extend_i32_u", TokenType::Convert, Opcode::I64ExtendI32U}, + {""}, +#line 553 "src/lexer-keywords.txt" + {"f64.convert_s/i32", TokenType::Convert, Opcode::F64ConvertI32S}, +#line 547 "src/lexer-keywords.txt" + {"f32.convert_s/i32", TokenType::Convert, Opcode::F32ConvertI32S}, + {""}, {""}, +#line 527 "src/lexer-keywords.txt" + {"v128.and", TokenType::Binary, Opcode::V128And}, +#line 364 "src/lexer-keywords.txt" + {"i64.atomic.store16", TokenType::AtomicStore, Opcode::I64AtomicStore16}, +#line 241 "src/lexer-keywords.txt" + {"i32.atomic.store16", TokenType::AtomicStore, Opcode::I32AtomicStore16}, +#line 584 "src/lexer-keywords.txt" + {"tee_local", TokenType::LocalTee, Opcode::LocalTee}, + {""}, {""}, +#line 583 "src/lexer-keywords.txt" + {"set_local", TokenType::LocalSet, Opcode::LocalSet}, +#line 578 "src/lexer-keywords.txt" + {"i64.trunc_u/f32", TokenType::Convert, Opcode::I64TruncF32U}, +#line 566 "src/lexer-keywords.txt" + {"i32.trunc_u/f32", TokenType::Convert, Opcode::I32TruncF32U}, +#line 107 "src/lexer-keywords.txt" + {"f32x4.trunc", TokenType::Unary, Opcode::F32X4Trunc}, #line 529 "src/lexer-keywords.txt" - {"v128.bitselect", TokenType::Ternary, Opcode::V128BitSelect}, + {"v128.const", TokenType::Const, Opcode::V128Const}, {""}, -#line 42 "src/lexer-keywords.txt" - {"drop", TokenType::Drop, Opcode::Drop}, +#line 555 "src/lexer-keywords.txt" + {"f64.convert_u/i32", TokenType::Convert, Opcode::F64ConvertI32U}, +#line 549 "src/lexer-keywords.txt" + {"f32.convert_u/i32", TokenType::Convert, Opcode::F32ConvertI32U}, {""}, {""}, #line 498 "src/lexer-keywords.txt" - {"param", TokenType::Param}, -#line 158 "src/lexer-keywords.txt" - {"f64x2.pmin", TokenType::Binary, Opcode::F64X2PMin}, + {"quote", TokenType::Quote}, + {""}, +#line 333 "src/lexer-keywords.txt" + {"i64.atomic.load32_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad32U}, {""}, {""}, -#line 417 "src/lexer-keywords.txt" - {"i64.trunc_sat_f32_s", TokenType::Convert, Opcode::I64TruncSatF32S}, -#line 287 "src/lexer-keywords.txt" - {"i32.trunc_sat_f32_s", TokenType::Convert, Opcode::I32TruncSatF32S}, +#line 551 "src/lexer-keywords.txt" + {"f32.demote/f64", TokenType::Convert, Opcode::F32DemoteF64}, +#line 97 "src/lexer-keywords.txt" + {"f32x4.mul", TokenType::Binary, Opcode::F32X4Mul}, {""}, {""}, -#line 418 "src/lexer-keywords.txt" - {"i64.trunc_sat_f32_u", TokenType::Convert, Opcode::I64TruncSatF32U}, -#line 288 "src/lexer-keywords.txt" - {"i32.trunc_sat_f32_u", TokenType::Convert, Opcode::I32TruncSatF32U}, +#line 313 "src/lexer-keywords.txt" + {"i32x4.mul", TokenType::Binary, Opcode::I32X4Mul}, {""}, {""}, {""}, -#line 358 "src/lexer-keywords.txt" - {"i64.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I64AtomicRmwAdd}, -#line 235 "src/lexer-keywords.txt" - {"i32.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I32AtomicRmwAdd}, +#line 23 "src/lexer-keywords.txt" + {"assert_malformed", TokenType::AssertMalformed}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 390 "src/lexer-keywords.txt" + {"i64.load8_s", TokenType::Load, Opcode::I64Load8S}, +#line 261 "src/lexer-keywords.txt" + {"i32.load8_s", TokenType::Load, Opcode::I32Load8S}, + {""}, {""}, {""}, +#line 526 "src/lexer-keywords.txt" + {"v128.andnot", TokenType::Binary, Opcode::V128Andnot}, {""}, -#line 334 "src/lexer-keywords.txt" - {"i64.atomic.load32_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad32U}, +#line 134 "src/lexer-keywords.txt" + {"f64.sqrt", TokenType::Unary, Opcode::F64Sqrt}, +#line 77 "src/lexer-keywords.txt" + {"f32.sqrt", TokenType::Unary, Opcode::F32Sqrt}, {""}, {""}, -#line 534 "src/lexer-keywords.txt" - {"v128.store", TokenType::Store, Opcode::V128Store}, -#line 486 "src/lexer-keywords.txt" - {"memory.fill", TokenType::MemoryFill, Opcode::MemoryFill}, - {""}, {""}, {""}, -#line 160 "src/lexer-keywords.txt" +#line 530 "src/lexer-keywords.txt" + {"v128.load", TokenType::Load, Opcode::V128Load}, + {""}, {""}, +#line 350 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AddU}, +#line 227 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AddU}, + {""}, +#line 497 "src/lexer-keywords.txt" + {"param", TokenType::Param}, + {""}, {""}, +#line 294 "src/lexer-keywords.txt" + {"i32x4.all_true", TokenType::Unary, Opcode::I32X4AllTrue}, + {""}, +#line 375 "src/lexer-keywords.txt" + {"i64.extend16_s", TokenType::Unary, Opcode::I64Extend16S}, +#line 251 "src/lexer-keywords.txt" + {"i32.extend16_s", TokenType::Unary, Opcode::I32Extend16S}, +#line 159 "src/lexer-keywords.txt" {"f64x2.splat", TokenType::Unary, Opcode::F64X2Splat}, -#line 168 "src/lexer-keywords.txt" - {"get", TokenType::Get}, +#line 506 "src/lexer-keywords.txt" + {"return_call_indirect", TokenType::ReturnCallIndirect, Opcode::ReturnCallIndirect}, {""}, -#line 432 "src/lexer-keywords.txt" +#line 431 "src/lexer-keywords.txt" {"i64x2.splat", TokenType::Unary, Opcode::I64X2Splat}, -#line 576 "src/lexer-keywords.txt" - {"i64.trunc_s/f64", TokenType::Convert, Opcode::I64TruncF64S}, -#line 564 "src/lexer-keywords.txt" - {"i32.trunc_s/f64", TokenType::Convert, Opcode::I32TruncF64S}, -#line 580 "src/lexer-keywords.txt" - {"i64.trunc_u/f64", TokenType::Convert, Opcode::I64TruncF64U}, -#line 568 "src/lexer-keywords.txt" - {"i32.trunc_u/f64", TokenType::Convert, Opcode::I32TruncF64U}, -#line 133 "src/lexer-keywords.txt" - {"f64.promote_f32", TokenType::Convert, Opcode::F64PromoteF32}, - {""}, {""}, {""}, {""}, -#line 362 "src/lexer-keywords.txt" - {"i64.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I64AtomicRmwSub}, -#line 239 "src/lexer-keywords.txt" - {"i32.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I32AtomicRmwSub}, + {""}, {""}, +#line 354 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8SubU}, +#line 231 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8SubU}, +#line 391 "src/lexer-keywords.txt" + {"i64.load8_u", TokenType::Load, Opcode::I64Load8U}, +#line 262 "src/lexer-keywords.txt" + {"i32.load8_u", TokenType::Load, Opcode::I32Load8U}, + {""}, {""}, #line 351 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AddU}, + {"i64.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AndU}, #line 228 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AddU}, - {""}, {""}, {""}, {""}, -#line 531 "src/lexer-keywords.txt" - {"v128.load", TokenType::Load, Opcode::V128Load}, + {"i32.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AndU}, + {""}, {""}, +#line 160 "src/lexer-keywords.txt" + {"f64x2.sqrt", TokenType::Unary, Opcode::F64X2Sqrt}, +#line 76 "src/lexer-keywords.txt" + {"f32.reinterpret_i32", TokenType::Convert, Opcode::F32ReinterpretI32}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 575 "src/lexer-keywords.txt" + {"i64.trunc_s/f64", TokenType::Convert, Opcode::I64TruncF64S}, +#line 563 "src/lexer-keywords.txt" + {"i32.trunc_s/f64", TokenType::Convert, Opcode::I32TruncF64S}, + {""}, {""}, {""}, {""}, {""}, +#line 357 "src/lexer-keywords.txt" + {"i64.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I64AtomicRmwAdd}, +#line 234 "src/lexer-keywords.txt" + {"i32.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I32AtomicRmwAdd}, +#line 358 "src/lexer-keywords.txt" + {"i64.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I64AtomicRmwAnd}, +#line 235 "src/lexer-keywords.txt" + {"i32.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I32AtomicRmwAnd}, + {""}, {""}, +#line 121 "src/lexer-keywords.txt" + {"f64.ge", TokenType::Compare, Opcode::F64Ge}, +#line 65 "src/lexer-keywords.txt" + {"f32.ge", TokenType::Compare, Opcode::F32Ge}, + {""}, +#line 579 "src/lexer-keywords.txt" + {"i64.trunc_u/f64", TokenType::Convert, Opcode::I64TruncF64U}, +#line 567 "src/lexer-keywords.txt" + {"i32.trunc_u/f64", TokenType::Convert, Opcode::I32TruncF64U}, {""}, -#line 572 "src/lexer-keywords.txt" - {"i64.extend_s/i32", TokenType::Convert, Opcode::I64ExtendI32S}, +#line 122 "src/lexer-keywords.txt" + {"f64.gt", TokenType::Compare, Opcode::F64Gt}, +#line 66 "src/lexer-keywords.txt" + {"f32.gt", TokenType::Compare, Opcode::F32Gt}, + {""}, {""}, +#line 20 "src/lexer-keywords.txt" + {"array", Type::Array, TokenType::Array}, {""}, -#line 573 "src/lexer-keywords.txt" - {"i64.extend_u/i32", TokenType::Convert, Opcode::I64ExtendI32U}, +#line 167 "src/lexer-keywords.txt" + {"get", TokenType::Get}, {""}, {""}, -#line 500 "src/lexer-keywords.txt" - {"ref.extern", TokenType::RefExtern}, +#line 157 "src/lexer-keywords.txt" + {"f64x2.pmin", TokenType::Binary, Opcode::F64X2PMin}, +#line 528 "src/lexer-keywords.txt" + {"v128.bitselect", TokenType::Ternary, Opcode::V128BitSelect}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 380 "src/lexer-keywords.txt" + {"i64.ge_s", TokenType::Compare, Opcode::I64GeS}, +#line 253 "src/lexer-keywords.txt" + {"i32.ge_s", TokenType::Compare, Opcode::I32GeS}, +#line 493 "src/lexer-keywords.txt" + {"nan:canonical", TokenType::NanCanonical}, +#line 382 "src/lexer-keywords.txt" + {"i64.gt_s", TokenType::Compare, Opcode::I64GtS}, +#line 255 "src/lexer-keywords.txt" + {"i32.gt_s", TokenType::Compare, Opcode::I32GtS}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 405 "src/lexer-keywords.txt" + {"i64.shr_s", TokenType::Binary, Opcode::I64ShrS}, +#line 276 "src/lexer-keywords.txt" + {"i32.shr_s", TokenType::Binary, Opcode::I32ShrS}, {""}, {""}, {""}, -#line 575 "src/lexer-keywords.txt" - {"i64.trunc_s/f32", TokenType::Convert, Opcode::I64TruncF32S}, -#line 563 "src/lexer-keywords.txt" - {"i32.trunc_s/f32", TokenType::Convert, Opcode::I32TruncF32S}, -#line 579 "src/lexer-keywords.txt" - {"i64.trunc_u/f32", TokenType::Convert, Opcode::I64TruncF32U}, -#line 567 "src/lexer-keywords.txt" - {"i32.trunc_u/f32", TokenType::Convert, Opcode::I32TruncF32U}, -#line 371 "src/lexer-keywords.txt" - {"i64.ctz", TokenType::Unary, Opcode::I64Ctz}, -#line 247 "src/lexer-keywords.txt" - {"i32.ctz", TokenType::Unary, Opcode::I32Ctz}, -#line 555 "src/lexer-keywords.txt" - {"f64.convert_s/i64", TokenType::Convert, Opcode::F64ConvertI64S}, -#line 549 "src/lexer-keywords.txt" - {"f32.convert_s/i64", TokenType::Convert, Opcode::F32ConvertI64S}, -#line 557 "src/lexer-keywords.txt" - {"f64.convert_u/i64", TokenType::Convert, Opcode::F64ConvertI64U}, -#line 551 "src/lexer-keywords.txt" - {"f32.convert_u/i64", TokenType::Convert, Opcode::F32ConvertI64U}, +#line 374 "src/lexer-keywords.txt" + {"i64.eqz", TokenType::Convert, Opcode::I64Eqz}, +#line 250 "src/lexer-keywords.txt" + {"i32.eqz", TokenType::Convert, Opcode::I32Eqz}, {""}, {""}, +#line 503 "src/lexer-keywords.txt" + {"register", TokenType::Register}, +#line 30 "src/lexer-keywords.txt" + {"br_if", TokenType::BrIf, Opcode::BrIf}, + {""}, {""}, {""}, +#line 571 "src/lexer-keywords.txt" + {"i64.extend_s/i32", TokenType::Convert, Opcode::I64ExtendI32S}, + {""}, {""}, {""}, #line 361 "src/lexer-keywords.txt" - {"i64.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I64AtomicRmwOr}, + {"i64.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I64AtomicRmwSub}, #line 238 "src/lexer-keywords.txt" - {"i32.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I32AtomicRmwOr}, - {""}, {""}, -#line 127 "src/lexer-keywords.txt" - {"f64.max", TokenType::Binary, Opcode::F64Max}, -#line 71 "src/lexer-keywords.txt" - {"f32.max", TokenType::Binary, Opcode::F32Max}, + {"i32.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I32AtomicRmwSub}, {""}, -#line 93 "src/lexer-keywords.txt" - {"f32x4.gt", TokenType::Compare, Opcode::F32X4Gt}, -#line 30 "src/lexer-keywords.txt" - {"br_if", TokenType::BrIf, Opcode::BrIf}, -#line 21 "src/lexer-keywords.txt" - {"assert_exhaustion", TokenType::AssertExhaustion}, +#line 381 "src/lexer-keywords.txt" + {"i64.ge_u", TokenType::Compare, Opcode::I64GeU}, +#line 254 "src/lexer-keywords.txt" + {"i32.ge_u", TokenType::Compare, Opcode::I32GeU}, {""}, -#line 369 "src/lexer-keywords.txt" - {"i64.clz", TokenType::Unary, Opcode::I64Clz}, -#line 245 "src/lexer-keywords.txt" - {"i32.clz", TokenType::Unary, Opcode::I32Clz}, -#line 348 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32SubU}, +#line 383 "src/lexer-keywords.txt" + {"i64.gt_u", TokenType::Compare, Opcode::I64GtU}, +#line 256 "src/lexer-keywords.txt" + {"i32.gt_u", TokenType::Compare, Opcode::I32GtU}, {""}, {""}, -#line 328 "src/lexer-keywords.txt" - {"i32x4.widen_low_i16x8_s", TokenType::Unary, Opcode::I32X4WidenLowI16X8S}, - {""}, -#line 329 "src/lexer-keywords.txt" - {"i32x4.widen_low_i16x8_u", TokenType::Unary, Opcode::I32X4WidenLowI16X8U}, -#line 92 "src/lexer-keywords.txt" - {"f32x4.ge", TokenType::Compare, Opcode::F32X4Ge}, - {""}, -#line 302 "src/lexer-keywords.txt" - {"i32x4.gt_s", TokenType::Compare, Opcode::I32X4GtS}, - {""}, -#line 303 "src/lexer-keywords.txt" - {"i32x4.gt_u", TokenType::Compare, Opcode::I32X4GtU}, -#line 359 "src/lexer-keywords.txt" - {"i64.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I64AtomicRmwAnd}, -#line 236 "src/lexer-keywords.txt" - {"i32.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I32AtomicRmwAnd}, +#line 146 "src/lexer-keywords.txt" + {"f64x2.ge", TokenType::Compare, Opcode::F64X2Ge}, {""}, -#line 300 "src/lexer-keywords.txt" - {"i32x4.ge_s", TokenType::Compare, Opcode::I32X4GeS}, +#line 572 "src/lexer-keywords.txt" + {"i64.extend_u/i32", TokenType::Convert, Opcode::I64ExtendI32U}, {""}, -#line 301 "src/lexer-keywords.txt" - {"i32x4.ge_u", TokenType::Compare, Opcode::I32X4GeU}, - {""}, {""}, -#line 96 "src/lexer-keywords.txt" - {"f32x4.max", TokenType::Binary, Opcode::F32X4Max}, - {""}, {""}, {""}, {""}, {""}, -#line 375 "src/lexer-keywords.txt" - {"i64.eqz", TokenType::Convert, Opcode::I64Eqz}, -#line 251 "src/lexer-keywords.txt" - {"i32.eqz", TokenType::Convert, Opcode::I32Eqz}, - {""}, {""}, {""}, -#line 345 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AndU}, -#line 90 "src/lexer-keywords.txt" - {"f32x4.extract_lane", TokenType::SimdLaneOp, Opcode::F32X4ExtractLane}, +#line 406 "src/lexer-keywords.txt" + {"i64.shr_u", TokenType::Binary, Opcode::I64ShrU}, +#line 277 "src/lexer-keywords.txt" + {"i32.shr_u", TokenType::Binary, Opcode::I32ShrU}, +#line 147 "src/lexer-keywords.txt" + {"f64x2.gt", TokenType::Compare, Opcode::F64X2Gt}, +#line 429 "src/lexer-keywords.txt" + {"i64x2.shr_s", TokenType::Binary, Opcode::I64X2ShrS}, {""}, {""}, -#line 299 "src/lexer-keywords.txt" - {"i32x4.extract_lane", TokenType::SimdLaneOp, Opcode::I32X4ExtractLane}, - {""}, {""}, {""}, -#line 123 "src/lexer-keywords.txt" - {"f64.gt", TokenType::Compare, Opcode::F64Gt}, -#line 67 "src/lexer-keywords.txt" - {"f32.gt", TokenType::Compare, Opcode::F32Gt}, - {""}, {""}, {""}, {""}, {""}, -#line 533 "src/lexer-keywords.txt" - {"v128.or", TokenType::Binary, Opcode::V128Or}, +#line 133 "src/lexer-keywords.txt" + {"f64.reinterpret_i64", TokenType::Convert, Opcode::F64ReinterpretI64}, {""}, -#line 376 "src/lexer-keywords.txt" - {"i64.extend16_s", TokenType::Unary, Opcode::I64Extend16S}, +#line 377 "src/lexer-keywords.txt" + {"i64.extend8_s", TokenType::Unary, Opcode::I64Extend8S}, #line 252 "src/lexer-keywords.txt" - {"i32.extend16_s", TokenType::Unary, Opcode::I32Extend16S}, -#line 516 "src/lexer-keywords.txt" + {"i32.extend8_s", TokenType::Unary, Opcode::I32Extend8S}, +#line 535 "src/lexer-keywords.txt" + {"v128.xor", TokenType::Binary, Opcode::V128Xor}, + {""}, {""}, +#line 21 "src/lexer-keywords.txt" + {"assert_exhaustion", TokenType::AssertExhaustion}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 515 "src/lexer-keywords.txt" {"table.get", TokenType::TableGet, Opcode::TableGet}, -#line 122 "src/lexer-keywords.txt" - {"f64.ge", TokenType::Compare, Opcode::F64Ge}, -#line 66 "src/lexer-keywords.txt" - {"f32.ge", TokenType::Compare, Opcode::F32Ge}, - {""}, {""}, {""}, -#line 341 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16SubU}, -#line 225 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16SubU}, - {""}, {""}, {""}, {""}, -#line 383 "src/lexer-keywords.txt" - {"i64.gt_s", TokenType::Compare, Opcode::I64GtS}, -#line 256 "src/lexer-keywords.txt" - {"i32.gt_s", TokenType::Compare, Opcode::I32GtS}, -#line 398 "src/lexer-keywords.txt" - {"i64.or", TokenType::Binary, Opcode::I64Or}, -#line 269 "src/lexer-keywords.txt" - {"i32.or", TokenType::Binary, Opcode::I32Or}, -#line 384 "src/lexer-keywords.txt" - {"i64.gt_u", TokenType::Compare, Opcode::I64GtU}, -#line 257 "src/lexer-keywords.txt" - {"i32.gt_u", TokenType::Compare, Opcode::I32GtU}, -#line 381 "src/lexer-keywords.txt" - {"i64.ge_s", TokenType::Compare, Opcode::I64GeS}, -#line 254 "src/lexer-keywords.txt" - {"i32.ge_s", TokenType::Compare, Opcode::I32GeS}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 327 "src/lexer-keywords.txt" + {"i32x4.widen_low_i16x8_s", TokenType::Unary, Opcode::I32X4WidenLowI16X8S}, + {""}, {""}, {""}, {""}, {""}, +#line 430 "src/lexer-keywords.txt" + {"i64x2.shr_u", TokenType::Binary, Opcode::I64X2ShrU}, + {""}, +#line 35 "src/lexer-keywords.txt" + {"catch", TokenType::Catch, Opcode::Catch}, {""}, {""}, -#line 382 "src/lexer-keywords.txt" - {"i64.ge_u", TokenType::Compare, Opcode::I64GeU}, -#line 255 "src/lexer-keywords.txt" - {"i32.ge_u", TokenType::Compare, Opcode::I32GeU}, +#line 132 "src/lexer-keywords.txt" + {"f64.promote_f32", TokenType::Convert, Opcode::F64PromoteF32}, {""}, {""}, {""}, -#line 148 "src/lexer-keywords.txt" - {"f64x2.gt", TokenType::Compare, Opcode::F64X2Gt}, +#line 488 "src/lexer-keywords.txt" + {"memory.size", TokenType::MemorySize, Opcode::MemorySize}, +#line 328 "src/lexer-keywords.txt" + {"i32x4.widen_low_i16x8_u", TokenType::Unary, Opcode::I32X4WidenLowI16X8U}, +#line 120 "src/lexer-keywords.txt" + {"f64.floor", TokenType::Unary, Opcode::F64Floor}, +#line 64 "src/lexer-keywords.txt" + {"f32.floor", TokenType::Unary, Opcode::F32Floor}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 346 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32OrU}, +#line 334 "src/lexer-keywords.txt" + {"i64.atomic.load8_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad8U}, +#line 218 "src/lexer-keywords.txt" + {"i32.atomic.load8_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad8U}, + {""}, +#line 418 "src/lexer-keywords.txt" + {"i64.trunc_sat_f64_s", TokenType::Convert, Opcode::I64TruncSatF64S}, +#line 288 "src/lexer-keywords.txt" + {"i32.trunc_sat_f64_s", TokenType::Convert, Opcode::I32TruncSatF64S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 338 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AndU}, -#line 222 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AndU}, -#line 344 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AddU}, -#line 147 "src/lexer-keywords.txt" - {"f64x2.ge", TokenType::Compare, Opcode::F64X2Ge}, -#line 405 "src/lexer-keywords.txt" +#line 487 "src/lexer-keywords.txt" + {"memory.init", TokenType::MemoryInit, Opcode::MemoryInit}, + {""}, {""}, {""}, +#line 404 "src/lexer-keywords.txt" {"i64.shl", TokenType::Binary, Opcode::I64Shl}, -#line 276 "src/lexer-keywords.txt" +#line 275 "src/lexer-keywords.txt" {"i32.shl", TokenType::Binary, Opcode::I32Shl}, +#line 347 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32SubU}, + {""}, {""}, +#line 461 "src/lexer-keywords.txt" + {"i8x16.ne", TokenType::Compare, Opcode::I8X16Ne}, + {""}, +#line 104 "src/lexer-keywords.txt" + {"f32x4.splat", TokenType::Unary, Opcode::F32X4Splat}, + {""}, +#line 169 "src/lexer-keywords.txt" + {"global.set", TokenType::GlobalSet, Opcode::GlobalSet}, +#line 320 "src/lexer-keywords.txt" + {"i32x4.splat", TokenType::Unary, Opcode::I32X4Splat}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 419 "src/lexer-keywords.txt" + {"i64.trunc_sat_f64_u", TokenType::Convert, Opcode::I64TruncSatF64U}, +#line 289 "src/lexer-keywords.txt" + {"i32.trunc_sat_f64_u", TokenType::Convert, Opcode::I32TruncSatF64U}, + {""}, {""}, +#line 144 "src/lexer-keywords.txt" + {"f64x2.extract_lane", TokenType::SimdLaneOp, Opcode::F64X2ExtractLane}, +#line 105 "src/lexer-keywords.txt" + {"f32x4.sqrt", TokenType::Unary, Opcode::F32X4Sqrt}, {""}, +#line 422 "src/lexer-keywords.txt" + {"i64x2.extract_lane", TokenType::SimdLaneOp, Opcode::I64X2ExtractLane}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, #line 554 "src/lexer-keywords.txt" - {"f64.convert_s/i32", TokenType::Convert, Opcode::F64ConvertI32S}, + {"f64.convert_s/i64", TokenType::Convert, Opcode::F64ConvertI64S}, #line 548 "src/lexer-keywords.txt" - {"f32.convert_s/i32", TokenType::Convert, Opcode::F32ConvertI32S}, + {"f32.convert_s/i64", TokenType::Convert, Opcode::F32ConvertI64S}, + {""}, {""}, {""}, +#line 170 "src/lexer-keywords.txt" + {"global", TokenType::Global}, + {""}, +#line 428 "src/lexer-keywords.txt" + {"i64x2.shl", TokenType::Binary, Opcode::I64X2Shl}, +#line 126 "src/lexer-keywords.txt" + {"f64.max", TokenType::Binary, Opcode::F64Max}, +#line 70 "src/lexer-keywords.txt" + {"f32.max", TokenType::Binary, Opcode::F32Max}, + {""}, +#line 552 "src/lexer-keywords.txt" + {"f32.reinterpret/i32", TokenType::Convert, Opcode::F32ReinterpretI32}, +#line 41 "src/lexer-keywords.txt" + {"delegate", TokenType::Delegate}, + {""}, {""}, {""}, #line 556 "src/lexer-keywords.txt" - {"f64.convert_u/i32", TokenType::Convert, Opcode::F64ConvertI32U}, + {"f64.convert_u/i64", TokenType::Convert, Opcode::F64ConvertI64U}, #line 550 "src/lexer-keywords.txt" - {"f32.convert_u/i32", TokenType::Convert, Opcode::F32ConvertI32U}, -#line 346 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw32CmpxchgU}, + {"f32.convert_u/i64", TokenType::Convert, Opcode::F32ConvertI64U}, {""}, {""}, {""}, {""}, -#line 151 "src/lexer-keywords.txt" - {"f64x2.max", TokenType::Binary, Opcode::F64X2Max}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 296 "src/lexer-keywords.txt" - {"i32x4.any_true", TokenType::Unary, Opcode::I32X4AnyTrue}, -#line 399 "src/lexer-keywords.txt" - {"i64.popcnt", TokenType::Unary, Opcode::I64Popcnt}, -#line 270 "src/lexer-keywords.txt" - {"i32.popcnt", TokenType::Unary, Opcode::I32Popcnt}, -#line 145 "src/lexer-keywords.txt" - {"f64x2.extract_lane", TokenType::SimdLaneOp, Opcode::F64X2ExtractLane}, - {""}, {""}, -#line 423 "src/lexer-keywords.txt" - {"i64x2.extract_lane", TokenType::SimdLaneOp, Opcode::I64X2ExtractLane}, +#line 450 "src/lexer-keywords.txt" + {"i8x16.le_s", TokenType::Compare, Opcode::I8X16LeS}, {""}, -#line 318 "src/lexer-keywords.txt" - {"i32x4.shl", TokenType::Binary, Opcode::I32X4Shl}, - {""}, {""}, {""}, -#line 477 "src/lexer-keywords.txt" - {"local.get", TokenType::LocalGet, Opcode::LocalGet}, -#line 462 "src/lexer-keywords.txt" - {"i8x16.ne", TokenType::Compare, Opcode::I8X16Ne}, -#line 36 "src/lexer-keywords.txt" - {"catch", TokenType::Catch, Opcode::Catch}, - {""}, {""}, -#line 471 "src/lexer-keywords.txt" +#line 102 "src/lexer-keywords.txt" + {"f32x4.pmin", TokenType::Binary, Opcode::F32X4PMin}, +#line 452 "src/lexer-keywords.txt" + {"i8x16.lt_s", TokenType::Compare, Opcode::I8X16LtS}, +#line 309 "src/lexer-keywords.txt" + {"i32x4.max_s", TokenType::Binary, Opcode::I32X4MaxS}, +#line 516 "src/lexer-keywords.txt" + {"table.grow", TokenType::TableGrow, Opcode::TableGrow}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 469 "src/lexer-keywords.txt" + {"i8x16.sub", TokenType::Binary, Opcode::I8X16Sub}, + {""}, +#line 470 "src/lexer-keywords.txt" {"i8x16", TokenType::I8X16}, -#line 171 "src/lexer-keywords.txt" - {"global", TokenType::Global}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 457 "src/lexer-keywords.txt" - {"i8x16.min_s", TokenType::Binary, Opcode::I8X16MinS}, + {""}, +#line 451 "src/lexer-keywords.txt" + {"i8x16.le_u", TokenType::Compare, Opcode::I8X16LeU}, {""}, {""}, #line 453 "src/lexer-keywords.txt" - {"i8x16.lt_s", TokenType::Compare, Opcode::I8X16LtS}, -#line 458 "src/lexer-keywords.txt" - {"i8x16.min_u", TokenType::Binary, Opcode::I8X16MinU}, -#line 454 "src/lexer-keywords.txt" {"i8x16.lt_u", TokenType::Compare, Opcode::I8X16LtU}, -#line 337 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AddU}, -#line 221 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AddU}, - {""}, -#line 451 "src/lexer-keywords.txt" - {"i8x16.le_s", TokenType::Compare, Opcode::I8X16LeS}, {""}, -#line 452 "src/lexer-keywords.txt" - {"i8x16.le_u", TokenType::Compare, Opcode::I8X16LeU}, -#line 102 "src/lexer-keywords.txt" - {"f32x4.pmax", TokenType::Binary, Opcode::F32X4PMax}, +#line 85 "src/lexer-keywords.txt" + {"f32x4.convert_i32x4_s", TokenType::Unary, Opcode::F32X4ConvertI32X4S}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 343 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AddU}, + {""}, {""}, {""}, {""}, +#line 310 "src/lexer-keywords.txt" + {"i32x4.max_u", TokenType::Binary, Opcode::I32X4MaxU}, +#line 86 "src/lexer-keywords.txt" + {"f32x4.convert_i32x4_u", TokenType::Unary, Opcode::F32X4ConvertI32X4U}, +#line 485 "src/lexer-keywords.txt" + {"memory.fill", TokenType::MemoryFill, Opcode::MemoryFill}, {""}, {""}, +#line 494 "src/lexer-keywords.txt" + {"nop", TokenType::Nop, Opcode::Nop}, #line 339 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw16CmpxchgU}, + {"i64.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16OrU}, #line 223 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw16CmpxchgU}, + {"i32.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16OrU}, +#line 438 "src/lexer-keywords.txt" + {"i8x16.add", TokenType::Binary, Opcode::I8X16Add}, + {""}, {""}, {""}, +#line 332 "src/lexer-keywords.txt" + {"i64.atomic.load16_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad16U}, +#line 217 "src/lexer-keywords.txt" + {"i32.atomic.load16_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad16U}, +#line 91 "src/lexer-keywords.txt" + {"f32x4.ge", TokenType::Compare, Opcode::F32X4Ge}, +#line 158 "src/lexer-keywords.txt" + {"f64x2.replace_lane", TokenType::SimdLaneOp, Opcode::F64X2ReplaceLane}, {""}, -#line 170 "src/lexer-keywords.txt" - {"global.set", TokenType::GlobalSet, Opcode::GlobalSet}, +#line 344 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AndU}, +#line 427 "src/lexer-keywords.txt" + {"i64x2.replace_lane", TokenType::SimdLaneOp, Opcode::I64X2ReplaceLane}, + {""}, +#line 92 "src/lexer-keywords.txt" + {"f32x4.gt", TokenType::Compare, Opcode::F32X4Gt}, +#line 318 "src/lexer-keywords.txt" + {"i32x4.shr_s", TokenType::Binary, Opcode::I32X4ShrS}, + {""}, {""}, {""}, {""}, +#line 340 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16SubU}, +#line 224 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16SubU}, + {""}, +#line 299 "src/lexer-keywords.txt" + {"i32x4.ge_s", TokenType::Compare, Opcode::I32X4GeS}, + {""}, {""}, +#line 301 "src/lexer-keywords.txt" + {"i32x4.gt_s", TokenType::Compare, Opcode::I32X4GtS}, +#line 523 "src/lexer-keywords.txt" + {"try", TokenType::Try, Opcode::Try}, +#line 201 "src/lexer-keywords.txt" + {"i16x8.ne", TokenType::Compare, Opcode::I16X8Ne}, +#line 435 "src/lexer-keywords.txt" + {"i8x16.abs", TokenType::Unary, Opcode::I8X16Abs}, + {""}, {""}, {""}, {""}, {""}, +#line 456 "src/lexer-keywords.txt" + {"i8x16.min_s", TokenType::Binary, Opcode::I8X16MinS}, +#line 295 "src/lexer-keywords.txt" + {"i32x4.any_true", TokenType::Unary, Opcode::I32X4AnyTrue}, + {""}, {""}, +#line 300 "src/lexer-keywords.txt" + {"i32x4.ge_u", TokenType::Compare, Opcode::I32X4GeU}, #line 558 "src/lexer-keywords.txt" - {"f64.promote/f32", TokenType::Convert, Opcode::F64PromoteF32}, + {"f64.reinterpret/i64", TokenType::Convert, Opcode::F64ReinterpretI64}, + {""}, +#line 302 "src/lexer-keywords.txt" + {"i32x4.gt_u", TokenType::Compare, Opcode::I32X4GtU}, + {""}, {""}, {""}, {""}, +#line 319 "src/lexer-keywords.txt" + {"i32x4.shr_u", TokenType::Binary, Opcode::I32X4ShrU}, +#line 500 "src/lexer-keywords.txt" + {"ref.func", TokenType::RefFunc, Opcode::RefFunc}, +#line 423 "src/lexer-keywords.txt" + {"v128.load32x2_s", TokenType::Load, Opcode::V128Load32X2S}, + {""}, {""}, {""}, +#line 582 "src/lexer-keywords.txt" + {"set_global", TokenType::GlobalSet, Opcode::GlobalSet}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 547 "src/lexer-keywords.txt" + {""}, {""}, +#line 424 "src/lexer-keywords.txt" + {"v128.load32x2_u", TokenType::Load, Opcode::V128Load32X2U}, +#line 150 "src/lexer-keywords.txt" + {"f64x2.max", TokenType::Binary, Opcode::F64X2Max}, +#line 457 "src/lexer-keywords.txt" + {"i8x16.min_u", TokenType::Binary, Opcode::I8X16MinU}, + {""}, +#line 546 "src/lexer-keywords.txt" {"anyfunc", Type::FuncRef}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, -#line 495 "src/lexer-keywords.txt" - {"nop", TokenType::Nop, Opcode::Nop}, {""}, {""}, -#line 436 "src/lexer-keywords.txt" - {"i8x16.abs", TokenType::Unary, Opcode::I8X16Abs}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 484 "src/lexer-keywords.txt" - {"memory.atomic.wait64", TokenType::AtomicWait, Opcode::MemoryAtomicWait64}, - {""}, {""}, {""}, -#line 429 "src/lexer-keywords.txt" - {"i64x2.shl", TokenType::Binary, Opcode::I64X2Shl}, -#line 470 "src/lexer-keywords.txt" - {"i8x16.sub", TokenType::Binary, Opcode::I8X16Sub}, +#line 442 "src/lexer-keywords.txt" + {"i8x16.bitmask", TokenType::Unary, Opcode::I8X16Bitmask}, + {""}, +#line 557 "src/lexer-keywords.txt" + {"f64.promote/f32", TokenType::Convert, Opcode::F64PromoteF32}, +#line 353 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8OrU}, +#line 230 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8OrU}, +#line 525 "src/lexer-keywords.txt" + {"unreachable", TokenType::Unreachable, Opcode::Unreachable}, {""}, {""}, -#line 202 "src/lexer-keywords.txt" - {"i16x8.ne", TokenType::Compare, Opcode::I16X8Ne}, -#line 406 "src/lexer-keywords.txt" - {"i64.shr_s", TokenType::Binary, Opcode::I64ShrS}, -#line 277 "src/lexer-keywords.txt" - {"i32.shr_s", TokenType::Binary, Opcode::I32ShrS}, +#line 187 "src/lexer-keywords.txt" + {"i16x8.le_s", TokenType::Compare, Opcode::I16X8LeS}, {""}, {""}, -#line 407 "src/lexer-keywords.txt" - {"i64.shr_u", TokenType::Binary, Opcode::I64ShrU}, -#line 278 "src/lexer-keywords.txt" - {"i32.shr_u", TokenType::Binary, Opcode::I32ShrU}, +#line 191 "src/lexer-keywords.txt" + {"i16x8.lt_s", TokenType::Compare, Opcode::I16X8LtS}, + {""}, +#line 467 "src/lexer-keywords.txt" + {"i8x16.sub_sat_s", TokenType::Binary, Opcode::I8X16SubSatS}, + {""}, +#line 476 "src/lexer-keywords.txt" + {"local.get", TokenType::LocalGet, Opcode::LocalGet}, + {""}, {""}, {""}, {""}, +#line 209 "src/lexer-keywords.txt" + {"i16x8.sub", TokenType::Binary, Opcode::I16X8Sub}, {""}, {""}, -#line 435 "src/lexer-keywords.txt" - {"i64.xor", TokenType::Binary, Opcode::I64Xor}, -#line 330 "src/lexer-keywords.txt" - {"i32.xor", TokenType::Binary, Opcode::I32Xor}, +#line 345 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw32CmpxchgU}, +#line 188 "src/lexer-keywords.txt" + {"i16x8.le_u", TokenType::Compare, Opcode::I16X8LeU}, +#line 28 "src/lexer-keywords.txt" + {"binary", TokenType::Bin}, {""}, -#line 347 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32OrU}, -#line 196 "src/lexer-keywords.txt" - {"i16x8.min_s", TokenType::Binary, Opcode::I16X8MinS}, - {""}, {""}, #line 192 "src/lexer-keywords.txt" - {"i16x8.lt_s", TokenType::Compare, Opcode::I16X8LtS}, -#line 197 "src/lexer-keywords.txt" - {"i16x8.min_u", TokenType::Binary, Opcode::I16X8MinU}, -#line 193 "src/lexer-keywords.txt" {"i16x8.lt_u", TokenType::Compare, Opcode::I16X8LtU}, {""}, -#line 483 "src/lexer-keywords.txt" - {"memory.atomic.wait32", TokenType::AtomicWait, Opcode::MemoryAtomicWait32}, -#line 319 "src/lexer-keywords.txt" - {"i32x4.shr_s", TokenType::Binary, Opcode::I32X4ShrS}, -#line 188 "src/lexer-keywords.txt" - {"i16x8.le_s", TokenType::Compare, Opcode::I16X8LeS}, -#line 443 "src/lexer-keywords.txt" - {"i8x16.bitmask", TokenType::Unary, Opcode::I8X16Bitmask}, -#line 189 "src/lexer-keywords.txt" - {"i16x8.le_u", TokenType::Compare, Opcode::I16X8LeU}, -#line 320 "src/lexer-keywords.txt" - {"i32x4.shr_u", TokenType::Binary, Opcode::I32X4ShrU}, -#line 157 "src/lexer-keywords.txt" - {"f64x2.pmax", TokenType::Binary, Opcode::F64X2PMax}, - {""}, {""}, #line 468 "src/lexer-keywords.txt" - {"i8x16.sub_sat_s", TokenType::Binary, Opcode::I8X16SubSatS}, -#line 424 "src/lexer-keywords.txt" - {"v128.load32x2_s", TokenType::Load, Opcode::V128Load32X2S}, -#line 469 "src/lexer-keywords.txt" {"i8x16.sub_sat_u", TokenType::Binary, Opcode::I8X16SubSatU}, -#line 425 "src/lexer-keywords.txt" - {"v128.load32x2_u", TokenType::Load, Opcode::V128Load32X2U}, +#line 356 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XorU}, +#line 233 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XorU}, {""}, {""}, -#line 211 "src/lexer-keywords.txt" - {"i16x8", TokenType::I16X8}, +#line 336 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AddU}, +#line 220 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AddU}, + {""}, {""}, +#line 89 "src/lexer-keywords.txt" + {"f32x4.extract_lane", TokenType::SimdLaneOp, Opcode::F32X4ExtractLane}, +#line 492 "src/lexer-keywords.txt" + {"nan:arithmetic", TokenType::NanArithmetic}, {""}, -#line 198 "src/lexer-keywords.txt" - {"i16x8.mul", TokenType::Binary, Opcode::I16X8Mul}, -#line 561 "src/lexer-keywords.txt" - {"get_local", TokenType::LocalGet, Opcode::LocalGet}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 134 "src/lexer-keywords.txt" - {"f64.reinterpret_i64", TokenType::Convert, Opcode::F64ReinterpretI64}, +#line 298 "src/lexer-keywords.txt" + {"i32x4.extract_lane", TokenType::SimdLaneOp, Opcode::I32X4ExtractLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, -#line 583 "src/lexer-keywords.txt" - {"set_global", TokenType::GlobalSet, Opcode::GlobalSet}, - {""}, {""}, -#line 20 "src/lexer-keywords.txt" - {"array", Type::Array, TokenType::Array}, - {""}, {""}, {""}, {""}, -#line 173 "src/lexer-keywords.txt" + {""}, +#line 175 "src/lexer-keywords.txt" + {"i16x8.add", TokenType::Binary, Opcode::I16X8Add}, + {""}, {""}, {""}, +#line 337 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AndU}, +#line 221 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AndU}, +#line 317 "src/lexer-keywords.txt" + {"i32x4.shl", TokenType::Binary, Opcode::I32X4Shl}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 25 "src/lexer-keywords.txt" + {"assert_trap", TokenType::AssertTrap}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 436 "src/lexer-keywords.txt" + {"i8x16.add_sat_s", TokenType::Binary, Opcode::I8X16AddSatS}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 172 "src/lexer-keywords.txt" {"i16x8.abs", TokenType::Unary, Opcode::I16X8Abs}, -#line 340 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16OrU}, -#line 224 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16OrU}, -#line 86 "src/lexer-keywords.txt" - {"f32x4.convert_i32x4_s", TokenType::Unary, Opcode::F32X4ConvertI32X4S}, + {""}, {""}, {""}, +#line 541 "src/lexer-keywords.txt" + {"i8x16.swizzle", TokenType::Binary, Opcode::I8X16Swizzle}, {""}, -#line 87 "src/lexer-keywords.txt" - {"f32x4.convert_i32x4_u", TokenType::Unary, Opcode::F32X4ConvertI32X4U}, +#line 195 "src/lexer-keywords.txt" + {"i16x8.min_s", TokenType::Binary, Opcode::I16X8MinS}, +#line 156 "src/lexer-keywords.txt" + {"f64x2.pmax", TokenType::Binary, Opcode::F64X2PMax}, {""}, -#line 353 "src/lexer-keywords.txt" +#line 437 "src/lexer-keywords.txt" + {"i8x16.add_sat_u", TokenType::Binary, Opcode::I8X16AddSatU}, + {""}, {""}, +#line 291 "src/lexer-keywords.txt" + {"i32.wrap_i64", TokenType::Convert, Opcode::I32WrapI64}, + {""}, +#line 305 "src/lexer-keywords.txt" + {"v128.load16x4_s", TokenType::Load, Opcode::V128Load16X4S}, + {""}, {""}, {""}, +#line 119 "src/lexer-keywords.txt" + {"f64.eq", TokenType::Compare, Opcode::F64Eq}, +#line 63 "src/lexer-keywords.txt" + {"f32.eq", TokenType::Compare, Opcode::F32Eq}, + {""}, +#line 373 "src/lexer-keywords.txt" + {"i64.eq", TokenType::Compare, Opcode::I64Eq}, +#line 249 "src/lexer-keywords.txt" + {"i32.eq", TokenType::Compare, Opcode::I32Eq}, + {""}, +#line 439 "src/lexer-keywords.txt" + {"i8x16.all_true", TokenType::Unary, Opcode::I8X16AllTrue}, + {""}, {""}, {""}, {""}, {""}, +#line 306 "src/lexer-keywords.txt" + {"v128.load16x4_u", TokenType::Load, Opcode::V128Load16X4U}, +#line 513 "src/lexer-keywords.txt" + {"table.copy", TokenType::TableCopy, Opcode::TableCopy}, + {""}, {""}, {""}, +#line 352 "src/lexer-keywords.txt" {"i64.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw8CmpxchgU}, -#line 230 "src/lexer-keywords.txt" +#line 229 "src/lexer-keywords.txt" {"i32.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw8CmpxchgU}, {""}, -#line 77 "src/lexer-keywords.txt" - {"f32.reinterpret_i32", TokenType::Convert, Opcode::F32ReinterpretI32}, +#line 196 "src/lexer-keywords.txt" + {"i16x8.min_u", TokenType::Binary, Opcode::I16X8MinU}, {""}, -#line 210 "src/lexer-keywords.txt" - {"i16x8.sub", TokenType::Binary, Opcode::I16X8Sub}, - {""}, {""}, -#line 517 "src/lexer-keywords.txt" - {"table.grow", TokenType::TableGrow, Opcode::TableGrow}, +#line 349 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XorU}, {""}, {""}, -#line 306 "src/lexer-keywords.txt" - {"v128.load16x4_s", TokenType::Load, Opcode::V128Load16X4S}, +#line 179 "src/lexer-keywords.txt" + {"i16x8.bitmask", TokenType::Unary, Opcode::I16X8Bitmask}, {""}, -#line 307 "src/lexer-keywords.txt" - {"v128.load16x4_u", TokenType::Load, Opcode::V128Load16X4U}, - {""}, {""}, {""}, -#line 524 "src/lexer-keywords.txt" - {"try", TokenType::Try, Opcode::Try}, - {""}, {""}, {""}, {""}, -#line 104 "src/lexer-keywords.txt" +#line 103 "src/lexer-keywords.txt" {"f32x4.replace_lane", TokenType::SimdLaneOp, Opcode::F32X4ReplaceLane}, {""}, {""}, -#line 317 "src/lexer-keywords.txt" +#line 316 "src/lexer-keywords.txt" {"i32x4.replace_lane", TokenType::SimdLaneOp, Opcode::I32X4ReplaceLane}, - {""}, {""}, {""}, {""}, -#line 430 "src/lexer-keywords.txt" - {"i64x2.shr_s", TokenType::Binary, Opcode::I64X2ShrS}, -#line 180 "src/lexer-keywords.txt" - {"i16x8.bitmask", TokenType::Unary, Opcode::I16X8Bitmask}, -#line 501 "src/lexer-keywords.txt" - {"ref.func", TokenType::RefFunc, Opcode::RefFunc}, - {""}, -#line 431 "src/lexer-keywords.txt" - {"i64x2.shr_u", TokenType::Binary, Opcode::I64X2ShrU}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 207 "src/lexer-keywords.txt" + {"i16x8.sub_sat_s", TokenType::Binary, Opcode::I16X8SubSatS}, + {""}, {""}, {""}, +#line 143 "src/lexer-keywords.txt" + {"f64x2.eq", TokenType::Compare, Opcode::F64X2Eq}, +#line 338 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw16CmpxchgU}, +#line 222 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw16CmpxchgU}, {""}, {""}, +#line 539 "src/lexer-keywords.txt" + {"v128.load8_splat", TokenType::Load, Opcode::V128Load8Splat}, + {""}, {""}, {""}, {""}, {""}, {""}, #line 208 "src/lexer-keywords.txt" - {"i16x8.sub_sat_s", TokenType::Binary, Opcode::I16X8SubSatS}, - {""}, -#line 209 "src/lexer-keywords.txt" {"i16x8.sub_sat_u", TokenType::Binary, Opcode::I16X8SubSatU}, -#line 490 "src/lexer-keywords.txt" - {"memory", TokenType::Memory}, -#line 190 "src/lexer-keywords.txt" - {"v128.load8x8_s", TokenType::Load, Opcode::V128Load8X8S}, - {""}, {""}, {""}, -#line 191 "src/lexer-keywords.txt" - {"v128.load8x8_u", TokenType::Load, Opcode::V128Load8X8U}, {""}, {""}, -#line 444 "src/lexer-keywords.txt" - {"i8x16.eq", TokenType::Compare, Opcode::I8X16Eq}, -#line 439 "src/lexer-keywords.txt" - {"i8x16.add", TokenType::Binary, Opcode::I8X16Add}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, -#line 437 "src/lexer-keywords.txt" - {"i8x16.add_sat_s", TokenType::Binary, Opcode::I8X16AddSatS}, -#line 536 "src/lexer-keywords.txt" - {"v128.xor", TokenType::Binary, Opcode::V128Xor}, -#line 438 "src/lexer-keywords.txt" - {"i8x16.add_sat_u", TokenType::Binary, Opcode::I8X16AddSatU}, - {""}, {""}, {""}, {""}, -#line 354 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8OrU}, -#line 231 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8OrU}, - {""}, {""}, {""}, {""}, -#line 292 "src/lexer-keywords.txt" - {"i32.wrap_i64", TokenType::Convert, Opcode::I32WrapI64}, - {""}, {""}, {""}, {""}, -#line 28 "src/lexer-keywords.txt" - {"binary", TokenType::Bin}, +#line 44 "src/lexer-keywords.txt" + {"elem.drop", TokenType::ElemDrop, Opcode::ElemDrop}, + {""}, {""}, +#line 210 "src/lexer-keywords.txt" + {"i16x8", TokenType::I16X8}, + {""}, {""}, +#line 38 "src/lexer-keywords.txt" + {"data.drop", TokenType::DataDrop, Opcode::DataDrop}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 398 "src/lexer-keywords.txt" + {"i64.popcnt", TokenType::Unary, Opcode::I64Popcnt}, +#line 269 "src/lexer-keywords.txt" + {"i32.popcnt", TokenType::Unary, Opcode::I32Popcnt}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 560 "src/lexer-keywords.txt" + {"get_local", TokenType::LocalGet, Opcode::LocalGet}, {""}, -#line 350 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XorU}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 440 "src/lexer-keywords.txt" - {"i8x16.all_true", TokenType::Unary, Opcode::I8X16AllTrue}, -#line 349 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XchgU}, - {""}, {""}, {""}, -#line 159 "src/lexer-keywords.txt" - {"f64x2.replace_lane", TokenType::SimdLaneOp, Opcode::F64X2ReplaceLane}, - {""}, {""}, -#line 428 "src/lexer-keywords.txt" - {"i64x2.replace_lane", TokenType::SimdLaneOp, Opcode::I64X2ReplaceLane}, - {""}, {""}, {""}, {""}, -#line 540 "src/lexer-keywords.txt" - {"v128.load8_splat", TokenType::Load, Opcode::V128Load8Splat}, - {""}, {""}, {""}, -#line 504 "src/lexer-keywords.txt" - {"register", TokenType::Register}, +#line 489 "src/lexer-keywords.txt" + {"memory", TokenType::Memory}, +#line 95 "src/lexer-keywords.txt" + {"f32x4.max", TokenType::Binary, Opcode::F32X4Max}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, -#line 181 "src/lexer-keywords.txt" - {"i16x8.eq", TokenType::Compare, Opcode::I16X8Eq}, -#line 176 "src/lexer-keywords.txt" - {"i16x8.add", TokenType::Binary, Opcode::I16X8Add}, - {""}, {""}, -#line 25 "src/lexer-keywords.txt" - {"assert_trap", TokenType::AssertTrap}, {""}, -#line 539 "src/lexer-keywords.txt" - {"v128.load64_splat", TokenType::Load, Opcode::V128Load64Splat}, +#line 197 "src/lexer-keywords.txt" + {"i16x8.mul", TokenType::Binary, Opcode::I16X8Mul}, + {""}, +#line 173 "src/lexer-keywords.txt" + {"i16x8.add_sat_s", TokenType::Binary, Opcode::I16X8AddSatS}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, #line 538 "src/lexer-keywords.txt" + {"v128.load64_splat", TokenType::Load, Opcode::V128Load64Splat}, +#line 537 "src/lexer-keywords.txt" {"v128.load32_splat", TokenType::Load, Opcode::V128Load32Splat}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 174 "src/lexer-keywords.txt" - {"i16x8.add_sat_s", TokenType::Binary, Opcode::I16X8AddSatS}, {""}, -#line 175 "src/lexer-keywords.txt" +#line 174 "src/lexer-keywords.txt" {"i16x8.add_sat_u", TokenType::Binary, Opcode::I16X8AddSatU}, -#line 343 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XorU}, -#line 227 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XorU}, - {""}, {""}, {""}, -#line 333 "src/lexer-keywords.txt" - {"i64.atomic.load16_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad16U}, -#line 218 "src/lexer-keywords.txt" - {"i32.atomic.load16_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad16U}, -#line 526 "src/lexer-keywords.txt" - {"unreachable", TokenType::Unreachable, Opcode::Unreachable}, - {""}, -#line 342 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XchgU}, -#line 226 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XchgU}, - {""}, {""}, -#line 324 "src/lexer-keywords.txt" - {"i32x4.trunc_sat_f32x4_s", TokenType::Unary, Opcode::I32X4TruncSatF32X4S}, - {""}, -#line 325 "src/lexer-keywords.txt" - {"i32x4.trunc_sat_f32x4_u", TokenType::Unary, Opcode::I32X4TruncSatF32X4U}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 455 "src/lexer-keywords.txt" - {"i8x16.max_s", TokenType::Binary, Opcode::I8X16MaxS}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 456 "src/lexer-keywords.txt" - {"i8x16.max_u", TokenType::Binary, Opcode::I8X16MaxU}, +#line 348 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XchgU}, {""}, -#line 121 "src/lexer-keywords.txt" - {"f64.floor", TokenType::Unary, Opcode::F64Floor}, -#line 65 "src/lexer-keywords.txt" - {"f32.floor", TokenType::Unary, Opcode::F32Floor}, -#line 559 "src/lexer-keywords.txt" - {"f64.reinterpret/i64", TokenType::Convert, Opcode::F64ReinterpretI64}, - {""}, {""}, -#line 177 "src/lexer-keywords.txt" +#line 176 "src/lexer-keywords.txt" {"i16x8.all_true", TokenType::Unary, Opcode::I16X8AllTrue}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 537 "src/lexer-keywords.txt" - {"v128.load16_splat", TokenType::Load, Opcode::V128Load16Splat}, - {""}, -#line 542 "src/lexer-keywords.txt" - {"i8x16.swizzle", TokenType::Binary, Opcode::I8X16Swizzle}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 553 "src/lexer-keywords.txt" - {"f32.reinterpret/i32", TokenType::Convert, Opcode::F32ReinterpretI32}, -#line 493 "src/lexer-keywords.txt" - {"nan:arithmetic", TokenType::NanArithmetic}, - {""}, -#line 357 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XorU}, -#line 234 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XorU}, +#line 189 "src/lexer-keywords.txt" + {"v128.load8x8_s", TokenType::Load, Opcode::V128Load8X8S}, + {""}, {""}, {""}, {""}, {""}, +#line 342 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XorU}, +#line 226 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XorU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 270 "src/lexer-keywords.txt" + {"i32.reinterpret_f32", TokenType::Convert, Opcode::I32ReinterpretF32}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 367 "src/lexer-keywords.txt" + {""}, {""}, +#line 190 "src/lexer-keywords.txt" + {"v128.load8x8_u", TokenType::Load, Opcode::V128Load8X8U}, + {""}, {""}, +#line 543 "src/lexer-keywords.txt" + {"atomic.notify", TokenType::AtomicNotify, Opcode::MemoryAtomicNotify}, + {""}, {""}, +#line 366 "src/lexer-keywords.txt" {"i64.atomic.store8", TokenType::AtomicStore, Opcode::I64AtomicStore8}, -#line 243 "src/lexer-keywords.txt" +#line 242 "src/lexer-keywords.txt" {"i32.atomic.store8", TokenType::AtomicStore, Opcode::I32AtomicStore8}, {""}, {""}, -#line 514 "src/lexer-keywords.txt" - {"table.copy", TokenType::TableCopy, Opcode::TableCopy}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 194 "src/lexer-keywords.txt" - {"i16x8.max_s", TokenType::Binary, Opcode::I16X8MaxS}, - {""}, {""}, {""}, -#line 195 "src/lexer-keywords.txt" - {"i16x8.max_u", TokenType::Binary, Opcode::I16X8MaxU}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 571 "src/lexer-keywords.txt" - {"i32.wrap/i64", TokenType::Convert, Opcode::I32WrapI64}, - {""}, {""}, {""}, {""}, {""}, -#line 467 "src/lexer-keywords.txt" - {"i8x16.splat", TokenType::Unary, Opcode::I8X16Splat}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 323 "src/lexer-keywords.txt" + {"i32x4.trunc_sat_f32x4_s", TokenType::Unary, Opcode::I32X4TruncSatF32X4S}, +#line 101 "src/lexer-keywords.txt" + {"f32x4.pmax", TokenType::Binary, Opcode::F32X4PMax}, + {""}, {""}, {""}, {""}, +#line 363 "src/lexer-keywords.txt" + {"i64.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I64AtomicRmwXor}, +#line 240 "src/lexer-keywords.txt" + {"i32.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I32AtomicRmwXor}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 100 "src/lexer-keywords.txt" - {"f32x4.neg", TokenType::Unary, Opcode::F32X4Neg}, +#line 324 "src/lexer-keywords.txt" + {"i32x4.trunc_sat_f32x4_u", TokenType::Unary, Opcode::I32X4TruncSatF32X4U}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 466 "src/lexer-keywords.txt" + {"i8x16.splat", TokenType::Unary, Opcode::I8X16Splat}, {""}, {""}, -#line 315 "src/lexer-keywords.txt" - {"i32x4.neg", TokenType::Unary, Opcode::I32X4Neg}, - {""}, -#line 578 "src/lexer-keywords.txt" - {"i64.trunc_s:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64S}, -#line 566 "src/lexer-keywords.txt" - {"i32.trunc_s:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64S}, -#line 582 "src/lexer-keywords.txt" - {"i64.trunc_u:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64U}, #line 570 "src/lexer-keywords.txt" - {"i32.trunc_u:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64U}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 577 "src/lexer-keywords.txt" + {"i32.wrap/i64", TokenType::Convert, Opcode::I32WrapI64}, + {""}, {""}, {""}, +#line 130 "src/lexer-keywords.txt" + {"f64.neg", TokenType::Unary, Opcode::F64Neg}, +#line 74 "src/lexer-keywords.txt" + {"f32.neg", TokenType::Unary, Opcode::F32Neg}, + {""}, +#line 482 "src/lexer-keywords.txt" + {"memory.atomic.wait32", TokenType::AtomicWait, Opcode::MemoryAtomicWait32}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 576 "src/lexer-keywords.txt" {"i64.trunc_s:sat/f32", TokenType::Convert, Opcode::I64TruncSatF32S}, -#line 565 "src/lexer-keywords.txt" +#line 564 "src/lexer-keywords.txt" {"i32.trunc_s:sat/f32", TokenType::Convert, Opcode::I32TruncSatF32S}, -#line 581 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 536 "src/lexer-keywords.txt" + {"v128.load16_splat", TokenType::Load, Opcode::V128Load16Splat}, +#line 88 "src/lexer-keywords.txt" + {"f32x4.eq", TokenType::Compare, Opcode::F32X4Eq}, + {""}, {""}, +#line 297 "src/lexer-keywords.txt" + {"i32x4.eq", TokenType::Compare, Opcode::I32X4Eq}, + {""}, {""}, +#line 580 "src/lexer-keywords.txt" {"i64.trunc_u:sat/f32", TokenType::Convert, Opcode::I64TruncSatF32U}, -#line 569 "src/lexer-keywords.txt" +#line 568 "src/lexer-keywords.txt" {"i32.trunc_u:sat/f32", TokenType::Convert, Opcode::I32TruncSatF32U}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 207 "src/lexer-keywords.txt" - {"i16x8.splat", TokenType::Unary, Opcode::I16X8Splat}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 131 "src/lexer-keywords.txt" - {"f64.neg", TokenType::Unary, Opcode::F64Neg}, -#line 75 "src/lexer-keywords.txt" - {"f32.neg", TokenType::Unary, Opcode::F32Neg}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 487 "src/lexer-keywords.txt" - {"memory.grow", TokenType::MemoryGrow, Opcode::MemoryGrow}, -#line 482 "src/lexer-keywords.txt" - {"memory.atomic.notify", TokenType::AtomicNotify, Opcode::MemoryAtomicNotify}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 341 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XchgU}, +#line 225 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XchgU}, + {""}, +#line 399 "src/lexer-keywords.txt" + {"i64.reinterpret_f64", TokenType::Convert, Opcode::I64ReinterpretF64}, + {""}, {""}, {""}, {""}, +#line 454 "src/lexer-keywords.txt" + {"i8x16.max_s", TokenType::Binary, Opcode::I8X16MaxS}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 155 "src/lexer-keywords.txt" +#line 37 "src/lexer-keywords.txt" + {"current_memory", TokenType::MemorySize, Opcode::MemorySize}, + {""}, {""}, {""}, +#line 154 "src/lexer-keywords.txt" {"f64x2.neg", TokenType::Unary, Opcode::F64X2Neg}, {""}, {""}, -#line 427 "src/lexer-keywords.txt" +#line 426 "src/lexer-keywords.txt" {"i64x2.neg", TokenType::Unary, Opcode::I64X2Neg}, - {""}, {""}, {""}, -#line 544 "src/lexer-keywords.txt" - {"atomic.notify", TokenType::AtomicNotify, Opcode::MemoryAtomicNotify}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 455 "src/lexer-keywords.txt" + {"i8x16.max_u", TokenType::Binary, Opcode::I8X16MaxU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 449 "src/lexer-keywords.txt" + {""}, {""}, +#line 464 "src/lexer-keywords.txt" + {"i8x16.shr_s", TokenType::Binary, Opcode::I8X16ShrS}, +#line 483 "src/lexer-keywords.txt" + {"memory.atomic.wait64", TokenType::AtomicWait, Opcode::MemoryAtomicWait64}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 446 "src/lexer-keywords.txt" + {"i8x16.ge_s", TokenType::Compare, Opcode::I8X16GeS}, +#line 577 "src/lexer-keywords.txt" + {"i64.trunc_s:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64S}, +#line 565 "src/lexer-keywords.txt" + {"i32.trunc_s:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64S}, +#line 448 "src/lexer-keywords.txt" {"i8x16.gt_s", TokenType::Compare, Opcode::I8X16GtS}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 206 "src/lexer-keywords.txt" + {"i16x8.splat", TokenType::Unary, Opcode::I16X8Splat}, + {""}, {""}, +#line 440 "src/lexer-keywords.txt" + {"i8x16.any_true", TokenType::Unary, Opcode::I8X16AnyTrue}, +#line 168 "src/lexer-keywords.txt" + {"global.get", TokenType::GlobalGet, Opcode::GlobalGet}, {""}, -#line 450 "src/lexer-keywords.txt" - {"i8x16.gt_u", TokenType::Compare, Opcode::I8X16GtU}, - {""}, {""}, {""}, #line 447 "src/lexer-keywords.txt" - {"i8x16.ge_s", TokenType::Compare, Opcode::I8X16GeS}, - {""}, -#line 448 "src/lexer-keywords.txt" {"i8x16.ge_u", TokenType::Compare, Opcode::I8X16GeU}, +#line 581 "src/lexer-keywords.txt" + {"i64.trunc_u:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64U}, +#line 569 "src/lexer-keywords.txt" + {"i32.trunc_u:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64U}, +#line 449 "src/lexer-keywords.txt" + {"i8x16.gt_u", TokenType::Compare, Opcode::I8X16GtU}, + {""}, {""}, {""}, {""}, +#line 465 "src/lexer-keywords.txt" + {"i8x16.shr_u", TokenType::Binary, Opcode::I8X16ShrU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, -#line 43 "src/lexer-keywords.txt" - {"elem.drop", TokenType::ElemDrop, Opcode::ElemDrop}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 445 "src/lexer-keywords.txt" - {"i8x16.extract_lane_s", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneS}, - {""}, -#line 446 "src/lexer-keywords.txt" - {"i8x16.extract_lane_u", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneU}, -#line 169 "src/lexer-keywords.txt" - {"global.get", TokenType::GlobalGet, Opcode::GlobalGet}, - {""}, {""}, {""}, -#line 364 "src/lexer-keywords.txt" - {"i64.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I64AtomicRmwXor}, -#line 241 "src/lexer-keywords.txt" - {"i32.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I32AtomicRmwXor}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 561 "src/lexer-keywords.txt" + {"i32.reinterpret/f32", TokenType::Convert, Opcode::I32ReinterpretF32}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 193 "src/lexer-keywords.txt" + {"i16x8.max_s", TokenType::Binary, Opcode::I16X8MaxS}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 38 "src/lexer-keywords.txt" - {"data.drop", TokenType::DataDrop, Opcode::DataDrop}, +#line 540 "src/lexer-keywords.txt" + {"i8x16.shuffle", TokenType::SimdShuffleOp, Opcode::I8X16Shuffle}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 186 "src/lexer-keywords.txt" - {"i16x8.gt_s", TokenType::Compare, Opcode::I16X8GtS}, - {""}, -#line 187 "src/lexer-keywords.txt" - {"i16x8.gt_u", TokenType::Compare, Opcode::I16X8GtU}, +#line 194 "src/lexer-keywords.txt" + {"i16x8.max_u", TokenType::Binary, Opcode::I16X8MaxU}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 444 "src/lexer-keywords.txt" + {"i8x16.extract_lane_s", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneS}, + {""}, {""}, {""}, {""}, +#line 463 "src/lexer-keywords.txt" + {"i8x16.shl", TokenType::Binary, Opcode::I8X16Shl}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 204 "src/lexer-keywords.txt" + {"i16x8.shr_s", TokenType::Binary, Opcode::I16X8ShrS}, {""}, {""}, {""}, -#line 184 "src/lexer-keywords.txt" - {"i16x8.ge_s", TokenType::Compare, Opcode::I16X8GeS}, - {""}, -#line 185 "src/lexer-keywords.txt" - {"i16x8.ge_u", TokenType::Compare, Opcode::I16X8GeU}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 445 "src/lexer-keywords.txt" + {"i8x16.extract_lane_u", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneU}, {""}, {""}, {""}, -#line 441 "src/lexer-keywords.txt" - {"i8x16.any_true", TokenType::Unary, Opcode::I8X16AnyTrue}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 464 "src/lexer-keywords.txt" - {"i8x16.shl", TokenType::Binary, Opcode::I8X16Shl}, - {""}, -#line 182 "src/lexer-keywords.txt" - {"i16x8.extract_lane_s", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneS}, - {""}, #line 183 "src/lexer-keywords.txt" - {"i16x8.extract_lane_u", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneU}, + {"i16x8.ge_s", TokenType::Compare, Opcode::I16X8GeS}, + {""}, {""}, +#line 185 "src/lexer-keywords.txt" + {"i16x8.gt_s", TokenType::Compare, Opcode::I16X8GtS}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, -#line 400 "src/lexer-keywords.txt" - {"i64.reinterpret_f64", TokenType::Convert, Opcode::I64ReinterpretF64}, - {""}, -#line 37 "src/lexer-keywords.txt" - {"current_memory", TokenType::MemorySize, Opcode::MemorySize}, - {""}, {""}, {""}, {""}, {""}, -#line 541 "src/lexer-keywords.txt" - {"i8x16.shuffle", TokenType::SimdShuffleOp, Opcode::I8X16Shuffle}, - {""}, {""}, {""}, {""}, {""}, -#line 560 "src/lexer-keywords.txt" - {"get_global", TokenType::GlobalGet, Opcode::GlobalGet}, - {""}, {""}, {""}, {""}, -#line 214 "src/lexer-keywords.txt" - {"i16x8.widen_low_i8x16_s", TokenType::Unary, Opcode::I16X8WidenLowI8X16S}, +#line 177 "src/lexer-keywords.txt" + {"i16x8.any_true", TokenType::Unary, Opcode::I16X8AnyTrue}, + {""}, {""}, +#line 184 "src/lexer-keywords.txt" + {"i16x8.ge_u", TokenType::Compare, Opcode::I16X8GeU}, + {""}, {""}, +#line 186 "src/lexer-keywords.txt" + {"i16x8.gt_u", TokenType::Compare, Opcode::I16X8GtU}, {""}, -#line 215 "src/lexer-keywords.txt" - {"i16x8.widen_low_i8x16_u", TokenType::Unary, Opcode::I16X8WidenLowI8X16U}, +#line 573 "src/lexer-keywords.txt" + {"i64.reinterpret/f64", TokenType::Convert, Opcode::I64ReinterpretF64}, {""}, {""}, -#line 442 "src/lexer-keywords.txt" - {"i8x16.avgr_u", TokenType::Binary, Opcode::I8X16AvgrU}, - {""}, {""}, {""}, {""}, {""}, -#line 271 "src/lexer-keywords.txt" - {"i32.reinterpret_f32", TokenType::Convert, Opcode::I32ReinterpretF32}, +#line 205 "src/lexer-keywords.txt" + {"i16x8.shr_u", TokenType::Binary, Opcode::I16X8ShrU}, +#line 99 "src/lexer-keywords.txt" + {"f32x4.neg", TokenType::Unary, Opcode::F32X4Neg}, + {""}, {""}, +#line 314 "src/lexer-keywords.txt" + {"i32x4.neg", TokenType::Unary, Opcode::I32X4Neg}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 559 "src/lexer-keywords.txt" + {"get_global", TokenType::GlobalGet, Opcode::GlobalGet}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 178 "src/lexer-keywords.txt" - {"i16x8.any_true", TokenType::Unary, Opcode::I16X8AnyTrue}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 204 "src/lexer-keywords.txt" - {"i16x8.shl", TokenType::Binary, Opcode::I16X8Shl}, +#line 462 "src/lexer-keywords.txt" + {"i8x16.replace_lane", TokenType::SimdLaneOp, Opcode::I8X16ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 465 "src/lexer-keywords.txt" - {"i8x16.shr_s", TokenType::Binary, Opcode::I8X16ShrS}, - {""}, {""}, {""}, -#line 466 "src/lexer-keywords.txt" - {"i8x16.shr_u", TokenType::Binary, Opcode::I8X16ShrU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 481 "src/lexer-keywords.txt" + {"memory.atomic.notify", TokenType::AtomicNotify, Opcode::MemoryAtomicNotify}, {""}, {""}, -#line 179 "src/lexer-keywords.txt" - {"i16x8.avgr_u", TokenType::Binary, Opcode::I16X8AvgrU}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 486 "src/lexer-keywords.txt" + {"memory.grow", TokenType::MemoryGrow, Opcode::MemoryGrow}, + {""}, {""}, {""}, +#line 117 "src/lexer-keywords.txt" + {"f64.copysign", TokenType::Binary, Opcode::F64Copysign}, +#line 60 "src/lexer-keywords.txt" + {"f32.copysign", TokenType::Binary, Opcode::F32Copysign}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 181 "src/lexer-keywords.txt" + {"i16x8.extract_lane_s", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneS}, + {""}, {""}, {""}, {""}, +#line 203 "src/lexer-keywords.txt" + {"i16x8.shl", TokenType::Binary, Opcode::I16X8Shl}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 182 "src/lexer-keywords.txt" + {"i16x8.extract_lane_u", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 441 "src/lexer-keywords.txt" + {"i8x16.avgr_u", TokenType::Binary, Opcode::I8X16AvgrU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 198 "src/lexer-keywords.txt" + {"i16x8.narrow_i32x4_s", TokenType::Binary, Opcode::I16X8NarrowI32X4S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 463 "src/lexer-keywords.txt" - {"i8x16.replace_lane", TokenType::SimdLaneOp, Opcode::I8X16ReplaceLane}, - {""}, {""}, {""}, -#line 205 "src/lexer-keywords.txt" - {"i16x8.shr_s", TokenType::Binary, Opcode::I16X8ShrS}, - {""}, {""}, {""}, -#line 206 "src/lexer-keywords.txt" - {"i16x8.shr_u", TokenType::Binary, Opcode::I16X8ShrU}, - {""}, {""}, {""}, -#line 485 "src/lexer-keywords.txt" - {"memory.copy", TokenType::MemoryCopy, Opcode::MemoryCopy}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 356 "src/lexer-keywords.txt" +#line 199 "src/lexer-keywords.txt" + {"i16x8.narrow_i32x4_u", TokenType::Binary, Opcode::I16X8NarrowI32X4U}, +#line 355 "src/lexer-keywords.txt" {"i64.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XchgU}, -#line 233 "src/lexer-keywords.txt" +#line 232 "src/lexer-keywords.txt" {"i32.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XchgU}, {""}, {""}, {""}, {""}, {""}, -#line 199 "src/lexer-keywords.txt" - {"i16x8.narrow_i32x4_s", TokenType::Binary, Opcode::I16X8NarrowI32X4S}, - {""}, -#line 200 "src/lexer-keywords.txt" - {"i16x8.narrow_i32x4_u", TokenType::Binary, Opcode::I16X8NarrowI32X4U}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 574 "src/lexer-keywords.txt" - {"i64.reinterpret/f64", TokenType::Convert, Opcode::I64ReinterpretF64}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 118 "src/lexer-keywords.txt" - {"f64.copysign", TokenType::Binary, Opcode::F64Copysign}, -#line 61 "src/lexer-keywords.txt" - {"f32.copysign", TokenType::Binary, Opcode::F32Copysign}, +#line 202 "src/lexer-keywords.txt" + {"i16x8.replace_lane", TokenType::SimdLaneOp, Opcode::I16X8ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, -#line 562 "src/lexer-keywords.txt" - {"i32.reinterpret/f32", TokenType::Convert, Opcode::I32ReinterpretF32}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, -#line 203 "src/lexer-keywords.txt" - {"i16x8.replace_lane", TokenType::SimdLaneOp, Opcode::I16X8ReplaceLane}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 459 "src/lexer-keywords.txt" - {"i8x16.narrow_i16x8_s", TokenType::Binary, Opcode::I8X16NarrowI16X8S}, {""}, -#line 460 "src/lexer-keywords.txt" - {"i8x16.narrow_i16x8_u", TokenType::Binary, Opcode::I8X16NarrowI16X8U}, +#line 325 "src/lexer-keywords.txt" + {"i32x4.widen_high_i16x8_s", TokenType::Unary, Opcode::I32X4WidenHighI16X8S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 484 "src/lexer-keywords.txt" + {"memory.copy", TokenType::MemoryCopy, Opcode::MemoryCopy}, + {""}, {""}, {""}, {""}, {""}, +#line 326 "src/lexer-keywords.txt" + {"i32x4.widen_high_i16x8_u", TokenType::Unary, Opcode::I32X4WidenHighI16X8U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 172 "src/lexer-keywords.txt" - {"grow_memory", TokenType::MemoryGrow, Opcode::MemoryGrow}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 443 "src/lexer-keywords.txt" + {"i8x16.eq", TokenType::Compare, Opcode::I8X16Eq}, + {""}, {""}, {""}, +#line 213 "src/lexer-keywords.txt" + {"i16x8.widen_low_i8x16_s", TokenType::Unary, Opcode::I16X8WidenLowI8X16S}, +#line 178 "src/lexer-keywords.txt" + {"i16x8.avgr_u", TokenType::Binary, Opcode::I16X8AvgrU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 171 "src/lexer-keywords.txt" + {"grow_memory", TokenType::MemoryGrow, Opcode::MemoryGrow}, + {""}, {""}, +#line 214 "src/lexer-keywords.txt" + {"i16x8.widen_low_i8x16_u", TokenType::Unary, Opcode::I16X8WidenLowI8X16U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 326 "src/lexer-keywords.txt" - {"i32x4.widen_high_i16x8_s", TokenType::Unary, Opcode::I32X4WidenHighI16X8S}, - {""}, -#line 327 "src/lexer-keywords.txt" - {"i32x4.widen_high_i16x8_u", TokenType::Unary, Opcode::I32X4WidenHighI16X8U}, - {""}, {""}, {""}, {""}, -#line 360 "src/lexer-keywords.txt" - {"i64.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmwCmpxchg}, -#line 237 "src/lexer-keywords.txt" - {"i32.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmwCmpxchg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1634,25 +1620,36 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 180 "src/lexer-keywords.txt" + {"i16x8.eq", TokenType::Compare, Opcode::I16X8Eq}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 458 "src/lexer-keywords.txt" + {"i8x16.narrow_i16x8_s", TokenType::Binary, Opcode::I8X16NarrowI16X8S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 459 "src/lexer-keywords.txt" + {"i8x16.narrow_i16x8_u", TokenType::Binary, Opcode::I8X16NarrowI16X8U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 461 "src/lexer-keywords.txt" - {"i8x16.neg", TokenType::Unary, Opcode::I8X16Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 359 "src/lexer-keywords.txt" + {"i64.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmwCmpxchg}, +#line 236 "src/lexer-keywords.txt" + {"i32.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmwCmpxchg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 460 "src/lexer-keywords.txt" + {"i8x16.neg", TokenType::Unary, Opcode::I8X16Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 201 "src/lexer-keywords.txt" - {"i16x8.neg", TokenType::Unary, Opcode::I16X8Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1663,6 +1660,9 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, +#line 200 "src/lexer-keywords.txt" + {"i16x8.neg", TokenType::Unary, Opcode::I16X8Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1697,12 +1697,6 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 212 "src/lexer-keywords.txt" - {"i16x8.widen_high_i8x16_s", TokenType::Unary, Opcode::I16X8WidenHighI8X16S}, - {""}, -#line 213 "src/lexer-keywords.txt" - {"i16x8.widen_high_i8x16_u", TokenType::Unary, Opcode::I16X8WidenHighI8X16U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1715,17 +1709,23 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 211 "src/lexer-keywords.txt" + {"i16x8.widen_high_i8x16_s", TokenType::Unary, Opcode::I16X8WidenHighI8X16S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 212 "src/lexer-keywords.txt" + {"i16x8.widen_high_i8x16_u", TokenType::Unary, Opcode::I16X8WidenHighI8X16U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, -#line 363 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, +#line 362 "src/lexer-keywords.txt" {"i64.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I64AtomicRmwXchg}, -#line 240 "src/lexer-keywords.txt" +#line 239 "src/lexer-keywords.txt" {"i32.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I32AtomicRmwXchg} }; diff --git a/src/resolve-names.cc b/src/resolve-names.cc index 59bb04935..46f397e31 100644 --- a/src/resolve-names.cc +++ b/src/resolve-names.cc @@ -40,10 +40,11 @@ class NameResolver : public ExprVisitor::DelegateNop { Result EndBlockExpr(BlockExpr*) override; Result OnBrExpr(BrExpr*) override; Result OnBrIfExpr(BrIfExpr*) override; - Result OnBrOnExnExpr(BrOnExnExpr*) override; Result OnBrTableExpr(BrTableExpr*) override; Result OnCallExpr(CallExpr*) override; Result OnCallIndirectExpr(CallIndirectExpr*) override; + Result OnCatchExpr(TryExpr*, Catch*) override; + Result OnDelegateExpr(TryExpr*) override; Result OnReturnCallExpr(ReturnCallExpr *) override; Result OnReturnCallIndirectExpr(ReturnCallIndirectExpr*) override; Result OnGlobalGetExpr(GlobalGetExpr*) override; @@ -69,6 +70,7 @@ class NameResolver : public ExprVisitor::DelegateNop { Result BeginTryExpr(TryExpr*) override; Result EndTryExpr(TryExpr*) override; Result OnThrowExpr(ThrowExpr*) override; + Result OnRethrowExpr(RethrowExpr*) override; private: void PrintError(const Location* loc, const char* fmt, ...); @@ -265,12 +267,6 @@ Result NameResolver::OnBrIfExpr(BrIfExpr* expr) { return Result::Ok; } -Result NameResolver::OnBrOnExnExpr(BrOnExnExpr* expr) { - ResolveLabelVar(&expr->label_var); - ResolveEventVar(&expr->event_var); - return Result::Ok; -} - Result NameResolver::OnBrTableExpr(BrTableExpr* expr) { for (Var& target : expr->targets) ResolveLabelVar(&target); @@ -408,11 +404,30 @@ Result NameResolver::EndTryExpr(TryExpr*) { return Result::Ok; } +Result NameResolver::OnCatchExpr(TryExpr*, Catch* catch_) { + if (!catch_->IsCatchAll()) { + ResolveEventVar(&catch_->var); + } + return Result::Ok; +} + +Result NameResolver::OnDelegateExpr(TryExpr* expr) { + ResolveLabelVar(&expr->delegate_target); + return Result::Ok; +} + Result NameResolver::OnThrowExpr(ThrowExpr* expr) { ResolveEventVar(&expr->var); return Result::Ok; } +Result NameResolver::OnRethrowExpr(RethrowExpr* expr) { + // Note: the variable refers to corresponding (enclosing) catch, using the try + // block label for context. + ResolveLabelVar(&expr->var); + return Result::Ok; +} + void NameResolver::VisitFunc(Func* func) { current_func_ = func; if (func->decl.has_func_type) { diff --git a/src/shared-validator.cc b/src/shared-validator.cc index 9b928c04e..5d3b8acfd 100644 --- a/src/shared-validator.cc +++ b/src/shared-validator.cc @@ -716,17 +716,6 @@ Result SharedValidator::OnBrIf(const Location& loc, Var depth) { return result; } -Result SharedValidator::OnBrOnExn(const Location& loc, - Var depth, - Var event_var) { - Result result = Result::Ok; - expr_loc_ = &loc; - EventType event_type; - result |= CheckEventIndex(event_var, &event_type); - result |= typechecker_.OnBrOnExn(depth.index(), event_type.params); - return result; -} - Result SharedValidator::BeginBrTable(const Location& loc) { Result result = Result::Ok; expr_loc_ = &loc; @@ -769,10 +758,19 @@ Result SharedValidator::OnCallIndirect(const Location& loc, return result; } -Result SharedValidator::OnCatch(const Location& loc) { +Result SharedValidator::OnCatch(const Location& loc, + Var event_var, + bool is_catch_all) { Result result = Result::Ok; expr_loc_ = &loc; - result |= typechecker_.OnCatch(); + if (is_catch_all) { + TypeVector empty; + result |= typechecker_.OnCatch(empty); + } else { + EventType event_type; + result |= CheckEventIndex(event_var, &event_type); + result |= typechecker_.OnCatch(event_type.params); + } return result; } @@ -805,6 +803,13 @@ Result SharedValidator::OnDataDrop(const Location& loc, Var segment_var) { return result; } +Result SharedValidator::OnDelegate(const Location& loc, Var depth) { + Result result = Result::Ok; + expr_loc_ = &loc; + result |= typechecker_.OnDelegate(depth.index()); + return result; +} + Result SharedValidator::OnDrop(const Location& loc) { Result result = Result::Ok; expr_loc_ = &loc; @@ -1000,10 +1005,10 @@ Result SharedValidator::OnRefNull(const Location& loc, Type type) { return result; } -Result SharedValidator::OnRethrow(const Location& loc) { +Result SharedValidator::OnRethrow(const Location& loc, Var depth) { Result result = Result::Ok; expr_loc_ = &loc; - result |= typechecker_.OnRethrow(); + result |= typechecker_.OnRethrow(depth.index()); return result; } @@ -1193,4 +1198,11 @@ Result SharedValidator::OnUnreachable(const Location& loc) { return result; } +Result SharedValidator::OnUnwind(const Location& loc) { + Result result = Result::Ok; + expr_loc_ = &loc; + result |= typechecker_.OnUnwind(); + return result; +} + } // namespace wabt diff --git a/src/shared-validator.h b/src/shared-validator.h index f0f9a84be..456693bf0 100644 --- a/src/shared-validator.h +++ b/src/shared-validator.h @@ -119,17 +119,17 @@ class SharedValidator { Result OnBlock(const Location&, Type sig_type); Result OnBr(const Location&, Var depth); Result OnBrIf(const Location&, Var depth); - Result OnBrOnExn(const Location&, Var depth, Var event_index); Result BeginBrTable(const Location&); Result OnBrTableTarget(const Location&, Var depth); Result EndBrTable(const Location&); Result OnCall(const Location&, Var func_var); Result OnCallIndirect(const Location&, Var sig_var, Var table_var); - Result OnCatch(const Location&); + Result OnCatch(const Location&, Var event_var, bool is_catch_all); Result OnCompare(const Location&, Opcode); Result OnConst(const Location&, Type); Result OnConvert(const Location&, Opcode); Result OnDataDrop(const Location&, Var segment_var); + Result OnDelegate(const Location&, Var depth); Result OnDrop(const Location&); Result OnElemDrop(const Location&, Var segment_var); Result OnElse(const Location&); @@ -152,7 +152,7 @@ class SharedValidator { Result OnRefFunc(const Location&, Var func_var); Result OnRefIsNull(const Location&); Result OnRefNull(const Location&, Type type); - Result OnRethrow(const Location&); + Result OnRethrow(const Location&, Var depth); Result OnReturnCall(const Location&, Var func_var); Result OnReturnCallIndirect(const Location&, Var sig_var, Var table_var); Result OnReturn(const Location&); @@ -172,6 +172,7 @@ class SharedValidator { Result OnTry(const Location&, Type sig_type); Result OnUnary(const Location&, Opcode); Result OnUnreachable(const Location&); + Result OnUnwind(const Location&); private: struct FuncType { diff --git a/src/token.def b/src/token.def index c0925123e..e1123356d 100644 --- a/src/token.def +++ b/src/token.def @@ -31,6 +31,7 @@ WABT_TOKEN(Bin, "bin") WABT_TOKEN(Item, "item") WABT_TOKEN(Data, "data") WABT_TOKEN(Declare, "declare") +WABT_TOKEN(Delegate, "delegate") WABT_TOKEN(Do, "do") WABT_TOKEN(Elem, "elem") WABT_TOKEN(Eof, "EOF") @@ -90,11 +91,11 @@ WABT_TOKEN(Binary, "BINARY") WABT_TOKEN(Block, "block") WABT_TOKEN(Br, "br") WABT_TOKEN(BrIf, "br_if") -WABT_TOKEN(BrOnExn, "br_on_exn") WABT_TOKEN(BrTable, "br_table") WABT_TOKEN(Call, "call") WABT_TOKEN(CallIndirect, "call_indirect") WABT_TOKEN(Catch, "catch") +WABT_TOKEN(CatchAll, "catch_all") WABT_TOKEN(Compare, "COMPARE") WABT_TOKEN(Const, "CONST") WABT_TOKEN(Convert, "CONVERT") @@ -142,8 +143,9 @@ WABT_TOKEN(Throw, "throw") WABT_TOKEN(Try, "try") WABT_TOKEN(Unary, "UNARY") WABT_TOKEN(Unreachable, "unreachable") +WABT_TOKEN(Unwind, "unwind") WABT_TOKEN_FIRST(Opcode, AtomicFence) -WABT_TOKEN_LAST(Opcode, Unreachable) +WABT_TOKEN_LAST(Opcode, Unwind) /* Tokens with string data. */ WABT_TOKEN(AlignEqNat, "align=") diff --git a/src/tools/spectest-interp.cc b/src/tools/spectest-interp.cc index 8f380ad8f..c27e7a9f6 100644 --- a/src/tools/spectest-interp.cc +++ b/src/tools/spectest-interp.cc @@ -590,8 +590,6 @@ wabt::Result JSONParser::ParseType(Type* out_type) { *out_type = Type::FuncRef; } else if (type_str == "externref") { *out_type = Type::ExternRef; - } else if (type_str == "exnref") { - *out_type = Type::ExnRef; } else { PrintError("unknown type: \"%s\"", type_str.c_str()); return wabt::Result::Error; diff --git a/src/type-checker.cc b/src/type-checker.cc index a93d2b606..9136442bb 100644 --- a/src/type-checker.cc +++ b/src/type-checker.cc @@ -70,6 +70,38 @@ Result TypeChecker::GetLabel(Index depth, Label** out_label) { return Result::Ok; } +Result TypeChecker::GetRethrowLabel(Index depth, Label** out_label) { + Index cur = 0, catches = 0; + std::string candidates; + + while (cur < label_stack_.size()) { + *out_label = &label_stack_[label_stack_.size() - cur - 1]; + + if ((*out_label)->label_type == LabelType::Catch) { + if (catches == depth) { + return Result::Ok; + } else { + if (!candidates.empty()) { + candidates.append(", "); + } + candidates.append(std::to_string(catches)); + catches++; + } + } + + cur++; + } + + if (catches == 0) { + PrintError("rethrow not in try catch block"); + } else { + PrintError("invalid rethrow depth: %" PRIindex " (catches: %s)", depth, + candidates.c_str()); + } + *out_label = nullptr; + return Result::Error; +} + Result TypeChecker::TopLabel(Label** out_label) { return GetLabel(0, out_label); } @@ -110,6 +142,13 @@ Result TypeChecker::CheckLabelType(Label* label, LabelType label_type) { return label->label_type == label_type ? Result::Ok : Result::Error; } +Result TypeChecker::Check2LabelTypes(Label* label, + LabelType label_type1, + LabelType label_type2) { + return label->label_type == label_type1 || + label->label_type == label_type2 ? Result::Ok : Result::Error; +} + Result TypeChecker::GetThisFunctionLabel(Label** label) { return GetLabel(label_stack_.size() - 1, label); } @@ -408,20 +447,6 @@ Result TypeChecker::OnBrIf(Index depth) { return result; } -Result TypeChecker::OnBrOnExn(Index depth, const TypeVector& types) { - Result result = PopAndCheck1Type(Type::ExnRef, "br_on_exn"); - Label* label; - CHECK_RESULT(GetLabel(depth, &label)); - if (Failed(CheckTypes(types, label->br_types()))) { - PrintError("br_on_exn has inconsistent types: expected %s, got %s", - TypesToString(label->br_types()).c_str(), - TypesToString(types).c_str()); - result = Result::Error; - } - PushType(Type::ExnRef); - return result; -} - Result TypeChecker::BeginBrTable() { br_table_sig_ = nullptr; return PopAndCheck1Type(Type::I32, "br_table"); @@ -496,17 +521,17 @@ Result TypeChecker::OnCompare(Opcode opcode) { return CheckOpcode2(opcode); } -Result TypeChecker::OnCatch() { +Result TypeChecker::OnCatch(const TypeVector& sig) { Result result = Result::Ok; Label* label; CHECK_RESULT(TopLabel(&label)); - result |= CheckLabelType(label, LabelType::Try); + result |= Check2LabelTypes(label, LabelType::Try, LabelType::Catch); result |= PopAndCheckSignature(label->result_types, "try block"); result |= CheckTypeStackEnd("try block"); ResetTypeStackToLabel(label); label->label_type = LabelType::Catch; label->unreachable = false; - PushType(Type::ExnRef); + PushTypes(sig); return result; } @@ -519,6 +544,27 @@ Result TypeChecker::OnConvert(Opcode opcode) { return CheckOpcode1(opcode); } +Result TypeChecker::OnDelegate(Index depth) { + Result result = Result::Ok; + Label* label; + // Delegate starts counting after the current try, as the delegate + // instruction is not actually in the try block. + CHECK_RESULT(GetLabel(depth + 1, &label)); + + Label* try_label; + CHECK_RESULT(TopLabel(&try_label)); + result |= CheckLabelType(try_label, LabelType::Try); + result |= PopAndCheckSignature(try_label->result_types, "try block"); + result |= CheckTypeStackEnd("try block"); + ResetTypeStackToLabel(try_label); + + // Since an end instruction does not follow a delegate, we push + // the block results here and pop the label. + PushTypes(try_label->result_types); + PopLabel(); + return result; +} + Result TypeChecker::OnDrop() { Result result = Result::Ok; result |= DropTypes(1); @@ -541,10 +587,11 @@ Result TypeChecker::OnElse() { } Result TypeChecker::OnEnd(Label* label, + TypeVector& check_type, const char* sig_desc, const char* end_desc) { Result result = Result::Ok; - result |= PopAndCheckSignature(label->result_types, sig_desc); + result |= PopAndCheckSignature(check_type, sig_desc); result |= CheckTypeStackEnd(end_desc); ResetTypeStackToLabel(label); PushTypes(label->result_types); @@ -555,7 +602,8 @@ Result TypeChecker::OnEnd(Label* label, Result TypeChecker::OnEnd() { Result result = Result::Ok; static const char* s_label_type_name[] = { - "function", "block", "loop", "if", "if false branch", "try", "try catch"}; + "function", "block", "loop", "if", "if false branch", "try", + "try catch", "try unwind"}; WABT_STATIC_ASSERT(WABT_ARRAY_SIZE(s_label_type_name) == kLabelTypeCount); Label* label; CHECK_RESULT(TopLabel(&label)); @@ -566,8 +614,17 @@ Result TypeChecker::OnEnd() { // an empty else block. CHECK_RESULT(OnElse()); } + const char* desc = s_label_type_name[static_cast(label->label_type)]; - result |= OnEnd(label, desc, desc); + if (label->label_type == LabelType::Unwind) { + // Unwind is unusual in that it always unwinds the control stack at the end, + // and therefore the return type of the unwind expressions are not the same + // as the block return type. + TypeVector empty; + result |= OnEnd(label, empty, desc, desc); + } else { + result |= OnEnd(label, label->result_types, desc, desc); + } return result; } @@ -708,8 +765,10 @@ Result TypeChecker::OnRefIsNullExpr() { return result; } -Result TypeChecker::OnRethrow() { - Result result = PopAndCheck1Type(Type::ExnRef, "rethrow"); +Result TypeChecker::OnRethrow(Index depth) { + Result result = Result::Ok; + Label* label; + CHECK_RESULT(GetRethrowLabel(depth, &label)); CHECK_RESULT(SetUnreachable()); return result; } @@ -829,12 +888,25 @@ Result TypeChecker::OnUnreachable() { return SetUnreachable(); } +Result TypeChecker::OnUnwind() { + Result result = Result::Ok; + Label* label; + CHECK_RESULT(TopLabel(&label)); + result |= CheckLabelType(label, LabelType::Try); + result |= PopAndCheckSignature(label->result_types, "try block"); + result |= CheckTypeStackEnd("try block"); + ResetTypeStackToLabel(label); + label->label_type = LabelType::Unwind; + label->unreachable = false; + return result; +} + Result TypeChecker::EndFunction() { Result result = Result::Ok; Label* label; CHECK_RESULT(TopLabel(&label)); result |= CheckLabelType(label, LabelType::Func); - result |= OnEnd(label, "implicit return", "function"); + result |= OnEnd(label, label->result_types, "implicit return", "function"); return result; } diff --git a/src/type-checker.h b/src/type-checker.h index 66b9b2e27..467306732 100644 --- a/src/type-checker.h +++ b/src/type-checker.h @@ -57,6 +57,7 @@ class TypeChecker { bool IsUnreachable(); Result GetLabel(Index depth, Label** out_label); + Result GetRethrowLabel(Index depth, Label** out_label); Result BeginFunction(const TypeVector& sig); Result OnAtomicFence(uint32_t consistency_model); @@ -70,7 +71,6 @@ class TypeChecker { Result OnBlock(const TypeVector& param_types, const TypeVector& result_types); Result OnBr(Index depth); Result OnBrIf(Index depth); - Result OnBrOnExn(Index depth, const TypeVector& types); Result BeginBrTable(); Result OnBrTableTarget(Index depth); Result EndBrTable(); @@ -79,10 +79,11 @@ class TypeChecker { const TypeVector& result_types); Result OnReturnCall(const TypeVector& param_types, const TypeVector& result_types); Result OnReturnCallIndirect(const TypeVector& param_types, const TypeVector& result_types); - Result OnCatch(); + Result OnCatch(const TypeVector& sig); Result OnCompare(Opcode); Result OnConst(Type); Result OnConvert(Opcode); + Result OnDelegate(Index depth); Result OnDrop(); Result OnElse(); Result OnEnd(); @@ -111,7 +112,7 @@ class TypeChecker { Result OnRefFuncExpr(Index func_index); Result OnRefNullExpr(Type type); Result OnRefIsNullExpr(); - Result OnRethrow(); + Result OnRethrow(Index depth); Result OnReturn(); Result OnSelect(const TypeVector& result_types); Result OnSimdLaneOp(Opcode, uint64_t); @@ -122,6 +123,7 @@ class TypeChecker { Result OnTry(const TypeVector& param_types, const TypeVector& result_types); Result OnUnary(Opcode); Result OnUnreachable(); + Result OnUnwind(); Result EndFunction(); static Result CheckType(Type actual, Type expected); @@ -136,6 +138,7 @@ class TypeChecker { const TypeVector& result_types); Result PopLabel(); Result CheckLabelType(Label* label, LabelType label_type); + Result Check2LabelTypes(Label* label, LabelType label_type1, LabelType label_type2); Result GetThisFunctionLabel(Label **label); Result PeekType(Index depth, Type* out_type); Result PeekAndCheckType(Index depth, Type expected); @@ -164,7 +167,7 @@ class TypeChecker { const Limits* limits1 = nullptr, const Limits* limits2 = nullptr, const Limits* limits3 = nullptr); - Result OnEnd(Label* label, const char* sig_desc, const char* end_desc); + Result OnEnd(Label* label, TypeVector& check_type, const char* sig_desc, const char* end_desc); template void PrintStackIfFailed(Result result, const char* desc, Args... args) { diff --git a/src/type.h b/src/type.h index c44b54f1d..cd383a16e 100644 --- a/src/type.h +++ b/src/type.h @@ -43,7 +43,6 @@ class Type { I16 = -0x07, // 0x79 : packed-type only, used in gc and as v128 lane FuncRef = -0x10, // 0x70 ExternRef = -0x11, // 0x6f - ExnRef = -0x18, // 0x68 Func = -0x20, // 0x60 Struct = -0x21, // 0x5f Array = -0x22, // 0x5e @@ -62,8 +61,7 @@ class Type { operator Enum() const { return enum_; } bool IsRef() const { - return enum_ == Type::ExternRef || enum_ == Type::FuncRef || - enum_ == Type::ExnRef; + return enum_ == Type::ExternRef || enum_ == Type::FuncRef; } bool IsNullableRef() const { @@ -82,7 +80,6 @@ class Type { case Type::I16: return "i16"; case Type::FuncRef: return "funcref"; case Type::Func: return "func"; - case Type::ExnRef: return "exnref"; case Type::Void: return "void"; case Type::Any: return "any"; case Type::ExternRef: return "externref"; @@ -94,7 +91,6 @@ class Type { switch (enum_) { case Type::FuncRef: return "func"; case Type::ExternRef: return "extern"; - case Type::ExnRef: return "exn"; case Type::Struct: return "struct"; case Type::Array: return "array"; default: return ""; @@ -133,7 +129,6 @@ class Type { case Type::V128: case Type::FuncRef: case Type::ExternRef: - case Type::ExnRef: return TypeVector(this, this + 1); default: diff --git a/src/validator.cc b/src/validator.cc index e7f7b5a59..4733954fc 100644 --- a/src/validator.cc +++ b/src/validator.cc @@ -90,7 +90,6 @@ class Validator : public ExprVisitor::Delegate { Result EndBlockExpr(BlockExpr*) override; Result OnBrExpr(BrExpr*) override; Result OnBrIfExpr(BrIfExpr*) override; - Result OnBrOnExnExpr(BrOnExnExpr*) override; Result OnBrTableExpr(BrTableExpr*) override; Result OnCallExpr(CallExpr*) override; Result OnCallIndirectExpr(CallIndirectExpr*) override; @@ -135,7 +134,9 @@ class Validator : public ExprVisitor::Delegate { Result OnUnaryExpr(UnaryExpr*) override; Result OnUnreachableExpr(UnreachableExpr*) override; Result BeginTryExpr(TryExpr*) override; - Result OnCatchExpr(TryExpr*) override; + Result OnCatchExpr(TryExpr*, Catch*) override; + Result OnUnwindExpr(TryExpr*) override; + Result OnDelegateExpr(TryExpr*) override; Result EndTryExpr(TryExpr*) override; Result OnThrowExpr(ThrowExpr*) override; Result OnRethrowExpr(RethrowExpr*) override; @@ -249,12 +250,6 @@ Result Validator::OnBrIfExpr(BrIfExpr* expr) { return Result::Ok; } -Result Validator::OnBrOnExnExpr(BrOnExnExpr* expr) { - result_ |= validator_.OnBrOnExn(expr->loc, expr->label_var, - expr->event_var); - return Result::Ok; -} - Result Validator::OnBrTableExpr(BrTableExpr* expr) { result_ |= validator_.BeginBrTable(expr->loc); for (const Var& var : expr->targets) { @@ -495,8 +490,19 @@ Result Validator::BeginTryExpr(TryExpr* expr) { return Result::Ok; } -Result Validator::OnCatchExpr(TryExpr* expr) { - result_ |= validator_.OnCatch(expr->loc); +Result Validator::OnCatchExpr(TryExpr*, Catch* catch_) { + result_ |= validator_.OnCatch(catch_->loc, catch_->var, + catch_->IsCatchAll()); + return Result::Ok; +} + +Result Validator::OnUnwindExpr(TryExpr* expr) { + result_ |= validator_.OnUnwind(expr->loc); + return Result::Ok; +} + +Result Validator::OnDelegateExpr(TryExpr* expr) { + result_ |= validator_.OnDelegate(expr->loc, expr->delegate_target); return Result::Ok; } @@ -511,7 +517,7 @@ Result Validator::OnThrowExpr(ThrowExpr* expr) { } Result Validator::OnRethrowExpr(RethrowExpr* expr) { - result_ |= validator_.OnRethrow(expr->loc); + result_ |= validator_.OnRethrow(expr->loc, expr->var); return Result::Ok; } diff --git a/src/wast-parser.cc b/src/wast-parser.cc index e07289cba..6ae2d241c 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -114,7 +114,6 @@ bool IsPlainInstr(TokenType token_type) { case TokenType::Select: case TokenType::Br: case TokenType::BrIf: - case TokenType::BrOnExn: case TokenType::BrTable: case TokenType::Return: case TokenType::ReturnCall: @@ -192,6 +191,10 @@ bool IsInstr(TokenTypePair pair) { return IsPlainOrBlockInstr(pair[0]) || IsExpr(pair); } +bool IsCatch(TokenType token_type) { + return token_type == TokenType::Catch || token_type == TokenType::CatchAll; +} + bool IsModuleField(TokenTypePair pair) { if (pair[0] != TokenType::Lpar) { return false; @@ -811,9 +814,6 @@ Result WastParser::ParseValueType(Type* out_type) { case Type::ExternRef: is_enabled = options_->features.reference_types_enabled(); break; - case Type::ExnRef: - is_enabled = options_->features.exceptions_enabled(); - break; default: is_enabled = true; break; @@ -860,7 +860,7 @@ Result WastParser::ParseRefKind(Type* out_type) { Result WastParser::ParseRefType(Type* out_type) { WABT_TRACE(ParseRefType); if (!PeekMatch(TokenType::ValueType)) { - return ErrorExpected({"funcref", "externref", "exnref"}); + return ErrorExpected({"funcref", "externref"}); } Token token = Consume(); @@ -1803,15 +1803,6 @@ Result WastParser::ParsePlainInstr(std::unique_ptr* out_expr) { CHECK_RESULT(ParsePlainInstrVar(loc, out_expr)); break; - case TokenType::BrOnExn: { - Consume(); - auto expr = MakeUnique(loc); - CHECK_RESULT(ParseVar(&expr->label_var)); - CHECK_RESULT(ParseVar(&expr->event_var)); - *out_expr = std::move(expr); - break; - } - case TokenType::BrTable: { Consume(); auto expr = MakeUnique(loc); @@ -2043,7 +2034,7 @@ Result WastParser::ParsePlainInstr(std::unique_ptr* out_expr) { case TokenType::Rethrow: ErrorUnlessOpcodeEnabled(Consume()); - out_expr->reset(new RethrowExpr(loc)); + CHECK_RESULT(ParsePlainInstrVar(loc, out_expr)); break; case TokenType::AtomicNotify: { @@ -2563,12 +2554,30 @@ Result WastParser::ParseBlockInstr(std::unique_ptr* out_expr) { case TokenType::Try: { ErrorUnlessOpcodeEnabled(Consume()); auto expr = MakeUnique(loc); + CatchVector catches; CHECK_RESULT(ParseLabelOpt(&expr->block.label)); CHECK_RESULT(ParseBlock(&expr->block)); - EXPECT(Catch); - CHECK_RESULT(ParseEndLabelOpt(expr->block.label)); - CHECK_RESULT(ParseTerminatingInstrList(&expr->catch_)); - EXPECT(End); + if (IsCatch(Peek())) { + CHECK_RESULT(ParseCatchInstrList(&expr->catches)); + expr->kind = TryKind::Catch; + } else if (PeekMatch(TokenType::Unwind)) { + Consume(); + CHECK_RESULT(ParseInstrList(&expr->unwind)); + expr->kind = TryKind::Unwind; + } else if (PeekMatch(TokenType::Delegate)) { + Consume(); + Var var; + CHECK_RESULT(ParseVar(&var)); + expr->delegate_target = var; + expr->kind = TryKind::Delegate; + } else { + return ErrorExpected({"catch", "catch_all", "unwind", "delegate"}); + } + CHECK_RESULT(ErrorIfLpar({"a valid try clause"})); + expr->block.end_loc = GetLocation(); + if (expr->kind != TryKind::Delegate) { + EXPECT(End); + } CHECK_RESULT(ParseEndLabelOpt(expr->block.label)); *out_expr = std::move(expr); break; @@ -2730,12 +2739,36 @@ Result WastParser::ParseExpr(ExprList* exprs) { EXPECT(Lpar); EXPECT(Do); CHECK_RESULT(ParseInstrList(&expr->block.exprs)); - expr->block.end_loc = GetLocation(); EXPECT(Rpar); EXPECT(Lpar); - EXPECT(Catch); - CHECK_RESULT(ParseTerminatingInstrList(&expr->catch_)); - EXPECT(Rpar); + TokenType type = Peek(); + switch (type) { + case TokenType::Catch: + case TokenType::CatchAll: + CHECK_RESULT(ParseCatchExprList(&expr->catches)); + expr->kind = TryKind::Catch; + break; + case TokenType::Unwind: + Consume(); + CHECK_RESULT(ParseTerminatingInstrList(&expr->unwind)); + expr->kind = TryKind::Unwind; + EXPECT(Rpar); + break; + case TokenType::Delegate: { + Consume(); + Var var; + CHECK_RESULT(ParseVar(&var)); + expr->delegate_target = var; + expr->kind = TryKind::Delegate; + EXPECT(Rpar); + break; + } + default: + ErrorExpected({"catch", "catch_all", "unwind", "delegate"}); + break; + } + CHECK_RESULT(ErrorIfLpar({"a valid try clause"})); + expr->block.end_loc = GetLocation(); exprs->push_back(std::move(expr)); break; } @@ -2750,6 +2783,63 @@ Result WastParser::ParseExpr(ExprList* exprs) { return Result::Ok; } +Result WastParser::ParseCatchInstrList(CatchVector* catches) { + WABT_TRACE(ParseCatchInstrList); + bool parsedCatch = false; + bool parsedCatchAll = false; + + while (IsCatch(Peek())) { + Catch catch_(GetLocation()); + + auto token = Consume(); + if (token.token_type() == TokenType::Catch) { + CHECK_RESULT(ParseVar(&catch_.var)); + } else { + if (parsedCatchAll) { + Error(token.loc, "multiple catch_all clauses not allowed"); + return Result::Error; + } + parsedCatchAll = true; + } + + CHECK_RESULT(ParseInstrList(&catch_.exprs)); + catches->push_back(std::move(catch_)); + parsedCatch = true; + } + + if (!parsedCatch) { + return ErrorExpected({"catch"}); + } + + return Result::Ok; +} + +Result WastParser::ParseCatchExprList(CatchVector* catches) { + WABT_TRACE(ParseCatchExprList); + bool parsedCatchAll = false; + + do { + Catch catch_(GetLocation()); + + auto token = Consume(); + if (token.token_type() == TokenType::Catch) { + CHECK_RESULT(ParseVar(&catch_.var)); + } else { + if (parsedCatchAll) { + Error(token.loc, "multiple catch_all clauses not allowed"); + return Result::Error; + } + parsedCatchAll = true; + } + + CHECK_RESULT(ParseTerminatingInstrList(&catch_.exprs)); + EXPECT(Rpar); + catches->push_back(std::move(catch_)); + } while (Match(TokenType::Lpar) && IsCatch(Peek())); + + return Result::Ok; +} + Result WastParser::ParseGlobalType(Global* global) { WABT_TRACE(ParseGlobalType); if (MatchLpar(TokenType::Mut)) { diff --git a/src/wast-parser.h b/src/wast-parser.h index b25709de4..9c82b2502 100644 --- a/src/wast-parser.h +++ b/src/wast-parser.h @@ -184,6 +184,8 @@ class WastParser { Result ParseBlock(Block*); Result ParseExprList(ExprList*); Result ParseExpr(ExprList*); + Result ParseCatchInstrList(CatchVector* catches); + Result ParseCatchExprList(CatchVector* catches); Result ParseGlobalType(Global*); Result ParseField(Field*); Result ParseFieldList(std::vector*); diff --git a/src/wat-writer.cc b/src/wat-writer.cc index a4c703dc9..fd102130a 100644 --- a/src/wat-writer.cc +++ b/src/wat-writer.cc @@ -513,7 +513,6 @@ class WatWriter::ExprVisitorDelegate : public ExprVisitor::Delegate { Result EndBlockExpr(BlockExpr*) override; Result OnBrExpr(BrExpr*) override; Result OnBrIfExpr(BrIfExpr*) override; - Result OnBrOnExnExpr(BrOnExnExpr*) override; Result OnBrTableExpr(BrTableExpr*) override; Result OnCallExpr(CallExpr*) override; Result OnCallIndirectExpr(CallIndirectExpr*) override; @@ -558,7 +557,9 @@ class WatWriter::ExprVisitorDelegate : public ExprVisitor::Delegate { Result OnUnaryExpr(UnaryExpr*) override; Result OnUnreachableExpr(UnreachableExpr*) override; Result BeginTryExpr(TryExpr*) override; - Result OnCatchExpr(TryExpr*) override; + Result OnCatchExpr(TryExpr*, Catch*) override; + Result OnUnwindExpr(TryExpr*) override; + Result OnDelegateExpr(TryExpr*) override; Result EndTryExpr(TryExpr*) override; Result OnThrowExpr(ThrowExpr*) override; Result OnRethrowExpr(RethrowExpr*) override; @@ -606,13 +607,6 @@ Result WatWriter::ExprVisitorDelegate::OnBrIfExpr(BrIfExpr* expr) { return Result::Ok; } -Result WatWriter::ExprVisitorDelegate::OnBrOnExnExpr(BrOnExnExpr* expr) { - writer_->WritePutsSpace(Opcode::BrOnExn_Opcode.GetName()); - writer_->WriteBrVar(expr->label_var, NextChar::Space); - writer_->WriteVar(expr->event_var, NextChar::Newline); - return Result::Ok; -} - Result WatWriter::ExprVisitorDelegate::OnBrTableExpr(BrTableExpr* expr) { writer_->WritePutsSpace(Opcode::BrTable_Opcode.GetName()); for (const Var& var : expr->targets) { @@ -883,12 +877,34 @@ Result WatWriter::ExprVisitorDelegate::BeginTryExpr(TryExpr* expr) { return Result::Ok; } -Result WatWriter::ExprVisitorDelegate::OnCatchExpr(TryExpr* expr) { +Result WatWriter::ExprVisitorDelegate::OnCatchExpr( + TryExpr* expr, Catch* catch_) { writer_->Dedent(); - writer_->WritePutsSpace(Opcode::Catch_Opcode.GetName()); + if (catch_->IsCatchAll()) { + // We use a literal instead of doing GetName() on the opcode because + // `else` and `catch_all` share an opcode. + writer_->WritePutsNewline("catch_all"); + } else { + writer_->WritePutsSpace(Opcode::Catch_Opcode.GetName()); + writer_->WriteVar(catch_->var, NextChar::Newline); + } writer_->Indent(); writer_->SetTopLabelType(LabelType::Catch); - writer_->WriteNewline(FORCE_NEWLINE); + return Result::Ok; +} + +Result WatWriter::ExprVisitorDelegate::OnUnwindExpr(TryExpr* expr) { + writer_->Dedent(); + writer_->WritePutsNewline(Opcode::Unwind_Opcode.GetName()); + writer_->Indent(); + writer_->SetTopLabelType(LabelType::Unwind); + return Result::Ok; +} + +Result WatWriter::ExprVisitorDelegate::OnDelegateExpr(TryExpr* expr) { + writer_->Dedent(); + writer_->WritePutsSpace(Opcode::Delegate_Opcode.GetName()); + writer_->WriteVar(expr->delegate_target, NextChar::Newline); return Result::Ok; } @@ -904,7 +920,8 @@ Result WatWriter::ExprVisitorDelegate::OnThrowExpr(ThrowExpr* expr) { } Result WatWriter::ExprVisitorDelegate::OnRethrowExpr(RethrowExpr* expr) { - writer_->WritePutsNewline(Opcode::Rethrow_Opcode.GetName()); + writer_->WritePutsSpace(Opcode::Rethrow_Opcode.GetName()); + writer_->WriteBrVar(expr->var, NextChar::Newline); return Result::Ok; } @@ -1104,10 +1121,40 @@ void WatWriter::FlushExprTree(const ExprTree& expr_tree) { WriteFoldedExprList(try_expr->block.exprs); FlushExprTreeStack(); WriteCloseNewline(); - WriteOpenNewline("catch"); - WriteFoldedExprList(try_expr->catch_); - FlushExprTreeStack(); - WriteCloseNewline(); + switch (try_expr->kind) { + case TryKind::Catch: + for (const Catch& catch_ : try_expr->catches) { + WritePuts("(", NextChar::None); + if (catch_.IsCatchAll()) { + WritePutsNewline("catch_all"); + } else { + WritePutsSpace(Opcode::Catch_Opcode.GetName()); + WriteVar(catch_.var, NextChar::Newline); + } + Indent(); + WriteFoldedExprList(catch_.exprs); + FlushExprTreeStack(); + WriteCloseNewline(); + } + break; + case TryKind::Unwind: + WritePuts("(", NextChar::None); + WritePutsNewline(Opcode::Unwind_Opcode.GetName()); + Indent(); + WriteFoldedExprList(try_expr->unwind); + FlushExprTreeStack(); + WriteCloseNewline(); + break; + case TryKind::Delegate: + WritePuts("(", NextChar::None); + WritePutsSpace(Opcode::Delegate_Opcode.GetName()); + WriteVar(try_expr->delegate_target, NextChar::None); + WritePuts(")", NextChar::Newline); + break; + case TryKind::Invalid: + // Should not occur. + break; + } WriteCloseNewline(); break; } diff --git a/test/binary/bad-multiple-catch-all.txt b/test/binary/bad-multiple-catch-all.txt new file mode 100644 index 000000000..5951e0ae4 --- /dev/null +++ b/test/binary/bad-multiple-catch-all.txt @@ -0,0 +1,23 @@ +;;; TOOL: run-gen-wasm-bad +;;; ARGS1: --enable-exceptions +;;; ARGS2: --enable-exceptions +magic +version +section(TYPE) { count[1] function params[0] results[0] } +section(FUNCTION) { count[1] type[0] } +section(CODE) { + count[1] + func { + locals[0] + try 0 + catch_all + catch_all + end + } +} +(;; STDERR ;;; +error: only one catch_all allowed in try block +000001b: error: OnElseExpr callback failed +error: only one catch_all allowed in try block +000001b: error: OnElseExpr callback failed +;;; STDERR ;;) diff --git a/test/desugar/try.txt b/test/desugar/try.txt index 550dd0aae..ded7a2406 100644 --- a/test/desugar/try.txt +++ b/test/desugar/try.txt @@ -6,7 +6,7 @@ try $try1 (result i32) nop i32.const 7 - catch + catch $ex nop end ) @@ -18,7 +18,7 @@ try $try1 (result i32) nop i32.const 7 - catch + catch $ex nop end) (type (;0;) (func (param i32))) diff --git a/test/dump/rethrow.txt b/test/dump/rethrow.txt index f7d3b48a8..ff3c54bb3 100644 --- a/test/dump/rethrow.txt +++ b/test/dump/rethrow.txt @@ -4,8 +4,8 @@ (event $e1) (func try - catch - rethrow + catch $e1 + rethrow 0 end)) (;; STDERR ;;; 0000000: 0061 736d ; WASM_BINARY_MAGIC @@ -48,13 +48,15 @@ 000001f: 06 ; try 0000020: 40 ; void 0000021: 07 ; catch -0000022: 09 ; rethrow -0000023: 0b ; end -0000024: 0b ; end -000001d: 07 ; FIXUP func body size -000001b: 09 ; FIXUP section size -; move data: [1a, 25) -> [17, 22) -; truncate to 34 (0x22) +0000022: 00 ; catch event +0000023: 09 ; rethrow +0000024: 00 ; rethrow depth +0000025: 0b ; end +0000026: 0b ; end +000001d: 09 ; FIXUP func body size +000001b: 0b ; FIXUP section size +; move data: [1a, 27) -> [17, 24) +; truncate to 36 (0x24) ;;; STDERR ;;) (;; STDOUT ;;; @@ -64,8 +66,8 @@ Code Disassembly: 00001b func[0]: 00001c: 06 40 | try - 00001e: 07 | catch - 00001f: 09 | rethrow - 000020: 0b | end - 000021: 0b | end + 00001e: 07 00 | catch 0 + 000020: 09 00 | rethrow 0 + 000022: 0b | end + 000023: 0b | end ;;; STDOUT ;;) diff --git a/test/dump/br_on_exn.txt b/test/dump/try-delegate.txt similarity index 65% rename from test/dump/br_on_exn.txt rename to test/dump/try-delegate.txt index 25a1a0485..459d4af93 100644 --- a/test/dump/br_on_exn.txt +++ b/test/dump/try-delegate.txt @@ -3,13 +3,14 @@ (module (event $e (param i32)) (func - block $b (result i32) + try $try1 (result i32) try - catch - br_on_exn $b $e - drop - end - i32.const 0 + nop + delegate 1 + i32.const 7 + catch $e + drop + i32.const 8 end drop)) (;; STDERR ;;; @@ -55,41 +56,44 @@ ; function body 0 0000021: 00 ; func body size (guess) 0000022: 00 ; local decl count -0000023: 02 ; block +0000023: 06 ; try 0000024: 7f ; i32 0000025: 06 ; try 0000026: 40 ; void -0000027: 07 ; catch -0000028: 0a ; br_on_exn -0000029: 01 ; break depth -000002a: 00 ; event index -000002b: 1a ; drop -000002c: 0b ; end -000002d: 41 ; i32.const -000002e: 00 ; i32 literal -000002f: 0b ; end -0000030: 1a ; drop +0000027: 01 ; nop +0000028: 18 ; delegate +0000029: 01 ; delegate depth +000002a: 41 ; i32.const +000002b: 07 ; i32 literal +000002c: 07 ; catch +000002d: 00 ; catch event +000002e: 1a ; drop +000002f: 41 ; i32.const +0000030: 08 ; i32 literal 0000031: 0b ; end -0000021: 10 ; FIXUP func body size -000001f: 12 ; FIXUP section size -; move data: [1e, 32) -> [1b, 2f) -; truncate to 47 (0x2f) +0000032: 1a ; drop +0000033: 0b ; end +0000021: 12 ; FIXUP func body size +000001f: 14 ; FIXUP section size +; move data: [1e, 34) -> [1b, 31) +; truncate to 49 (0x31) ;;; STDERR ;;) (;; STDOUT ;;; -br_on_exn.wasm: file format wasm 0x1 +try-delegate.wasm: file format wasm 0x1 Code Disassembly: 00001f func[0]: - 000020: 02 7f | block i32 + 000020: 06 7f | try i32 000022: 06 40 | try - 000024: 07 | catch - 000025: 0a 01 00 | br_on_exn 1 0 - 000028: 1a | drop - 000029: 0b | end - 00002a: 41 00 | i32.const 0 - 00002c: 0b | end - 00002d: 1a | drop + 000024: 01 | nop + 000025: 18 01 | delegate 1 + 000027: 41 07 | i32.const 7 + 000029: 07 00 | catch 0 + 00002b: 1a | drop + 00002c: 41 08 | i32.const 8 00002e: 0b | end + 00002f: 1a | drop + 000030: 0b | end ;;; STDOUT ;;) diff --git a/test/dump/try-multi.txt b/test/dump/try-multi.txt index b3fb317c8..9246aff6f 100644 --- a/test/dump/try-multi.txt +++ b/test/dump/try-multi.txt @@ -1,11 +1,12 @@ ;;; TOOL: run-objdump ;;; ARGS0: -v --enable-exceptions (module + (event $e1 (param i32)) (func try (result i32 i32) i32.const 1 i32.const 2 - catch + catch $e1 drop i32.const 3 i32.const 4 @@ -16,7 +17,7 @@ i32.const 0 try (param i32) drop - catch + catch $e1 drop end)) (;; STDERR ;;; @@ -28,71 +29,81 @@ 000000a: 03 ; num types ; func type 0 000000b: 60 ; func -000000c: 00 ; num params -000000d: 00 ; num results +000000c: 01 ; num params +000000d: 7f ; i32 +000000e: 00 ; num results ; func type 1 -000000e: 60 ; func -000000f: 00 ; num params -0000010: 02 ; num results -0000011: 7f ; i32 -0000012: 7f ; i32 +000000f: 60 ; func +0000010: 00 ; num params +0000011: 00 ; num results ; func type 2 -0000013: 60 ; func -0000014: 01 ; num params +0000012: 60 ; func +0000013: 00 ; num params +0000014: 02 ; num results 0000015: 7f ; i32 -0000016: 00 ; num results +0000016: 7f ; i32 0000009: 0d ; FIXUP section size ; section "Function" (3) 0000017: 03 ; section code 0000018: 00 ; section size (guess) 0000019: 02 ; num functions -000001a: 00 ; function 0 signature index -000001b: 00 ; function 1 signature index +000001a: 01 ; function 0 signature index +000001b: 01 ; function 1 signature index 0000018: 03 ; FIXUP section size -; section "DataCount" (12) -000001c: 0c ; section code +; section "Event" (13) +000001c: 0d ; section code 000001d: 00 ; section size (guess) -000001e: 00 ; data count -000001d: 01 ; FIXUP section size +000001e: 01 ; event count +; event 0 +000001f: 00 ; event attribute +0000020: 00 ; event signature index +000001d: 03 ; FIXUP section size +; section "DataCount" (12) +0000021: 0c ; section code +0000022: 00 ; section size (guess) +0000023: 00 ; data count +0000022: 01 ; FIXUP section size ; section "Code" (10) -000001f: 0a ; section code -0000020: 00 ; section size (guess) -0000021: 02 ; num functions +0000024: 0a ; section code +0000025: 00 ; section size (guess) +0000026: 02 ; num functions ; function body 0 -0000022: 00 ; func body size (guess) -0000023: 00 ; local decl count -0000024: 06 ; try -0000025: 01 ; block type function index -0000026: 41 ; i32.const -0000027: 01 ; i32 literal -0000028: 41 ; i32.const -0000029: 02 ; i32 literal -000002a: 07 ; catch -000002b: 1a ; drop -000002c: 41 ; i32.const -000002d: 03 ; i32 literal -000002e: 41 ; i32.const -000002f: 04 ; i32 literal -0000030: 0b ; end -0000031: 0f ; return -0000032: 0b ; end -0000022: 10 ; FIXUP func body size +0000027: 00 ; func body size (guess) +0000028: 00 ; local decl count +0000029: 06 ; try +000002a: 02 ; block type function index +000002b: 41 ; i32.const +000002c: 01 ; i32 literal +000002d: 41 ; i32.const +000002e: 02 ; i32 literal +000002f: 07 ; catch +0000030: 00 ; catch event +0000031: 1a ; drop +0000032: 41 ; i32.const +0000033: 03 ; i32 literal +0000034: 41 ; i32.const +0000035: 04 ; i32 literal +0000036: 0b ; end +0000037: 0f ; return +0000038: 0b ; end +0000027: 11 ; FIXUP func body size ; function body 1 -0000033: 00 ; func body size (guess) -0000034: 00 ; local decl count -0000035: 41 ; i32.const -0000036: 00 ; i32 literal -0000037: 06 ; try -0000038: 02 ; block type function index -0000039: 1a ; drop -000003a: 07 ; catch -000003b: 1a ; drop -000003c: 0b ; end -000003d: 0b ; end -0000033: 0a ; FIXUP func body size -0000020: 1d ; FIXUP section size -; move data: [1f, 3e) -> [1c, 3b) -; truncate to 59 (0x3b) +0000039: 00 ; func body size (guess) +000003a: 00 ; local decl count +000003b: 41 ; i32.const +000003c: 00 ; i32 literal +000003d: 06 ; try +000003e: 00 ; block type function index +000003f: 1a ; drop +0000040: 07 ; catch +0000041: 00 ; catch event +0000042: 1a ; drop +0000043: 0b ; end +0000044: 0b ; end +0000039: 0b ; FIXUP func body size +0000025: 1f ; FIXUP section size +; move data: [24, 45) -> [21, 42) +; truncate to 66 (0x42) ;;; STDERR ;;) (;; STDOUT ;;; @@ -100,23 +111,23 @@ try-multi.wasm: file format wasm 0x1 Code Disassembly: -000020 func[0]: - 000021: 06 01 | try type[1] - 000023: 41 01 | i32.const 1 - 000025: 41 02 | i32.const 2 - 000027: 07 | catch - 000028: 1a | drop - 000029: 41 03 | i32.const 3 - 00002b: 41 04 | i32.const 4 - 00002d: 0b | end - 00002e: 0f | return - 00002f: 0b | end -000031 func[1]: - 000032: 41 00 | i32.const 0 - 000034: 06 02 | try type[2] - 000036: 1a | drop - 000037: 07 | catch - 000038: 1a | drop - 000039: 0b | end - 00003a: 0b | end +000025 func[0]: + 000026: 06 02 | try type[2] + 000028: 41 01 | i32.const 1 + 00002a: 41 02 | i32.const 2 + 00002c: 07 00 | catch 0 + 00002e: 1a | drop + 00002f: 41 03 | i32.const 3 + 000031: 41 04 | i32.const 4 + 000033: 0b | end + 000034: 0f | return + 000035: 0b | end +000037 func[1]: + 000038: 41 00 | i32.const 0 + 00003a: 06 00 | try type[0] + 00003c: 1a | drop + 00003d: 07 00 | catch 0 + 00003f: 1a | drop + 000040: 0b | end + 000041: 0b | end ;;; STDOUT ;;) diff --git a/test/dump/try-unwind.txt b/test/dump/try-unwind.txt new file mode 100644 index 000000000..d49e21556 --- /dev/null +++ b/test/dump/try-unwind.txt @@ -0,0 +1,90 @@ +;;; TOOL: run-objdump +;;; ARGS0: -v --enable-exceptions +(module + (event $e (param i32)) + (func + try $try1 (result i32) + nop + i32.const 7 + unwind + i32.const 8 + drop + end + drop)) +(;; STDERR ;;; +0000000: 0061 736d ; WASM_BINARY_MAGIC +0000004: 0100 0000 ; WASM_BINARY_VERSION +; section "Type" (1) +0000008: 01 ; section code +0000009: 00 ; section size (guess) +000000a: 02 ; num types +; func type 0 +000000b: 60 ; func +000000c: 01 ; num params +000000d: 7f ; i32 +000000e: 00 ; num results +; func type 1 +000000f: 60 ; func +0000010: 00 ; num params +0000011: 00 ; num results +0000009: 08 ; FIXUP section size +; section "Function" (3) +0000012: 03 ; section code +0000013: 00 ; section size (guess) +0000014: 01 ; num functions +0000015: 01 ; function 0 signature index +0000013: 02 ; FIXUP section size +; section "Event" (13) +0000016: 0d ; section code +0000017: 00 ; section size (guess) +0000018: 01 ; event count +; event 0 +0000019: 00 ; event attribute +000001a: 00 ; event signature index +0000017: 03 ; FIXUP section size +; section "DataCount" (12) +000001b: 0c ; section code +000001c: 00 ; section size (guess) +000001d: 00 ; data count +000001c: 01 ; FIXUP section size +; section "Code" (10) +000001e: 0a ; section code +000001f: 00 ; section size (guess) +0000020: 01 ; num functions +; function body 0 +0000021: 00 ; func body size (guess) +0000022: 00 ; local decl count +0000023: 06 ; try +0000024: 7f ; i32 +0000025: 01 ; nop +0000026: 41 ; i32.const +0000027: 07 ; i32 literal +0000028: 0a ; unwind +0000029: 41 ; i32.const +000002a: 08 ; i32 literal +000002b: 1a ; drop +000002c: 0b ; end +000002d: 1a ; drop +000002e: 0b ; end +0000021: 0d ; FIXUP func body size +000001f: 0f ; FIXUP section size +; move data: [1e, 2f) -> [1b, 2c) +; truncate to 44 (0x2c) +;;; STDERR ;;) +(;; STDOUT ;;; + +try-unwind.wasm: file format wasm 0x1 + +Code Disassembly: + +00001f func[0]: + 000020: 06 7f | try i32 + 000022: 01 | nop + 000023: 41 07 | i32.const 7 + 000025: 0a | unwind + 000026: 41 08 | i32.const 8 + 000028: 1a | drop + 000029: 0b | end + 00002a: 1a | drop + 00002b: 0b | end +;;; STDOUT ;;) diff --git a/test/dump/try.txt b/test/dump/try.txt index b2f1a8f46..23c750b70 100644 --- a/test/dump/try.txt +++ b/test/dump/try.txt @@ -1,11 +1,12 @@ ;;; TOOL: run-objdump ;;; ARGS0: -v --enable-exceptions (module + (event $e (param i32)) (func try $try1 (result i32) nop i32.const 7 - catch + catch $e drop i32.const 8 end @@ -16,46 +17,60 @@ ; section "Type" (1) 0000008: 01 ; section code 0000009: 00 ; section size (guess) -000000a: 01 ; num types +000000a: 02 ; num types ; func type 0 000000b: 60 ; func -000000c: 00 ; num params -000000d: 00 ; num results -0000009: 04 ; FIXUP section size +000000c: 01 ; num params +000000d: 7f ; i32 +000000e: 00 ; num results +; func type 1 +000000f: 60 ; func +0000010: 00 ; num params +0000011: 00 ; num results +0000009: 08 ; FIXUP section size ; section "Function" (3) -000000e: 03 ; section code -000000f: 00 ; section size (guess) -0000010: 01 ; num functions -0000011: 00 ; function 0 signature index -000000f: 02 ; FIXUP section size -; section "DataCount" (12) -0000012: 0c ; section code +0000012: 03 ; section code 0000013: 00 ; section size (guess) -0000014: 00 ; data count -0000013: 01 ; FIXUP section size +0000014: 01 ; num functions +0000015: 01 ; function 0 signature index +0000013: 02 ; FIXUP section size +; section "Event" (13) +0000016: 0d ; section code +0000017: 00 ; section size (guess) +0000018: 01 ; event count +; event 0 +0000019: 00 ; event attribute +000001a: 00 ; event signature index +0000017: 03 ; FIXUP section size +; section "DataCount" (12) +000001b: 0c ; section code +000001c: 00 ; section size (guess) +000001d: 00 ; data count +000001c: 01 ; FIXUP section size ; section "Code" (10) -0000015: 0a ; section code -0000016: 00 ; section size (guess) -0000017: 01 ; num functions +000001e: 0a ; section code +000001f: 00 ; section size (guess) +0000020: 01 ; num functions ; function body 0 -0000018: 00 ; func body size (guess) -0000019: 00 ; local decl count -000001a: 06 ; try -000001b: 7f ; i32 -000001c: 01 ; nop -000001d: 41 ; i32.const -000001e: 07 ; i32 literal -000001f: 07 ; catch -0000020: 1a ; drop -0000021: 41 ; i32.const -0000022: 08 ; i32 literal -0000023: 0b ; end -0000024: 1a ; drop -0000025: 0b ; end -0000018: 0d ; FIXUP func body size -0000016: 0f ; FIXUP section size -; move data: [15, 26) -> [12, 23) -; truncate to 35 (0x23) +0000021: 00 ; func body size (guess) +0000022: 00 ; local decl count +0000023: 06 ; try +0000024: 7f ; i32 +0000025: 01 ; nop +0000026: 41 ; i32.const +0000027: 07 ; i32 literal +0000028: 07 ; catch +0000029: 00 ; catch event +000002a: 1a ; drop +000002b: 41 ; i32.const +000002c: 08 ; i32 literal +000002d: 0b ; end +000002e: 1a ; drop +000002f: 0b ; end +0000021: 0e ; FIXUP func body size +000001f: 10 ; FIXUP section size +; move data: [1e, 30) -> [1b, 2d) +; truncate to 45 (0x2d) ;;; STDERR ;;) (;; STDOUT ;;; @@ -63,14 +78,14 @@ try.wasm: file format wasm 0x1 Code Disassembly: -000016 func[0]: - 000017: 06 7f | try i32 - 000019: 01 | nop - 00001a: 41 07 | i32.const 7 - 00001c: 07 | catch - 00001d: 1a | drop - 00001e: 41 08 | i32.const 8 - 000020: 0b | end - 000021: 1a | drop - 000022: 0b | end +00001f func[0]: + 000020: 06 7f | try i32 + 000022: 01 | nop + 000023: 41 07 | i32.const 7 + 000025: 07 00 | catch 0 + 000027: 1a | drop + 000028: 41 08 | i32.const 8 + 00002a: 0b | end + 00002b: 1a | drop + 00002c: 0b | end ;;; STDOUT ;;) diff --git a/test/gen-wasm.py b/test/gen-wasm.py index 7b1660e19..4dbee6bfe 100755 --- a/test/gen-wasm.py +++ b/test/gen-wasm.py @@ -265,6 +265,10 @@ "table.init": (0xfc, 0x0c), "elem.drop": (0xfc, 0x0d), "table.copy": (0xfc, 0x0e), + + # exceptions + "try": 0x06, + "catch_all": 0x05, } keywords = { diff --git a/test/parse/expr/bad-try-delegate.txt b/test/parse/expr/bad-try-delegate.txt new file mode 100644 index 000000000..18e44e618 --- /dev/null +++ b/test/parse/expr/bad-try-delegate.txt @@ -0,0 +1,15 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +;;; ERROR: 1 +(module + (func try nop delegate) + (func try nop delegate 0 end) +) +(;; STDERR ;;; +out/test/parse/expr/bad-try-delegate.txt:5:25: error: unexpected token ")", expected a numeric index or a name (e.g. 12 or $foo). + (func try nop delegate) + ^ +out/test/parse/expr/bad-try-delegate.txt:6:28: error: unexpected token end, expected ). + (func try nop delegate 0 end) + ^^^ +;;; STDERR ;;) diff --git a/test/parse/expr/bad-try-multiple-catch.txt b/test/parse/expr/bad-try-multiple-catch.txt index 4f91a6f9f..4fc30e8c5 100644 --- a/test/parse/expr/bad-try-multiple-catch.txt +++ b/test/parse/expr/bad-try-multiple-catch.txt @@ -6,9 +6,9 @@ (func try nop - catch + catch_all nop - catch + catch_all nop end) @@ -17,20 +17,20 @@ (try (do (nop)) - (catch + (catch_all (nop)) - (catch + (catch_all (nop)))) (;; STDERR ;;; -out/test/parse/expr/bad-try-multiple-catch.txt:11:5: error: unexpected token catch, expected end. - catch - ^^^^^ +out/test/parse/expr/bad-try-multiple-catch.txt:11:5: error: multiple catch_all clauses not allowed + catch_all + ^^^^^^^^^ out/test/parse/expr/bad-try-multiple-catch.txt:13:5: error: unexpected token end, expected ). end) ^^^ -out/test/parse/expr/bad-try-multiple-catch.txt:22:7: error: unexpected token (, expected ). - (catch - ^ +out/test/parse/expr/bad-try-multiple-catch.txt:22:8: error: multiple catch_all clauses not allowed + (catch_all + ^^^^^^^^^ out/test/parse/expr/bad-try-multiple-catch.txt:23:16: error: unexpected token ), expected EOF. (nop)))) ^ diff --git a/test/parse/expr/bad-try-no-catch.txt b/test/parse/expr/bad-try-no-catch.txt index ef0df92bd..a1e5ebdec 100644 --- a/test/parse/expr/bad-try-no-catch.txt +++ b/test/parse/expr/bad-try-no-catch.txt @@ -5,7 +5,7 @@ (func try nop end) (func (try (do nop)))) (;; STDERR ;;; -out/test/parse/expr/bad-try-no-catch.txt:5:17: error: unexpected token end, expected catch. +out/test/parse/expr/bad-try-no-catch.txt:5:17: error: unexpected token "end", expected catch, catch_all, unwind or delegate. (func try nop end) ^^^ out/test/parse/expr/bad-try-no-catch.txt:6:22: error: unexpected token ), expected (. diff --git a/test/parse/expr/bad-try-unwind.txt b/test/parse/expr/bad-try-unwind.txt new file mode 100644 index 000000000..7790c6eb7 --- /dev/null +++ b/test/parse/expr/bad-try-unwind.txt @@ -0,0 +1,38 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +;;; ERROR: 1 +(module + (func try nop unwind) + + (func + try + nop + unwind + nop + catch 0 + nop + end) + + ;; folded + (func + (try + (do + (nop)) + (unwind + (nop)) + (catch 0 + (nop))) +(;; STDERR ;;; +out/test/parse/expr/bad-try-unwind.txt:5:23: error: unexpected token ), expected end. + (func try nop unwind) + ^ +out/test/parse/expr/bad-try-unwind.txt:12:5: error: unexpected token catch, expected end. + catch 0 + ^^^^^ +out/test/parse/expr/bad-try-unwind.txt:14:5: error: unexpected token end, expected ). + end) + ^^^ +out/test/parse/expr/bad-try-unwind.txt:23:8: error: unexpected token "catch", expected a valid try clause. + (catch 0 + ^^^^^ +;;; STDERR ;;) diff --git a/test/parse/expr/br_on_exn.txt b/test/parse/expr/br_on_exn.txt deleted file mode 100644 index 4f47dc5ca..000000000 --- a/test/parse/expr/br_on_exn.txt +++ /dev/null @@ -1,14 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -(module - (event $e (param i32)) - (func - block $b (result i32) - try - catch - br_on_exn $b $e - drop - end - i32.const 0 - end - drop)) diff --git a/test/parse/expr/rethrow.txt b/test/parse/expr/rethrow.txt index b3c034e2d..7015463f9 100644 --- a/test/parse/expr/rethrow.txt +++ b/test/parse/expr/rethrow.txt @@ -4,6 +4,6 @@ (event $e1) (func try - catch - rethrow + catch $e1 + rethrow 0 end)) diff --git a/test/parse/expr/try-catch-all.txt b/test/parse/expr/try-catch-all.txt new file mode 100644 index 000000000..c87f47192 --- /dev/null +++ b/test/parse/expr/try-catch-all.txt @@ -0,0 +1,18 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module + (event $e1 (param i32)) + (event $e2 (param i32 i32)) + + ;; multiple catch clauses ending with catch_all + (func + try + nop + catch $e1 + drop + catch $e2 + drop + drop + catch_all + end) +) diff --git a/test/parse/expr/try-delegate.txt b/test/parse/expr/try-delegate.txt new file mode 100644 index 000000000..40814c81f --- /dev/null +++ b/test/parse/expr/try-delegate.txt @@ -0,0 +1,16 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module + (event (param i32)) + + (func + try + try + nop + delegate 0 + try + nop + delegate 1 + catch 0 + drop + end)) diff --git a/test/parse/expr/try-multi.txt b/test/parse/expr/try-multi.txt index 387fff510..870eb52bf 100644 --- a/test/parse/expr/try-multi.txt +++ b/test/parse/expr/try-multi.txt @@ -1,12 +1,14 @@ ;;; TOOL: wat2wasm ;;; ARGS: --enable-exceptions (module + (event (param i32)) + ;; try w/ multiple results (func try (result f32 f32) f32.const 0 f32.const 1 - catch + catch 0 drop f32.const 2 f32.const 3 @@ -18,8 +20,8 @@ i32.const 0 try (param i32) (result i32) i32.eqz - catch - drop ;; no i32 param, just exnref + catch 0 + drop i32.const 0 end return) diff --git a/test/parse/expr/try-unwind.txt b/test/parse/expr/try-unwind.txt new file mode 100644 index 000000000..4eb9f5e1b --- /dev/null +++ b/test/parse/expr/try-unwind.txt @@ -0,0 +1,15 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module + (func + try + nop + unwind + end) + + (func + try (result i32) + (i32.const 1) + unwind + end + drop)) diff --git a/test/parse/expr/try.txt b/test/parse/expr/try.txt index 354b40179..fabb994c1 100644 --- a/test/parse/expr/try.txt +++ b/test/parse/expr/try.txt @@ -1,11 +1,13 @@ ;;; TOOL: wat2wasm ;;; ARGS: --enable-exceptions (module + (event (param i32)) + ;; bare (func try nop - catch + catch 0 drop end) @@ -13,7 +15,7 @@ (func try $foo nop - catch + catch 0 drop end) @@ -21,7 +23,7 @@ (func try (result i32) i32.const 1 - catch + catch 0 drop i32.const 2 end diff --git a/test/parse/func/local-exnref.txt b/test/parse/func/local-exnref.txt deleted file mode 100644 index 6330ca00e..000000000 --- a/test/parse/func/local-exnref.txt +++ /dev/null @@ -1,3 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -(module (func (local exnref))) diff --git a/test/parse/func/param-exnref.txt b/test/parse/func/param-exnref.txt deleted file mode 100644 index 44aa8bd8e..000000000 --- a/test/parse/func/param-exnref.txt +++ /dev/null @@ -1,3 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -(module (func (param exnref))) diff --git a/test/parse/func/result-exnref.txt b/test/parse/func/result-exnref.txt deleted file mode 100644 index 92435f806..000000000 --- a/test/parse/func/result-exnref.txt +++ /dev/null @@ -1,3 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -(module (func (result exnref) ref.null exn)) diff --git a/test/parse/module/global-exnref.txt b/test/parse/module/global-exnref.txt deleted file mode 100644 index 56f5e57b2..000000000 --- a/test/parse/module/global-exnref.txt +++ /dev/null @@ -1,3 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -(module (global exnref (ref.null exn))) diff --git a/test/roundtrip/fold-br_on_exn.txt b/test/roundtrip/fold-br_on_exn.txt deleted file mode 100644 index 89c425bb1..000000000 --- a/test/roundtrip/fold-br_on_exn.txt +++ /dev/null @@ -1,29 +0,0 @@ -;;; TOOL: run-roundtrip -;;; ARGS: --stdout --fold-exprs --enable-exceptions -(module - (event $e (param i32)) - (func - block $b (result i32) - try - catch - br_on_exn $b $e - drop - end - i32.const 0 - end - drop)) -(;; STDOUT ;;; -(module - (type (;0;) (func (param i32))) - (type (;1;) (func)) - (func (;0;) (type 1) - (drop - (block (result i32) ;; label = @1 - (try ;; label = @2 - (do) - (catch - (drop - (br_on_exn 1 (;@1;) 0)))) - (i32.const 0)))) - (event (;0;) (type 0) (param i32))) -;;; STDOUT ;;) diff --git a/test/roundtrip/fold-rethrow.txt b/test/roundtrip/fold-rethrow.txt index bfddfcfee..d9c7a476a 100644 --- a/test/roundtrip/fold-rethrow.txt +++ b/test/roundtrip/fold-rethrow.txt @@ -5,8 +5,8 @@ (func try - catch - rethrow + catch $e0 + rethrow 0 end ) ) @@ -17,7 +17,7 @@ (func (;0;) (type 1) (try ;; label = @1 (do) - (catch - (rethrow)))) + (catch 0 + (rethrow 0 (;@1;))))) (event (;0;) (type 0) (param i32))) ;;; STDOUT ;;) diff --git a/test/roundtrip/fold-try-delegate.txt b/test/roundtrip/fold-try-delegate.txt new file mode 100644 index 000000000..cf5c2e527 --- /dev/null +++ b/test/roundtrip/fold-try-delegate.txt @@ -0,0 +1,28 @@ +;;; TOOL: run-roundtrip +;;; ARGS: --stdout --fold-exprs --enable-exceptions --debug-names +(module + (func (result i32) + try (result i32) + try + nop + delegate 1 + i32.const 7 + catch_all + i32.const 8 + end + ) +) +(;; STDOUT ;;; +(module + (type (;0;) (func (result i32))) + (func (;0;) (type 0) (result i32) + (try (result i32) ;; label = @1 + (do + (try ;; label = @2 + (do + (nop)) + (delegate 1)) + (i32.const 7)) + (catch_all + (i32.const 8))))) +;;; STDOUT ;;) diff --git a/test/roundtrip/fold-try-unwind.txt b/test/roundtrip/fold-try-unwind.txt new file mode 100644 index 000000000..fbfb625aa --- /dev/null +++ b/test/roundtrip/fold-try-unwind.txt @@ -0,0 +1,25 @@ +;;; TOOL: run-roundtrip +;;; ARGS: --stdout --fold-exprs --enable-exceptions --debug-names +(module + (func (result i32) + try (result i32) + nop + i32.const 7 + unwind + i32.const 8 + drop + end + ) +) +(;; STDOUT ;;; +(module + (type (;0;) (func (result i32))) + (func (;0;) (type 0) (result i32) + (try (result i32) ;; label = @1 + (do + (nop) + (i32.const 7)) + (unwind + (drop + (i32.const 8)))))) +;;; STDOUT ;;) diff --git a/test/roundtrip/fold-try.txt b/test/roundtrip/fold-try.txt index aa2f4531b..d33dbbe20 100644 --- a/test/roundtrip/fold-try.txt +++ b/test/roundtrip/fold-try.txt @@ -5,8 +5,7 @@ try (result i32) nop i32.const 7 - catch - drop + catch_all i32.const 8 end ) @@ -19,7 +18,6 @@ (do (nop) (i32.const 7)) - (catch - (drop) + (catch_all (i32.const 8))))) ;;; STDOUT ;;) diff --git a/test/roundtrip/rethrow.txt b/test/roundtrip/rethrow.txt index 84a7a93e0..97850b85e 100644 --- a/test/roundtrip/rethrow.txt +++ b/test/roundtrip/rethrow.txt @@ -5,8 +5,8 @@ (func try - catch - rethrow + catch $e0 + rethrow 0 end ) ) @@ -16,8 +16,8 @@ (type (;1;) (func)) (func (;0;) (type 1) try ;; label = @1 - catch - rethrow + catch 0 + rethrow 0 (;@1;) end) (event (;0;) (type 0) (param i32))) ;;; STDOUT ;;) diff --git a/test/typecheck/bad-br_on_exn-label-type-mismatch.txt b/test/typecheck/bad-br_on_exn-label-type-mismatch.txt deleted file mode 100644 index d84e1af8c..000000000 --- a/test/typecheck/bad-br_on_exn-label-type-mismatch.txt +++ /dev/null @@ -1,16 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -;;; ERROR: 1 -(module - (event $e (param i32)) - (func - try - catch - br_on_exn 0 $e - drop - end)) -(;; STDERR ;;; -out/test/typecheck/bad-br_on_exn-label-type-mismatch.txt:9:7: error: br_on_exn has inconsistent types: expected [], got [i32] - br_on_exn 0 $e - ^^^^^^^^^ -;;; STDERR ;;) diff --git a/test/typecheck/bad-br_on_exn-mismatch.txt b/test/typecheck/bad-br_on_exn-mismatch.txt deleted file mode 100644 index 37d961285..000000000 --- a/test/typecheck/bad-br_on_exn-mismatch.txt +++ /dev/null @@ -1,14 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -;;; ERROR: 1 -(module - (event $e) - (func - i32.const 0 - br_on_exn 0 $e - drop)) -(;; STDERR ;;; -out/test/typecheck/bad-br_on_exn-mismatch.txt:8:5: error: type mismatch in br_on_exn, expected [exnref] but got [i32] - br_on_exn 0 $e - ^^^^^^^^^ -;;; STDERR ;;) diff --git a/test/typecheck/bad-br_on_exn-result-mismatch.txt b/test/typecheck/bad-br_on_exn-result-mismatch.txt deleted file mode 100644 index e5808cce9..000000000 --- a/test/typecheck/bad-br_on_exn-result-mismatch.txt +++ /dev/null @@ -1,15 +0,0 @@ -;;; TOOL: wat2wasm -;;; ARGS: --enable-exceptions -;;; ERROR: 1 -(module - (event $e) - (func - try - catch - br_on_exn 0 $e - end)) -(;; STDERR ;;; -out/test/typecheck/bad-br_on_exn-result-mismatch.txt:8:5: error: type mismatch in try catch, expected [] but got [exnref] - catch - ^^^^^ -;;; STDERR ;;) diff --git a/test/typecheck/bad-delegate-depth.txt b/test/typecheck/bad-delegate-depth.txt new file mode 100644 index 000000000..a8bfced7c --- /dev/null +++ b/test/typecheck/bad-delegate-depth.txt @@ -0,0 +1,19 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +;;; ARGS: --enable-exceptions +(module + (event $e) + (func + try + block + try + throw $e + delegate 3 + end + catch $e + end)) +(;; STDERR ;;; +out/test/typecheck/bad-delegate-depth.txt:9:9: error: invalid depth: 4 (max 3) + try + ^^^ +;;; STDERR ;;) diff --git a/test/typecheck/bad-empty-catch-all.txt b/test/typecheck/bad-empty-catch-all.txt new file mode 100644 index 000000000..46f76cef6 --- /dev/null +++ b/test/typecheck/bad-empty-catch-all.txt @@ -0,0 +1,15 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +;;; ERROR: 1 +(module + (func (result i32) + try (result i32) + i32.const 1 + catch_all + end + )) +(;; STDERR ;;; +out/test/typecheck/bad-empty-catch-all.txt:9:5: error: type mismatch in try catch, expected [i32] but got [] + end + ^^^ +;;; STDERR ;;) diff --git a/test/typecheck/bad-empty-catch.txt b/test/typecheck/bad-empty-catch.txt index 1d3f54293..d80098662 100644 --- a/test/typecheck/bad-empty-catch.txt +++ b/test/typecheck/bad-empty-catch.txt @@ -2,13 +2,14 @@ ;;; ARGS: --enable-exceptions ;;; ERROR: 1 (module + (event (param i32)) (func try - catch + catch 0 end )) (;; STDERR ;;; -out/test/typecheck/bad-empty-catch.txt:7:5: error: type mismatch in try catch, expected [] but got [exnref] - catch - ^^^^^ +out/test/typecheck/bad-empty-catch.txt:9:5: error: type mismatch in try catch, expected [] but got [i32] + end + ^^^ ;;; STDERR ;;) diff --git a/test/typecheck/bad-rethrow-depth.txt b/test/typecheck/bad-rethrow-depth.txt new file mode 100644 index 000000000..6740771d7 --- /dev/null +++ b/test/typecheck/bad-rethrow-depth.txt @@ -0,0 +1,22 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +;;; ARGS: --enable-exceptions +(module + (event $e) + (func + try + nop + catch $e + block + try + nop + catch $e + rethrow 2 + end + end + end)) +(;; STDERR ;;; +out/test/typecheck/bad-rethrow-depth.txt:14:11: error: invalid rethrow depth: 2 (catches: 0, 1) + rethrow 2 + ^^^^^^^ +;;; STDERR ;;) diff --git a/test/typecheck/bad-rethrow-not-in-catch.txt b/test/typecheck/bad-rethrow-not-in-catch.txt new file mode 100644 index 000000000..e91cccbda --- /dev/null +++ b/test/typecheck/bad-rethrow-not-in-catch.txt @@ -0,0 +1,17 @@ +;;; TOOL: wat2wasm +;;; ERROR: 1 +;;; ARGS: --enable-exceptions +(module + (event $e) + (func + block + try + rethrow 0 + catch $e + end + end)) +(;; STDERR ;;; +out/test/typecheck/bad-rethrow-not-in-catch.txt:9:9: error: rethrow not in try catch block + rethrow 0 + ^^^^^^^ +;;; STDERR ;;) diff --git a/test/typecheck/delegate.txt b/test/typecheck/delegate.txt new file mode 100644 index 000000000..b5bf08a98 --- /dev/null +++ b/test/typecheck/delegate.txt @@ -0,0 +1,33 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module + (event $e) + (func + try + block + try + throw $e + delegate 0 + end + catch $e + end) + + (func + try + block + try + throw $e + delegate 1 + end + catch $e + end) + + (func + try + block + try + throw $e + delegate 2 + end + catch $e + end)) diff --git a/test/typecheck/rethrow.txt b/test/typecheck/rethrow.txt new file mode 100644 index 000000000..8b389364a --- /dev/null +++ b/test/typecheck/rethrow.txt @@ -0,0 +1,29 @@ +;;; TOOL: wat2wasm +;;; ARGS: --enable-exceptions +(module + (event $e) + (func + try + nop + catch $e + block + try + nop + catch $e + rethrow 0 + end + end + end) + + (func + try + nop + catch $e + block + try + nop + catch $e + rethrow 1 + end + end + end))