diff options
author | Asumu Takikawa <asumu@igalia.com> | 2021-02-09 12:12:01 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-10 05:12:01 +0900 |
commit | 036a632a24679062e7fc891e7743195139bfa0a9 (patch) | |
tree | 6e639f32f3d4d1dee55280709cc5607153e3002f /src | |
parent | 09ac53e41d959ce8e14e703e627327971e67f6d3 (diff) | |
download | wabt-036a632a24679062e7fc891e7743195139bfa0a9.tar.gz wabt-036a632a24679062e7fc891e7743195139bfa0a9.tar.bz2 wabt-036a632a24679062e7fc891e7743195139bfa0a9.zip |
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.
Diffstat (limited to 'src')
38 files changed, 1893 insertions, 1477 deletions
diff --git a/src/apply-names.cc b/src/apply-names.cc index 95868176..0159091f 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 b59598c4..53a52233 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> 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<BrIfExpr>(Var(depth))); } -Result BinaryReaderIR::OnBrOnExnExpr(Index depth, Index event_index) { - auto expr = MakeUnique<BrOnExnExpr>(); - 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<NopExpr>()); } -Result BinaryReaderIR::OnRethrowExpr() { - return AppendExpr(MakeUnique<RethrowExpr>()); +Result BinaryReaderIR::OnRethrowExpr(Index depth) { + return AppendExpr(MakeUnique<RethrowExpr>(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<TryExpr>(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<TryExpr>(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<TryExpr>(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<TryExpr>(&parent_label->exprs->back())->catch_; + PopLabel(); return Result::Ok; } diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc index 8090c95b..2c2d1e7f 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 909b0ce7..30dc0712 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 72cd1b2b..1f29a670 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 77d207d2..f03283e7 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 0cf06a0e..495de306 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 a7fa7842..6ba4c9b7 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 68d32c83..6ef3e71d 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<BrIfExpr>(expr)->var), "break depth"); break; - case ExprType::BrOnExn: { - auto* br_on_exn_expr = cast<BrOnExnExpr>(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<BrTableExpr>(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<RethrowExpr>(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 843abf26..d1129b20 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 45b75afd..dbac0a89 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 b9261e8b..f622e3fd 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 448bca00..af80e705 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,12 +96,27 @@ 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; @@ -108,8 +124,28 @@ Result ExprVisitor::VisitExpr(Expr* root_expr) { case State::Catch: { auto try_expr = cast<TryExpr>(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<TryExpr>(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<BrIfExpr>(expr))); break; - case ExprType::BrOnExn: - CHECK_RESULT(delegate_->OnBrOnExnExpr(cast<BrOnExnExpr>(expr))); - break; - case ExprType::BrTable: CHECK_RESULT(delegate_->OnBrTableExpr(cast<BrTableExpr>(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 c4880bf0..f30607ce 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> state_stack_; std::vector<Expr*> expr_stack_; std::vector<ExprList::iterator> expr_iter_stack_; + std::vector<Index> 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 5b9e702b..001b2d90 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<Ref>().index); - case Type::ExnRef: - return StringPrintf("exnref:%" PRIzd, tv.value.Get<Ref>().index); - case Type::Func: case Type::Struct: case Type::Array: diff --git a/src/interp/interp.cc b/src/interp/interp.cc index 8d8ccc99..ce1897bb 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 e4693c11..6c531a88 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 8b1e415e..ef1c9a20 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<BrTableExpr>(&expr)->default_target) + 1, 1, true }; @@ -36,7 +36,6 @@ const char* ExprTypeName[] = { "Block", "Br", "BrIf", - "BrOnExn", "BrTable", "Call", "CallIndirect", @@ -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<Catch> CatchVector; + +enum class TryKind { + Invalid, + Catch, + Unwind, + Delegate +}; + class Expr : public intrusive_list_base<Expr> { public: WABT_DISALLOW_COPY_AND_ASSIGN(Expr); @@ -395,7 +414,6 @@ typedef ExprMixin<ExprType::MemorySize> MemorySizeExpr; typedef ExprMixin<ExprType::MemoryCopy> MemoryCopyExpr; typedef ExprMixin<ExprType::MemoryFill> MemoryFillExpr; typedef ExprMixin<ExprType::Nop> NopExpr; -typedef ExprMixin<ExprType::Rethrow> RethrowExpr; typedef ExprMixin<ExprType::Return> ReturnExpr; typedef ExprMixin<ExprType::Unreachable> UnreachableExpr; @@ -464,6 +482,7 @@ typedef VarExpr<ExprType::LocalSet> LocalSetExpr; typedef VarExpr<ExprType::LocalTee> LocalTeeExpr; typedef VarExpr<ExprType::ReturnCall> ReturnCallExpr; typedef VarExpr<ExprType::Throw> ThrowExpr; +typedef VarExpr<ExprType::Rethrow> RethrowExpr; typedef VarExpr<ExprType::MemoryInit> MemoryInitExpr; typedef VarExpr<ExprType::DataDrop> DataDropExpr; @@ -548,19 +567,13 @@ class IfExpr : public ExprMixin<ExprType::If> { class TryExpr : public ExprMixin<ExprType::Try> { public: explicit TryExpr(const Location& loc = Location()) - : ExprMixin<ExprType::Try>(loc) {} + : ExprMixin<ExprType::Try>(loc), kind(TryKind::Invalid) {} + TryKind kind; Block block; - ExprList catch_; -}; - -class BrOnExnExpr : public ExprMixin<ExprType::BrOnExn> { - public: - BrOnExnExpr(const Location& loc = Location()) - : ExprMixin<ExprType::BrOnExn>(loc) {} - - Var label_var; - Var event_var; + CatchVector catches; + ExprList unwind; + Var delegate_target; }; class BrTableExpr : public ExprMixin<ExprType::BrTable> { diff --git a/src/lexer-keywords.txt b/src/lexer-keywords.txt index caf3ec19..b62c28b3 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 c3e06d03..6a746c5e 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 ed3d9280..03d24797 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 bfd5ecc8..2156f118 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 94cd4cb8..80d3181b 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 d45c5cb4..8fa70e28 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 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 271 "src/lexer-keywords.txt" + {"i32.rem_s", TokenType::Binary, Opcode::I32RemS}, +#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.nearest", TokenType::Unary, Opcode::F64Nearest}, +#line 73 "src/lexer-keywords.txt" + {"f32.nearest", TokenType::Unary, Opcode::F32Nearest}, + {""}, +#line 40 "src/lexer-keywords.txt" + {"declare", TokenType::Declare}, +#line 585 "src/lexer-keywords.txt" + {"unwind", TokenType::Unwind, Opcode::Unwind}, {""}, {""}, -#line 386 "src/lexer-keywords.txt" +#line 111 "src/lexer-keywords.txt" + {"f64.ceil", TokenType::Unary, Opcode::F64Ceil}, +#line 54 "src/lexer-keywords.txt" + {"f32.ceil", TokenType::Unary, Opcode::F32Ceil}, + {""}, {""}, {""}, +#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 259 "src/lexer-keywords.txt" +#line 258 "src/lexer-keywords.txt" {"i32.le_u", TokenType::Compare, Opcode::I32LeU}, -#line 521 "src/lexer-keywords.txt" - {"table", TokenType::Table}, +#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_s", TokenType::Binary, Opcode::I64RemS}, -#line 272 "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" +#line 272 "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 129 "src/lexer-keywords.txt" +#line 372 "src/lexer-keywords.txt" + {"i64.div_u", TokenType::Binary, Opcode::I64DivU}, +#line 248 "src/lexer-keywords.txt" + {"i32.div_u", TokenType::Binary, Opcode::I32DivU}, +#line 474 "src/lexer-keywords.txt" + {"invoke", TokenType::Invoke}, + {""}, {""}, {""}, {""}, {""}, +#line 128 "src/lexer-keywords.txt" {"f64.mul", TokenType::Binary, Opcode::F64Mul}, -#line 73 "src/lexer-keywords.txt" +#line 72 "src/lexer-keywords.txt" {"f32.mul", TokenType::Binary, Opcode::F32Mul}, {""}, -#line 396 "src/lexer-keywords.txt" +#line 395 "src/lexer-keywords.txt" {"i64.mul", TokenType::Binary, Opcode::I64Mul}, -#line 267 "src/lexer-keywords.txt" +#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 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 139 "src/lexer-keywords.txt" + {"f64x2.abs", TokenType::Unary, Opcode::F64X2Abs}, {""}, {""}, {""}, -#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 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" +#line 514 "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 108 "src/lexer-keywords.txt" + {"f32x4", TokenType::F32X4}, + {""}, {""}, #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" - {"f64.ceil", TokenType::Unary, Opcode::F64Ceil}, -#line 55 "src/lexer-keywords.txt" - {"f32.ceil", TokenType::Unary, Opcode::F32Ceil}, + {"i32x4", TokenType::I32X4}, {""}, -#line 152 "src/lexer-keywords.txt" +#line 151 "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 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" - {"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 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 426 "src/lexer-keywords.txt" - {"i64x2.mul", TokenType::Binary, Opcode::I64X2Mul}, -#line 535 "src/lexer-keywords.txt" - {"v128", Type::V128}, - {""}, {""}, -#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 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 497 "src/lexer-keywords.txt" - {"output", TokenType::Output}, + {"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 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 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" +#line 388 "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 422 "src/lexer-keywords.txt" - {"i64x2.add", TokenType::Binary, Opcode::I64X2Add}, - {""}, {""}, {""}, -#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" - {"i64.atomic.load", TokenType::AtomicLoad, Opcode::I64AtomicLoad}, -#line 220 "src/lexer-keywords.txt" - {"i32.atomic.load", TokenType::AtomicLoad, Opcode::I32AtomicLoad}, - {""}, -#line 474 "src/lexer-keywords.txt" - {"input", TokenType::Input}, - {""}, -#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 533 "src/lexer-keywords.txt" + {"v128.store", TokenType::Store, Opcode::V128Store}, +#line 83 "src/lexer-keywords.txt" + {"f32x4.add", TokenType::Binary, Opcode::F32X4Add}, {""}, {""}, -#line 91 "src/lexer-keywords.txt" - {"f32x4.floor", TokenType::Unary, Opcode::F32X4Floor}, - {""}, {""}, {""}, {""}, {""}, +#line 293 "src/lexer-keywords.txt" + {"i32x4.add", TokenType::Binary, Opcode::I32X4Add}, + {""}, {""}, {""}, {""}, #line 114 "src/lexer-keywords.txt" - {"f64.convert_i32_s", TokenType::Convert, Opcode::F64ConvertI32S}, + {"f64.convert_i32_u", TokenType::Convert, Opcode::F64ConvertI32U}, #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 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}, + {"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 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 31 "src/lexer-keywords.txt" - {"br_on_exn", TokenType::BrOnExn, Opcode::BrOnExn}, -#line 377 "src/lexer-keywords.txt" - {"i64.extend32_s", TokenType::Unary, Opcode::I64Extend32S}, - {""}, {""}, -#line 163 "src/lexer-keywords.txt" - {"f64x2.trunc", TokenType::Unary, Opcode::F64X2Trunc}, +#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 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" - {"i64.extend_i32_s", TokenType::Convert, Opcode::I64ExtendI32S}, - {""}, +#line 82 "src/lexer-keywords.txt" + {"f32x4.abs", TokenType::Unary, Opcode::F32X4Abs}, #line 335 "src/lexer-keywords.txt" - {"i64.atomic.load8_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad8U}, + {"i64.atomic.load", TokenType::AtomicLoad, Opcode::I64AtomicLoad}, #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}, + {"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 524 "src/lexer-keywords.txt" + {"type", TokenType::Type}, + {""}, +#line 43 "src/lexer-keywords.txt" + {"drop", TokenType::Drop, Opcode::Drop}, {""}, {""}, {""}, -#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 96 "src/lexer-keywords.txt" + {"f32x4.min", TokenType::Binary, Opcode::F32X4Min}, {""}, {""}, -#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 98 "src/lexer-keywords.txt" + {"f32x4.nearest", TokenType::Unary, Opcode::F32X4Nearest}, + {""}, {""}, {""}, {""}, +#line 507 "src/lexer-keywords.txt" + {"return_call", TokenType::ReturnCall, Opcode::ReturnCall}, {""}, -#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 397 "src/lexer-keywords.txt" + {"i64.or", TokenType::Binary, Opcode::I64Or}, +#line 268 "src/lexer-keywords.txt" + {"i32.or", TokenType::Binary, Opcode::I32Or}, {""}, {""}, -#line 481 "src/lexer-keywords.txt" - {"loop", TokenType::Loop, Opcode::Loop}, -#line 507 "src/lexer-keywords.txt" - {"return_call_indirect", TokenType::ReturnCallIndirect, Opcode::ReturnCallIndirect}, +#line 51 "src/lexer-keywords.txt" + {"export", TokenType::Export}, + {""}, +#line 84 "src/lexer-keywords.txt" + {"f32x4.ceil", TokenType::Unary, Opcode::F32X4Ceil}, +#line 472 "src/lexer-keywords.txt" + {"import", TokenType::Import}, {""}, {""}, -#line 117 "src/lexer-keywords.txt" - {"f64.convert_i64_u", TokenType::Convert, Opcode::F64ConvertI64U}, -#line 60 "src/lexer-keywords.txt" - {"f32.convert_i64_u", TokenType::Convert, Opcode::F32ConvertI64U}, +#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 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 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 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 296 "src/lexer-keywords.txt" + {"i32x4.bitmask", TokenType::Unary, Opcode::I32X4Bitmask}, + {""}, +#line 522 "src/lexer-keywords.txt" + {"throw", TokenType::Throw, Opcode::Throw}, {""}, {""}, {""}, {""}, -#line 489 "src/lexer-keywords.txt" - {"memory.size", TokenType::MemorySize, Opcode::MemorySize}, -#line 529 "src/lexer-keywords.txt" - {"v128.bitselect", TokenType::Ternary, Opcode::V128BitSelect}, +#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 42 "src/lexer-keywords.txt" - {"drop", TokenType::Drop, Opcode::Drop}, - {""}, {""}, -#line 498 "src/lexer-keywords.txt" - {"param", TokenType::Param}, -#line 158 "src/lexer-keywords.txt" - {"f64x2.pmin", TokenType::Binary, Opcode::F64X2PMin}, +#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 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_s", TokenType::Convert, Opcode::I64TruncSatF32S}, -#line 287 "src/lexer-keywords.txt" - {"i32.trunc_sat_f32_s", TokenType::Convert, Opcode::I32TruncSatF32S}, - {""}, {""}, -#line 418 "src/lexer-keywords.txt" {"i64.trunc_sat_f32_u", TokenType::Convert, Opcode::I64TruncSatF32U}, -#line 288 "src/lexer-keywords.txt" +#line 287 "src/lexer-keywords.txt" {"i32.trunc_sat_f32_u", TokenType::Convert, Opcode::I32TruncSatF32U}, - {""}, {""}, {""}, -#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 334 "src/lexer-keywords.txt" - {"i64.atomic.load32_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad32U}, - {""}, {""}, -#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" - {"f64x2.splat", TokenType::Unary, Opcode::F64X2Splat}, -#line 168 "src/lexer-keywords.txt" - {"get", TokenType::Get}, {""}, -#line 432 "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 351 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AddU}, -#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}, +#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 572 "src/lexer-keywords.txt" - {"i64.extend_s/i32", TokenType::Convert, Opcode::I64ExtendI32S}, +#line 480 "src/lexer-keywords.txt" + {"loop", TokenType::Loop, Opcode::Loop}, {""}, -#line 573 "src/lexer-keywords.txt" - {"i64.extend_u/i32", TokenType::Convert, Opcode::I64ExtendI32U}, +#line 116 "src/lexer-keywords.txt" + {"f64.convert_i64_u", TokenType::Convert, Opcode::F64ConvertI64U}, +#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 500 "src/lexer-keywords.txt" - {"ref.extern", TokenType::RefExtern}, - {""}, {""}, {""}, -#line 575 "src/lexer-keywords.txt" +#line 574 "src/lexer-keywords.txt" {"i64.trunc_s/f32", TokenType::Convert, Opcode::I64TruncF32S}, -#line 563 "src/lexer-keywords.txt" +#line 562 "src/lexer-keywords.txt" {"i32.trunc_s/f32", TokenType::Convert, Opcode::I32TruncF32S}, -#line 579 "src/lexer-keywords.txt" + {""}, +#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 567 "src/lexer-keywords.txt" +#line 566 "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 107 "src/lexer-keywords.txt" + {"f32x4.trunc", TokenType::Unary, Opcode::F32X4Trunc}, +#line 529 "src/lexer-keywords.txt" + {"v128.const", TokenType::Const, Opcode::V128Const}, + {""}, #line 555 "src/lexer-keywords.txt" - {"f64.convert_s/i64", TokenType::Convert, Opcode::F64ConvertI64S}, + {"f64.convert_u/i32", TokenType::Convert, Opcode::F64ConvertI32U}, #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 361 "src/lexer-keywords.txt" - {"i64.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I64AtomicRmwOr}, -#line 238 "src/lexer-keywords.txt" - {"i32.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I32AtomicRmwOr}, + {"f32.convert_u/i32", TokenType::Convert, Opcode::F32ConvertI32U}, {""}, {""}, -#line 127 "src/lexer-keywords.txt" - {"f64.max", TokenType::Binary, Opcode::F64Max}, -#line 71 "src/lexer-keywords.txt" - {"f32.max", TokenType::Binary, Opcode::F32Max}, +#line 498 "src/lexer-keywords.txt" + {"quote", TokenType::Quote}, {""}, -#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 333 "src/lexer-keywords.txt" + {"i64.atomic.load32_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad32U}, + {""}, {""}, +#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 313 "src/lexer-keywords.txt" + {"i32x4.mul", TokenType::Binary, Opcode::I32X4Mul}, + {""}, {""}, {""}, +#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 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 134 "src/lexer-keywords.txt" + {"f64.sqrt", TokenType::Unary, Opcode::F64Sqrt}, +#line 77 "src/lexer-keywords.txt" + {"f32.sqrt", TokenType::Unary, Opcode::F32Sqrt}, {""}, {""}, -#line 328 "src/lexer-keywords.txt" - {"i32x4.widen_low_i16x8_s", TokenType::Unary, Opcode::I32X4WidenLowI16X8S}, +#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 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 497 "src/lexer-keywords.txt" + {"param", TokenType::Param}, + {""}, {""}, +#line 294 "src/lexer-keywords.txt" + {"i32x4.all_true", TokenType::Unary, Opcode::I32X4AllTrue}, {""}, -#line 302 "src/lexer-keywords.txt" - {"i32x4.gt_s", TokenType::Compare, Opcode::I32X4GtS}, +#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 506 "src/lexer-keywords.txt" + {"return_call_indirect", TokenType::ReturnCallIndirect, Opcode::ReturnCallIndirect}, {""}, -#line 303 "src/lexer-keywords.txt" - {"i32x4.gt_u", TokenType::Compare, Opcode::I32X4GtU}, -#line 359 "src/lexer-keywords.txt" +#line 431 "src/lexer-keywords.txt" + {"i64x2.splat", TokenType::Unary, Opcode::I64X2Splat}, + {""}, {""}, +#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.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AndU}, +#line 228 "src/lexer-keywords.txt" + {"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 236 "src/lexer-keywords.txt" +#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 300 "src/lexer-keywords.txt" - {"i32x4.ge_s", TokenType::Compare, Opcode::I32X4GeS}, +#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 301 "src/lexer-keywords.txt" - {"i32x4.ge_u", TokenType::Compare, Opcode::I32X4GeU}, +#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 96 "src/lexer-keywords.txt" - {"f32x4.max", TokenType::Binary, Opcode::F32X4Max}, - {""}, {""}, {""}, {""}, {""}, -#line 375 "src/lexer-keywords.txt" +#line 20 "src/lexer-keywords.txt" + {"array", Type::Array, TokenType::Array}, + {""}, +#line 167 "src/lexer-keywords.txt" + {"get", TokenType::Get}, + {""}, {""}, +#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 374 "src/lexer-keywords.txt" {"i64.eqz", TokenType::Convert, Opcode::I64Eqz}, -#line 251 "src/lexer-keywords.txt" +#line 250 "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 299 "src/lexer-keywords.txt" - {"i32x4.extract_lane", TokenType::SimdLaneOp, Opcode::I32X4ExtractLane}, +#line 503 "src/lexer-keywords.txt" + {"register", TokenType::Register}, +#line 30 "src/lexer-keywords.txt" + {"br_if", TokenType::BrIf, Opcode::BrIf}, {""}, {""}, {""}, -#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 376 "src/lexer-keywords.txt" - {"i64.extend16_s", TokenType::Unary, Opcode::I64Extend16S}, -#line 252 "src/lexer-keywords.txt" - {"i32.extend16_s", TokenType::Unary, Opcode::I32Extend16S}, -#line 516 "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 571 "src/lexer-keywords.txt" + {"i64.extend_s/i32", TokenType::Convert, Opcode::I64ExtendI32S}, {""}, {""}, {""}, -#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 361 "src/lexer-keywords.txt" + {"i64.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I64AtomicRmwSub}, +#line 238 "src/lexer-keywords.txt" + {"i32.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I32AtomicRmwSub}, + {""}, +#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 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" +#line 256 "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 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 148 "src/lexer-keywords.txt" +#line 146 "src/lexer-keywords.txt" + {"f64x2.ge", TokenType::Compare, Opcode::F64X2Ge}, + {""}, +#line 572 "src/lexer-keywords.txt" + {"i64.extend_u/i32", TokenType::Convert, Opcode::I64ExtendI32U}, + {""}, +#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 133 "src/lexer-keywords.txt" + {"f64.reinterpret_i64", TokenType::Convert, Opcode::F64ReinterpretI64}, + {""}, +#line 377 "src/lexer-keywords.txt" + {"i64.extend8_s", TokenType::Unary, Opcode::I64Extend8S}, +#line 252 "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 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 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 132 "src/lexer-keywords.txt" + {"f64.promote_f32", TokenType::Convert, Opcode::F64PromoteF32}, + {""}, {""}, {""}, +#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 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" - {"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 453 "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 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 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 451 "src/lexer-keywords.txt" - {"i8x16.le_s", TokenType::Compare, Opcode::I8X16LeS}, +#line 470 "src/lexer-keywords.txt" + {"i8x16", TokenType::I8X16}, {""}, -#line 452 "src/lexer-keywords.txt" +#line 451 "src/lexer-keywords.txt" {"i8x16.le_u", TokenType::Compare, Opcode::I8X16LeU}, -#line 102 "src/lexer-keywords.txt" - {"f32x4.pmax", TokenType::Binary, Opcode::F32X4PMax}, {""}, {""}, -#line 339 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw16CmpxchgU}, -#line 223 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw16CmpxchgU}, +#line 453 "src/lexer-keywords.txt" + {"i8x16.lt_u", TokenType::Compare, Opcode::I8X16LtU}, {""}, -#line 170 "src/lexer-keywords.txt" - {"global.set", TokenType::GlobalSet, Opcode::GlobalSet}, -#line 558 "src/lexer-keywords.txt" - {"f64.promote/f32", TokenType::Convert, Opcode::F64PromoteF32}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 547 "src/lexer-keywords.txt" - {"anyfunc", Type::FuncRef}, +#line 85 "src/lexer-keywords.txt" + {"f32x4.convert_i32x4_s", TokenType::Unary, Opcode::F32X4ConvertI32X4S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, -#line 495 "src/lexer-keywords.txt" - {"nop", TokenType::Nop, Opcode::Nop}, +#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 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 494 "src/lexer-keywords.txt" + {"nop", TokenType::Nop, Opcode::Nop}, +#line 339 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16OrU}, +#line 223 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16OrU}, +#line 438 "src/lexer-keywords.txt" + {"i8x16.add", TokenType::Binary, Opcode::I8X16Add}, {""}, {""}, {""}, -#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 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 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 202 "src/lexer-keywords.txt" +#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 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 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 435 "src/lexer-keywords.txt" - {"i64.xor", TokenType::Binary, Opcode::I64Xor}, -#line 330 "src/lexer-keywords.txt" - {"i32.xor", TokenType::Binary, Opcode::I32Xor}, - {""}, -#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}, + {"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 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 300 "src/lexer-keywords.txt" + {"i32x4.ge_u", TokenType::Compare, Opcode::I32X4GeU}, +#line 558 "src/lexer-keywords.txt" + {"f64.reinterpret/i64", TokenType::Convert, Opcode::F64ReinterpretI64}, {""}, -#line 483 "src/lexer-keywords.txt" - {"memory.atomic.wait32", TokenType::AtomicWait, Opcode::MemoryAtomicWait32}, +#line 302 "src/lexer-keywords.txt" + {"i32x4.gt_u", TokenType::Compare, Opcode::I32X4GtU}, + {""}, {""}, {""}, {""}, #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 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 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 211 "src/lexer-keywords.txt" - {"i16x8", TokenType::I16X8}, +#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 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 583 "src/lexer-keywords.txt" - {"set_global", TokenType::GlobalSet, Opcode::GlobalSet}, +#line 546 "src/lexer-keywords.txt" + {"anyfunc", Type::FuncRef}, {""}, {""}, -#line 20 "src/lexer-keywords.txt" - {"array", Type::Array, TokenType::Array}, - {""}, {""}, {""}, {""}, -#line 173 "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 87 "src/lexer-keywords.txt" - {"f32x4.convert_i32x4_u", TokenType::Unary, Opcode::F32X4ConvertI32X4U}, +#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.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw8CmpxchgU}, + {"i64.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8OrU}, #line 230 "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 210 "src/lexer-keywords.txt" - {"i16x8.sub", TokenType::Binary, Opcode::I16X8Sub}, + {"i32.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8OrU}, +#line 525 "src/lexer-keywords.txt" + {"unreachable", TokenType::Unreachable, Opcode::Unreachable}, {""}, {""}, -#line 517 "src/lexer-keywords.txt" - {"table.grow", TokenType::TableGrow, Opcode::TableGrow}, +#line 187 "src/lexer-keywords.txt" + {"i16x8.le_s", TokenType::Compare, Opcode::I16X8LeS}, {""}, {""}, -#line 306 "src/lexer-keywords.txt" - {"v128.load16x4_s", TokenType::Load, Opcode::V128Load16X4S}, +#line 191 "src/lexer-keywords.txt" + {"i16x8.lt_s", TokenType::Compare, Opcode::I16X8LtS}, {""}, -#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 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 104 "src/lexer-keywords.txt" - {"f32x4.replace_lane", TokenType::SimdLaneOp, Opcode::F32X4ReplaceLane}, +#line 209 "src/lexer-keywords.txt" + {"i16x8.sub", TokenType::Binary, Opcode::I16X8Sub}, {""}, {""}, -#line 317 "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 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 431 "src/lexer-keywords.txt" - {"i64x2.shr_u", TokenType::Binary, Opcode::I64X2ShrU}, - {""}, {""}, -#line 208 "src/lexer-keywords.txt" - {"i16x8.sub_sat_s", TokenType::Binary, Opcode::I16X8SubSatS}, +#line 192 "src/lexer-keywords.txt" + {"i16x8.lt_u", TokenType::Compare, Opcode::I16X8LtU}, {""}, -#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 468 "src/lexer-keywords.txt" + {"i8x16.sub_sat_u", TokenType::Binary, Opcode::I8X16SubSatU}, +#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 444 "src/lexer-keywords.txt" - {"i8x16.eq", TokenType::Compare, Opcode::I8X16Eq}, -#line 439 "src/lexer-keywords.txt" - {"i8x16.add", TokenType::Binary, Opcode::I8X16Add}, +#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 298 "src/lexer-keywords.txt" + {"i32x4.extract_lane", TokenType::SimdLaneOp, Opcode::I32X4ExtractLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 175 "src/lexer-keywords.txt" + {"i16x8.add", TokenType::Binary, Opcode::I16X8Add}, {""}, {""}, {""}, -#line 437 "src/lexer-keywords.txt" +#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 536 "src/lexer-keywords.txt" - {"v128.xor", TokenType::Binary, Opcode::V128Xor}, -#line 438 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, +#line 172 "src/lexer-keywords.txt" + {"i16x8.abs", TokenType::Unary, Opcode::I16X8Abs}, + {""}, {""}, {""}, +#line 541 "src/lexer-keywords.txt" + {"i8x16.swizzle", TokenType::Binary, Opcode::I8X16Swizzle}, + {""}, +#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 437 "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" + {""}, {""}, +#line 291 "src/lexer-keywords.txt" {"i32.wrap_i64", TokenType::Convert, Opcode::I32WrapI64}, - {""}, {""}, {""}, {""}, -#line 28 "src/lexer-keywords.txt" - {"binary", TokenType::Bin}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#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 305 "src/lexer-keywords.txt" + {"v128.load16x4_s", TokenType::Load, Opcode::V128Load16X4S}, {""}, {""}, {""}, -#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 119 "src/lexer-keywords.txt" + {"f64.eq", TokenType::Compare, Opcode::F64Eq}, +#line 63 "src/lexer-keywords.txt" + {"f32.eq", TokenType::Compare, Opcode::F32Eq}, {""}, -#line 539 "src/lexer-keywords.txt" - {"v128.load64_splat", TokenType::Load, Opcode::V128Load64Splat}, -#line 538 "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 373 "src/lexer-keywords.txt" + {"i64.eq", TokenType::Compare, Opcode::I64Eq}, +#line 249 "src/lexer-keywords.txt" + {"i32.eq", TokenType::Compare, Opcode::I32Eq}, {""}, -#line 175 "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 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 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 352 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw8CmpxchgU}, +#line 229 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw8CmpxchgU}, {""}, -#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 196 "src/lexer-keywords.txt" + {"i16x8.min_u", TokenType::Binary, Opcode::I16X8MinU}, + {""}, +#line 349 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XorU}, {""}, {""}, -#line 324 "src/lexer-keywords.txt" - {"i32x4.trunc_sat_f32x4_s", TokenType::Unary, Opcode::I32X4TruncSatF32X4S}, +#line 179 "src/lexer-keywords.txt" + {"i16x8.bitmask", TokenType::Unary, Opcode::I16X8Bitmask}, {""}, -#line 325 "src/lexer-keywords.txt" - {"i32x4.trunc_sat_f32x4_u", TokenType::Unary, Opcode::I32X4TruncSatF32X4U}, +#line 103 "src/lexer-keywords.txt" + {"f32x4.replace_lane", TokenType::SimdLaneOp, Opcode::F32X4ReplaceLane}, + {""}, {""}, +#line 316 "src/lexer-keywords.txt" + {"i32x4.replace_lane", TokenType::SimdLaneOp, Opcode::I32X4ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 455 "src/lexer-keywords.txt" - {"i8x16.max_s", TokenType::Binary, Opcode::I8X16MaxS}, +#line 207 "src/lexer-keywords.txt" + {"i16x8.sub_sat_s", TokenType::Binary, Opcode::I16X8SubSatS}, {""}, {""}, {""}, -#line 456 "src/lexer-keywords.txt" - {"i8x16.max_u", TokenType::Binary, Opcode::I8X16MaxU}, - {""}, -#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 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 177 "src/lexer-keywords.txt" - {"i16x8.all_true", TokenType::Unary, Opcode::I16X8AllTrue}, +#line 539 "src/lexer-keywords.txt" + {"v128.load8_splat", TokenType::Load, Opcode::V128Load8Splat}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 208 "src/lexer-keywords.txt" + {"i16x8.sub_sat_u", TokenType::Binary, Opcode::I16X8SubSatU}, + {""}, {""}, +#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 489 "src/lexer-keywords.txt" + {"memory", TokenType::Memory}, +#line 95 "src/lexer-keywords.txt" + {"f32x4.max", TokenType::Binary, Opcode::F32X4Max}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#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.load16_splat", TokenType::Load, Opcode::V128Load16Splat}, + {"v128.load32_splat", TokenType::Load, Opcode::V128Load32Splat}, {""}, -#line 542 "src/lexer-keywords.txt" - {"i8x16.swizzle", TokenType::Binary, Opcode::I8X16Swizzle}, +#line 174 "src/lexer-keywords.txt" + {"i16x8.add_sat_u", TokenType::Binary, Opcode::I16X8AddSatU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, -#line 553 "src/lexer-keywords.txt" - {"f32.reinterpret/i32", TokenType::Convert, Opcode::F32ReinterpretI32}, -#line 493 "src/lexer-keywords.txt" - {"nan:arithmetic", TokenType::NanArithmetic}, + {""}, {""}, {""}, +#line 348 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XchgU}, {""}, -#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 176 "src/lexer-keywords.txt" + {"i16x8.all_true", TokenType::Unary, Opcode::I16X8AllTrue}, + {""}, {""}, {""}, {""}, +#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 59bb0493..46f397e3 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 9b928c04..5d3b8acf 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 f0f9a84b..456693bf 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 c0925123..e1123356 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 8f380ad8..c27e7a9f 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 a93d2b60..9136442b 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<int>(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 66b9b2e2..46730673 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 <typename... Args> void PrintStackIfFailed(Result result, const char* desc, Args... args) { @@ -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 "<invalid>"; @@ -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 e7f7b5a5..4733954f 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 e07289cb..6ae2d241 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<Expr>* out_expr) { CHECK_RESULT(ParsePlainInstrVar<BrIfExpr>(loc, out_expr)); break; - case TokenType::BrOnExn: { - Consume(); - auto expr = MakeUnique<BrOnExnExpr>(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<BrTableExpr>(loc); @@ -2043,7 +2034,7 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) { case TokenType::Rethrow: ErrorUnlessOpcodeEnabled(Consume()); - out_expr->reset(new RethrowExpr(loc)); + CHECK_RESULT(ParsePlainInstrVar<RethrowExpr>(loc, out_expr)); break; case TokenType::AtomicNotify: { @@ -2563,12 +2554,30 @@ Result WastParser::ParseBlockInstr(std::unique_ptr<Expr>* out_expr) { case TokenType::Try: { ErrorUnlessOpcodeEnabled(Consume()); auto expr = MakeUnique<TryExpr>(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 b25709de..9c82b250 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<Field>*); diff --git a/src/wat-writer.cc b/src/wat-writer.cc index a4c703dc..fd102130 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; } |