From b2b58f4d567524c1d9bb44474ecebd6c3509038e Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Wed, 6 May 2020 11:30:01 -0700 Subject: [PATCH] Reference types changes to remove subtyping Main changes: * Rename `anyref` -> `externref` * Remove `nullref` * Rename `hostref` -> `externref` * `ref.null` and `ref.is_null` now have "ref kind" parameter * Add ref kind keywords: `func`, `extern`, `exn` --- docs/wast2json.md | 3 +- src/binary-reader-ir.cc | 25 +- src/binary-reader-logging.cc | 24 +- src/binary-reader-logging.h | 9 +- src/binary-reader-nop.h | 10 +- src/binary-reader-objdump.cc | 25 +- src/binary-reader.cc | 44 +- src/binary-reader.h | 10 +- src/binary-writer-spec.cc | 11 +- src/binary-writer.cc | 3 + src/decompiler-ls.h | 3 +- src/feature.def | 2 +- src/interp/binary-reader-interp.cc | 26 +- src/interp/interp-inl.h | 11 +- src/interp/interp-util.cc | 12 +- src/interp/interp-wasm-c-api.cc | 38 +- src/interp/interp.cc | 23 +- src/interp/interp.h | 2 +- src/ir.h | 24 +- src/lexer-keywords.txt | 15 +- src/prebuilt/lexer-keywords.cc | 2414 +++++++++-------- src/shared-validator.cc | 18 +- src/shared-validator.h | 8 +- src/test-interp.cc | 4 +- src/token.cc | 2 + src/token.def | 14 +- src/token.h | 11 +- src/tools/spectest-interp.cc | 21 +- src/type-checker.cc | 28 +- src/type-checker.h | 4 +- src/type.h | 80 +- src/validator.cc | 10 +- src/wast-lexer.cc | 3 +- src/wast-parser.cc | 70 +- src/wast-parser.h | 3 +- src/wat-writer.cc | 12 +- test/decompile/basic.txt | 4 +- test/dump/reference-types.txt | 125 +- test/gen-spec-wast.py | 6 +- test/help/spectest-interp.txt | 2 +- test/help/wasm-interp.txt | 2 +- test/help/wasm-opcodecnt.txt | 2 +- test/help/wasm-validate.txt | 2 +- test/help/wasm2wat.txt | 2 +- test/help/wast2json.txt | 2 +- test/help/wat-desugar.txt | 2 +- test/help/wat2wasm.txt | 2 +- test/interp/reference-types.txt | 43 +- test/parse/all-features.txt | 2 +- test/parse/expr/bulk-memory-disabled.txt | 4 +- test/parse/expr/bulk-memory-named.txt | 2 +- test/parse/expr/reference-types-named.txt | 8 +- test/parse/expr/reference-types.txt | 37 +- test/parse/expr/table-get.txt | 4 +- test/parse/expr/table-grow.txt | 4 +- test/parse/expr/table-set.txt | 4 +- test/parse/func/bad-local-binding-no-type.txt | 2 +- test/parse/func/bad-local-binding.txt | 2 +- test/parse/func/bad-param-binding.txt | 2 +- test/parse/func/result-exnref.txt | 2 +- test/parse/module/bad-array-no-fields.txt | 2 +- test/parse/module/global-exnref.txt | 2 +- test/parse/module/global.txt | 5 +- .../parse/module/reference-types-disabled.txt | 8 +- test/roundtrip/bulk-memory.txt | 4 +- test/roundtrip/fold-reference-types.txt | 4 +- test/typecheck/if-anyref.txt | 4 +- 67 files changed, 1680 insertions(+), 1638 deletions(-) diff --git a/docs/wast2json.md b/docs/wast2json.md index efd7f853a..fa3a732be 100644 --- a/docs/wast2json.md +++ b/docs/wast2json.md @@ -157,8 +157,7 @@ The `reference-types` proposal adds three more valid types: | type | JSON format | | - | - | -| "nullref" | `{"type": "nullref", "value": ""}` | -| "hostref" | `{"type": "hostref", "value": }` | +| "externref" | `{"type": "externref", "value": }` | | "funcref" | `{"type": "funcref", "value": }` | diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc index d0c5a48be..591d5e677 100644 --- a/src/binary-reader-ir.cc +++ b/src/binary-reader-ir.cc @@ -184,8 +184,8 @@ class BinaryReaderIR : public BinaryReaderNop { Result OnTableSizeExpr(Index table_index) override; Result OnTableFillExpr(Index table_index) override; Result OnRefFuncExpr(Index func_index) override; - Result OnRefNullExpr() override; - Result OnRefIsNullExpr() override; + Result OnRefNullExpr(Type type) override; + Result OnRefIsNullExpr(Type type) override; Result OnNopExpr() override; Result OnRethrowExpr() override; Result OnReturnExpr() override; @@ -213,7 +213,7 @@ class BinaryReaderIR : public BinaryReaderNop { Result EndElemSegmentInitExpr(Index index) override; Result OnElemSegmentElemType(Index index, Type elem_type) override; Result OnElemSegmentElemExprCount(Index index, Index count) override; - Result OnElemSegmentElemExpr_RefNull(Index segment_index) override; + Result OnElemSegmentElemExpr_RefNull(Index segment_index, Type type) override; Result OnElemSegmentElemExpr_RefFunc(Index segment_index, Index func_index) override; @@ -247,7 +247,7 @@ class BinaryReaderIR : public BinaryReaderNop { Result OnInitExprGlobalGetExpr(Index index, Index global_index) override; Result OnInitExprI32ConstExpr(Index index, uint32_t value) override; Result OnInitExprI64ConstExpr(Index index, uint64_t value) override; - Result OnInitExprRefNull(Index index) override; + Result OnInitExprRefNull(Index index, Type type) override; Result OnInitExprRefFunc(Index index, Index func_index) override; Result OnDataSymbol(Index index, uint32_t flags, string_view name, @@ -916,12 +916,12 @@ Result BinaryReaderIR::OnRefFuncExpr(Index func_index) { return AppendExpr(MakeUnique(Var(func_index))); } -Result BinaryReaderIR::OnRefNullExpr() { - return AppendExpr(MakeUnique()); +Result BinaryReaderIR::OnRefNullExpr(Type type) { + return AppendExpr(MakeUnique(type)); } -Result BinaryReaderIR::OnRefIsNullExpr() { - return AppendExpr(MakeUnique()); +Result BinaryReaderIR::OnRefIsNullExpr(Type type) { + return AppendExpr(MakeUnique(type)); } Result BinaryReaderIR::OnNopExpr() { @@ -1075,10 +1075,11 @@ Result BinaryReaderIR::OnElemSegmentElemExprCount(Index index, Index count) { return Result::Ok; } -Result BinaryReaderIR::OnElemSegmentElemExpr_RefNull(Index segment_index) { +Result BinaryReaderIR::OnElemSegmentElemExpr_RefNull(Index segment_index, + Type type) { assert(segment_index == module_->elem_segments.size() - 1); ElemSegment* segment = module_->elem_segments[segment_index]; - segment->elem_exprs.emplace_back(); + segment->elem_exprs.emplace_back(type); return Result::Ok; } @@ -1228,9 +1229,9 @@ Result BinaryReaderIR::OnInitExprI64ConstExpr(Index index, uint64_t value) { return Result::Ok; } -Result BinaryReaderIR::OnInitExprRefNull(Index index) { +Result BinaryReaderIR::OnInitExprRefNull(Index index, Type type) { Location loc = GetLocation(); - current_init_expr_->push_back(MakeUnique(loc)); + current_init_expr_->push_back(MakeUnique(type, loc)); return Result::Ok; } diff --git a/src/binary-reader-logging.cc b/src/binary-reader-logging.cc index c3e7e7507..ef24ad0ec 100644 --- a/src/binary-reader-logging.cc +++ b/src/binary-reader-logging.cc @@ -652,12 +652,24 @@ Result BinaryReaderLogging::OnComdatEntry(ComdatType kind, Index index) { return reader_->name(value); \ } +#define DEFINE_TYPE(name) \ + Result BinaryReaderLogging::name(Type type) { \ + LOGF(#name "(%s)\n", type.GetName()); \ + return reader_->name(type); \ + } + #define DEFINE_INDEX_DESC(name, desc) \ Result BinaryReaderLogging::name(Index value) { \ LOGF(#name "(" desc ": %" PRIindex ")\n", value); \ return reader_->name(value); \ } +#define DEFINE_INDEX_TYPE(name) \ + Result BinaryReaderLogging::name(Index value, Type type) { \ + LOGF(#name "(index: %" PRIindex ", type: %s)\n", value, type.GetName()); \ + return reader_->name(value, type); \ + } + #define DEFINE_INDEX_INDEX(name, desc0, desc1) \ Result BinaryReaderLogging::name(Index value0, Index value1) { \ LOGF(#name "(" desc0 ": %" PRIindex ", " desc1 ": %" PRIindex ")\n", \ @@ -777,8 +789,8 @@ DEFINE_INDEX(OnTableGrowExpr) DEFINE_INDEX(OnTableSizeExpr) DEFINE_INDEX_DESC(OnTableFillExpr, "table index") DEFINE_INDEX(OnRefFuncExpr) -DEFINE0(OnRefNullExpr) -DEFINE0(OnRefIsNullExpr) +DEFINE_TYPE(OnRefNullExpr) +DEFINE_TYPE(OnRefIsNullExpr) DEFINE0(OnNopExpr) DEFINE0(OnRethrowExpr); DEFINE_INDEX_DESC(OnReturnCallExpr, "func_index") @@ -798,7 +810,7 @@ DEFINE_INDEX(OnElemSegmentCount) DEFINE_INDEX(BeginElemSegmentInitExpr) DEFINE_INDEX(EndElemSegmentInitExpr) DEFINE_INDEX_INDEX(OnElemSegmentElemExprCount, "index", "count") -DEFINE_INDEX(OnElemSegmentElemExpr_RefNull) +DEFINE_INDEX_TYPE(OnElemSegmentElemExpr_RefNull) DEFINE_INDEX_INDEX(OnElemSegmentElemExpr_RefFunc, "index", "func_index") DEFINE_INDEX(EndElemSegment) DEFINE_END(EndElemSection) @@ -825,7 +837,7 @@ DEFINE_BEGIN(BeginRelocSection) DEFINE_END(EndRelocSection) DEFINE_INDEX_INDEX(OnInitExprGlobalGetExpr, "index", "global_index") -DEFINE_INDEX(OnInitExprRefNull) +DEFINE_INDEX_TYPE(OnInitExprRefNull) DEFINE_INDEX_INDEX(OnInitExprRefFunc, "index", "func_index") DEFINE_BEGIN(BeginDylinkSection) @@ -891,6 +903,10 @@ Result BinaryReaderLogging::OnOpcodeBlockSig(Type sig_type) { return reader_->OnOpcodeBlockSig(sig_type); } +Result BinaryReaderLogging::OnOpcodeType(Type type) { + return reader_->OnOpcodeType(type); +} + Result BinaryReaderLogging::OnEndFunc() { return reader_->OnEndFunc(); } diff --git a/src/binary-reader-logging.h b/src/binary-reader-logging.h index 9f70b61a0..f59365626 100644 --- a/src/binary-reader-logging.h +++ b/src/binary-reader-logging.h @@ -140,6 +140,7 @@ class BinaryReaderLogging : public BinaryReaderDelegate { Result OnOpcodeF64(uint64_t value) override; Result OnOpcodeV128(v128 value) override; Result OnOpcodeBlockSig(Type sig_type) override; + Result OnOpcodeType(Type type) override; Result OnAtomicLoadExpr(Opcode opcode, uint32_t alignment_log2, Address offset) override; @@ -199,8 +200,8 @@ class BinaryReaderLogging : public BinaryReaderDelegate { Result OnTableSizeExpr(Index table) override; Result OnTableFillExpr(Index table) override; Result OnRefFuncExpr(Index index) override; - Result OnRefNullExpr() override; - Result OnRefIsNullExpr() override; + Result OnRefNullExpr(Type type) override; + Result OnRefIsNullExpr(Type type) override; Result OnNopExpr() override; Result OnRethrowExpr() override; Result OnReturnCallExpr(Index func_index) override; @@ -239,7 +240,7 @@ class BinaryReaderLogging : public BinaryReaderDelegate { Result EndElemSegmentInitExpr(Index index) override; Result OnElemSegmentElemType(Index index, Type elem_type) override; Result OnElemSegmentElemExprCount(Index index, Index count) override; - Result OnElemSegmentElemExpr_RefNull(Index segment_index) override; + Result OnElemSegmentElemExpr_RefNull(Index segment_index, Type type) override; Result OnElemSegmentElemExpr_RefFunc(Index segment_index, Index func_index) override; Result EndElemSegment(Index index) override; @@ -347,7 +348,7 @@ class BinaryReaderLogging : public BinaryReaderDelegate { Result OnInitExprGlobalGetExpr(Index index, Index global_index) override; Result OnInitExprI32ConstExpr(Index index, uint32_t value) override; Result OnInitExprI64ConstExpr(Index index, uint64_t value) override; - Result OnInitExprRefNull(Index index) override; + Result OnInitExprRefNull(Index index, Type type) override; Result OnInitExprRefFunc(Index index, Index func_index) override; private: diff --git a/src/binary-reader-nop.h b/src/binary-reader-nop.h index 6caed9a84..1159476ae 100644 --- a/src/binary-reader-nop.h +++ b/src/binary-reader-nop.h @@ -190,6 +190,7 @@ class BinaryReaderNop : public BinaryReaderDelegate { Result OnOpcodeF64(uint64_t value) override { return Result::Ok; } Result OnOpcodeV128(v128 value) override { return Result::Ok; } Result OnOpcodeBlockSig(Type sig_type) override { return Result::Ok; } + Result OnOpcodeType(Type type) override { return Result::Ok; } Result OnAtomicLoadExpr(Opcode opcode, uint32_t alignment_log2, Address offset) override { @@ -276,8 +277,8 @@ class BinaryReaderNop : public BinaryReaderDelegate { Result OnTableSizeExpr(Index table_index) override { return Result::Ok; } Result OnTableFillExpr(Index table_index) override { return Result::Ok; } Result OnRefFuncExpr(Index func_index) override { return Result::Ok; } - Result OnRefNullExpr() override { return Result::Ok; } - Result OnRefIsNullExpr() override { return Result::Ok; } + Result OnRefNullExpr(Type type) override { return Result::Ok; } + Result OnRefIsNullExpr(Type type) override { return Result::Ok; } Result OnNopExpr() override { return Result::Ok; } Result OnRethrowExpr() override { return Result::Ok; } Result OnReturnCallExpr(Index sig_index) override { return Result::Ok; } @@ -324,7 +325,8 @@ class BinaryReaderNop : public BinaryReaderDelegate { Result OnElemSegmentElemExprCount(Index index, Index count) override { return Result::Ok; } - Result OnElemSegmentElemExpr_RefNull(Index segment_index) override { + Result OnElemSegmentElemExpr_RefNull(Index segment_index, + Type type) override { return Result::Ok; } Result OnElemSegmentElemExpr_RefFunc(Index segment_index, @@ -508,7 +510,7 @@ class BinaryReaderNop : public BinaryReaderDelegate { Result OnInitExprI64ConstExpr(Index index, uint64_t value) override { return Result::Ok; } - Result OnInitExprRefNull(Index index) override { + Result OnInitExprRefNull(Index index, Type type) override { return Result::Ok; } Result OnInitExprRefFunc(Index index, Index func_index) override { diff --git a/src/binary-reader-objdump.cc b/src/binary-reader-objdump.cc index e21a7ff92..7570b8dfe 100644 --- a/src/binary-reader-objdump.cc +++ b/src/binary-reader-objdump.cc @@ -403,6 +403,7 @@ class BinaryReaderObjdumpDisassemble : public BinaryReaderObjdumpBase { Result OnOpcodeF64(uint64_t value) override; Result OnOpcodeV128(v128 value) override; Result OnOpcodeBlockSig(Type sig_type) override; + Result OnOpcodeType(Type type) override; Result OnBrTableExpr(Index num_targets, Index* target_depths, @@ -636,6 +637,12 @@ Result BinaryReaderObjdumpDisassemble::OnOpcodeV128(v128 value) { return Result::Ok; } +Result BinaryReaderObjdumpDisassemble::OnOpcodeType(Type type) { + Offset immediate_len = state->offset - current_opcode_offset; + LogOpcode(immediate_len, type.GetRefKindName()); + return Result::Ok; +} + Result BinaryReaderObjdumpDisassemble::OnBrTableExpr( Index num_targets, Index* target_depths, @@ -697,6 +704,8 @@ enum class InitExprType { V128, Global, FuncRef, + // TODO: There isn't a nullref anymore, this just represents ref.null of some + // type T. NullRef, }; @@ -709,6 +718,7 @@ struct InitExpr { uint64_t i64; uint64_t f64; v128 v128_v; + Type type; } value; }; @@ -804,7 +814,7 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase { uint8_t flags) override; Result OnElemSegmentElemType(Index index, Type elem_type) override; Result OnElemSegmentElemExprCount(Index index, Index count) override; - Result OnElemSegmentElemExpr_RefNull(Index segment_index) override; + Result OnElemSegmentElemExpr_RefNull(Index segment_index, Type type) override; Result OnElemSegmentElemExpr_RefFunc(Index segment_index, Index func_index) override; @@ -838,7 +848,7 @@ class BinaryReaderObjdump : public BinaryReaderObjdumpBase { Result OnInitExprGlobalGetExpr(Index index, Index global_index) override; Result OnInitExprI32ConstExpr(Index index, uint32_t value) override; Result OnInitExprI64ConstExpr(Index index, uint64_t value) override; - Result OnInitExprRefNull(Index index) override; + Result OnInitExprRefNull(Index index, Type type) override; Result OnInitExprRefFunc(Index index, Index func_index) override; Result OnDylinkInfo(uint32_t mem_size, @@ -1286,8 +1296,10 @@ Result BinaryReaderObjdump::OnExport(Index index, return Result::Ok; } -Result BinaryReaderObjdump::OnElemSegmentElemExpr_RefNull(Index segment_index) { - PrintDetails(" - elem[%" PRIindex "] = nullref\n", elem_offset_ + elem_index_); +Result BinaryReaderObjdump::OnElemSegmentElemExpr_RefNull(Index segment_index, + Type type) { + PrintDetails(" - elem[%" PRIindex "] = ref.null %s\n", + elem_offset_ + elem_index_, type.GetName()); elem_index_++; return Result::Ok; } @@ -1395,7 +1407,7 @@ void BinaryReaderObjdump::PrintInitExpr(const InitExpr& expr) { break; } case InitExprType::NullRef: { - PrintDetails(" - init nullref\n"); + PrintDetails(" - init null\n"); break; } } @@ -1489,9 +1501,10 @@ Result BinaryReaderObjdump::OnInitExprI64ConstExpr(Index index, return Result::Ok; } -Result BinaryReaderObjdump::OnInitExprRefNull(Index index) { +Result BinaryReaderObjdump::OnInitExprRefNull(Index index, Type type) { InitExpr expr; expr.type = InitExprType::NullRef; + expr.value.type = type; HandleInitExpr(expr); return Result::Ok; } diff --git a/src/binary-reader.cc b/src/binary-reader.cc index 86bb07bca..762c4c5d5 100644 --- a/src/binary-reader.cc +++ b/src/binary-reader.cc @@ -99,6 +99,7 @@ class BinaryReader { Result ReadS32Leb128(uint32_t* out_value, const char* desc) WABT_WARN_UNUSED; Result ReadS64Leb128(uint64_t* out_value, const char* desc) WABT_WARN_UNUSED; Result ReadType(Type* out_value, const char* desc) WABT_WARN_UNUSED; + Result ReadRefType(Type* out_value, const char* desc) WABT_WARN_UNUSED; Result ReadExternalKind(ExternalKind* out_value, const char* desc) WABT_WARN_UNUSED; Result ReadStr(string_view* out_str, const char* desc) WABT_WARN_UNUSED; @@ -302,6 +303,14 @@ Result BinaryReader::ReadType(Type* out_value, const char* desc) { return Result::Ok; } +Result BinaryReader::ReadRefType(Type* out_value, const char* desc) { + uint32_t type = 0; + CHECK_RESULT(ReadS32Leb128(&type, desc)); + *out_value = static_cast(type); + ERROR_UNLESS(out_value->IsRef(), "%s must be a reference type", desc); + return Result::Ok; +} + Result BinaryReader::ReadExternalKind(ExternalKind* out_value, const char* desc) { uint8_t value = 0; @@ -402,8 +411,7 @@ bool BinaryReader::IsConcreteType(Type type) { return options_.features.simd_enabled(); case Type::Funcref: - case Type::Anyref: - case Type::Nullref: + case Type::Externref: return options_.features.reference_types_enabled(); case Type::Exnref: @@ -483,9 +491,12 @@ Result BinaryReader::ReadInitExpr(Index index, bool require_i32) { break; } - case Opcode::RefNull: - CALLBACK(OnInitExprRefNull, index); + case Opcode::RefNull: { + Type type; + CHECK_RESULT(ReadRefType(&type, "ref.null type")); + CALLBACK(OnInitExprRefNull, index, type); break; + } case Opcode::RefFunc: { Index func_index; @@ -514,9 +525,7 @@ Result BinaryReader::ReadInitExpr(Index index, bool require_i32) { } Result BinaryReader::ReadTable(Type* out_elem_type, Limits* out_elem_limits) { - CHECK_RESULT(ReadType(out_elem_type, "table elem type")); - ERROR_UNLESS(out_elem_type->IsRef(), - "table elem type must be a reference type"); + CHECK_RESULT(ReadRefType(out_elem_type, "table elem type")); uint32_t flags; uint32_t initial; @@ -1545,14 +1554,18 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { } case Opcode::RefNull: { - CALLBACK(OnRefNullExpr); - CALLBACK0(OnOpcodeBare); + Type type; + CHECK_RESULT(ReadRefType(&type, "ref.null type")); + CALLBACK(OnRefNullExpr, type); + CALLBACK(OnOpcodeType, type); break; } case Opcode::RefIsNull: { - CALLBACK(OnRefIsNullExpr); - CALLBACK0(OnOpcodeBare); + Type type; + CHECK_RESULT(ReadRefType(&type, "ref.is_null type")); + CALLBACK(OnRefIsNullExpr, type); + CALLBACK(OnOpcodeType, type); break; } @@ -2197,10 +2210,7 @@ Result BinaryReader::ReadElemSection(Offset section_size) { // For backwards compat we support not declaring the element kind. if (flags & (SegPassive | SegExplicitIndex)) { if (flags & SegUseElemExprs) { - CHECK_RESULT(ReadType(&elem_type, "table elem type")); - ERROR_UNLESS(elem_type.IsRef(), - "segment elem expr type must be a reference type (got %s)", - elem_type.GetName()); + CHECK_RESULT(ReadRefType(&elem_type, "table elem type")); } else { ExternalKind kind; CHECK_RESULT(ReadExternalKind(&kind, "export kind")); @@ -2222,7 +2232,9 @@ Result BinaryReader::ReadElemSection(Offset section_size) { Opcode opcode; CHECK_RESULT(ReadOpcode(&opcode, "elem expr opcode")); if (opcode == Opcode::RefNull) { - CALLBACK(OnElemSegmentElemExpr_RefNull, i); + Type type; + CHECK_RESULT(ReadRefType(&type, "elem expr ref.null type")); + CALLBACK(OnElemSegmentElemExpr_RefNull, i, type); } else if (opcode == Opcode::RefFunc) { Index func_index; CHECK_RESULT(ReadIndex(&func_index, "elem expr func index")); diff --git a/src/binary-reader.h b/src/binary-reader.h index 405387ba6..eae1e87d5 100644 --- a/src/binary-reader.h +++ b/src/binary-reader.h @@ -199,6 +199,7 @@ class BinaryReaderDelegate { virtual Result OnOpcodeF64(uint64_t value) = 0; virtual Result OnOpcodeV128(v128 value) = 0; virtual Result OnOpcodeBlockSig(Type sig_type) = 0; + virtual Result OnOpcodeType(Type type) = 0; virtual Result OnAtomicLoadExpr(Opcode opcode, uint32_t alignment_log2, Address offset) = 0; @@ -265,8 +266,8 @@ class BinaryReaderDelegate { virtual Result OnTableSizeExpr(Index table_index) = 0; virtual Result OnTableFillExpr(Index table_index) = 0; virtual Result OnRefFuncExpr(Index func_index) = 0; - virtual Result OnRefNullExpr() = 0; - virtual Result OnRefIsNullExpr() = 0; + virtual Result OnRefNullExpr(Type type) = 0; + virtual Result OnRefIsNullExpr(Type type) = 0; virtual Result OnNopExpr() = 0; virtual Result OnRethrowExpr() = 0; virtual Result OnReturnExpr() = 0; @@ -304,7 +305,8 @@ class BinaryReaderDelegate { virtual Result EndElemSegmentInitExpr(Index index) = 0; virtual Result OnElemSegmentElemType(Index index, Type elem_type) = 0; virtual Result OnElemSegmentElemExprCount(Index index, Index count) = 0; - virtual Result OnElemSegmentElemExpr_RefNull(Index segment_index) = 0; + virtual Result OnElemSegmentElemExpr_RefNull(Index segment_index, + Type type) = 0; virtual Result OnElemSegmentElemExpr_RefFunc(Index segment_index, Index func_index) = 0; virtual Result EndElemSegment(Index index) = 0; @@ -425,7 +427,7 @@ class BinaryReaderDelegate { virtual Result OnInitExprGlobalGetExpr(Index index, Index global_index) = 0; virtual Result OnInitExprI32ConstExpr(Index index, uint32_t value) = 0; virtual Result OnInitExprI64ConstExpr(Index index, uint64_t value) = 0; - virtual Result OnInitExprRefNull(Index index) = 0; + virtual Result OnInitExprRefNull(Index index, Type type) = 0; virtual Result OnInitExprRefFunc(Index index, Index func_index) = 0; const State* state = nullptr; diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc index 27c83767d..0078637b9 100644 --- a/src/binary-writer-spec.cc +++ b/src/binary-writer-spec.cc @@ -229,13 +229,6 @@ void BinaryWriterSpec::WriteConst(const Const& const_) { WriteF64(const_.f64_bits(), const_.expected_nan()); break; - case Type::Nullref: - WriteString("nullref"); - WriteSeparator(); - WriteKey("value"); - json_stream_->Writef("\"0\""); - break; - case Type::Funcref: { WriteString("funcref"); WriteSeparator(); @@ -245,8 +238,8 @@ void BinaryWriterSpec::WriteConst(const Const& const_) { break; } - case Type::Hostref: { - WriteString("hostref"); + case Type::Externref: { + WriteString("externref"); WriteSeparator(); WriteKey("value"); int64_t ref_bits = static_cast(const_.ref_bits()); diff --git a/src/binary-writer.cc b/src/binary-writer.cc index 03ee2147c..b574402c9 100644 --- a/src/binary-writer.cc +++ b/src/binary-writer.cc @@ -681,10 +681,12 @@ void BinaryWriter::WriteExpr(const Func* func, const Expr* expr) { } case ExprType::RefNull: { WriteOpcode(stream_, Opcode::RefNull); + WriteType(stream_, cast(expr)->type, "ref.null type"); break; } case ExprType::RefIsNull: { WriteOpcode(stream_, Opcode::RefIsNull); + WriteType(stream_, cast(expr)->type, "ref.is_null type"); break; } case ExprType::Nop: @@ -1126,6 +1128,7 @@ Result BinaryWriter::WriteModule() { switch (elem_expr.kind) { case ElemExprKind::RefNull: WriteOpcode(stream_, Opcode::RefNull); + WriteType(stream_, elem_expr.type, "elem expr ref.null type"); break; case ElemExprKind::RefFunc: diff --git a/src/decompiler-ls.h b/src/decompiler-ls.h index e58f6da17..7af595a82 100644 --- a/src/decompiler-ls.h +++ b/src/decompiler-ls.h @@ -38,8 +38,7 @@ inline const char *GetDecompTypeName(Type t) { case Type::V128: return "simd"; case Type::Func: return "func"; case Type::Funcref: return "funcref"; - case Type::Anyref: return "anyref"; - case Type::Nullref: return "nullref"; + case Type::Externref: return "externref"; case Type::Exnref: return "exnref"; case Type::Void: return "void"; default: return "ILLEGAL"; diff --git a/src/feature.def b/src/feature.def index 6b9c99db2..83c57fec3 100644 --- a/src/feature.def +++ b/src/feature.def @@ -31,6 +31,6 @@ WABT_FEATURE(threads, "threads", false, "Threading su WABT_FEATURE(multi_value, "multi-value", false, "Multi-value") WABT_FEATURE(tail_call, "tail-call", false, "Tail-call support") WABT_FEATURE(bulk_memory, "bulk-memory", false, "Bulk-memory operations") -WABT_FEATURE(reference_types, "reference-types", false, "Reference types (anyref)") +WABT_FEATURE(reference_types, "reference-types", false, "Reference types (externref)") WABT_FEATURE(annotations, "annotations", false, "Custom annotation syntax") WABT_FEATURE(gc, "gc", false, "Garbage collection") diff --git a/src/interp/binary-reader-interp.cc b/src/interp/binary-reader-interp.cc index 96eaeadd5..20a8368c6 100644 --- a/src/interp/binary-reader-interp.cc +++ b/src/interp/binary-reader-interp.cc @@ -191,8 +191,8 @@ class BinaryReaderInterp : public BinaryReaderNop { Result OnMemoryInitExpr(Index segment_index) override; Result OnMemorySizeExpr() override; Result OnRefFuncExpr(Index func_index) override; - Result OnRefNullExpr() override; - Result OnRefIsNullExpr() override; + Result OnRefNullExpr(Type type) override; + Result OnRefIsNullExpr(Type type) override; Result OnNopExpr() override; Result OnReturnExpr() override; Result OnSelectExpr(Type result_type) override; @@ -224,7 +224,7 @@ class BinaryReaderInterp : public BinaryReaderNop { Result EndElemSegmentInitExpr(Index index) override; Result OnElemSegmentElemType(Index index, Type elem_type) override; Result OnElemSegmentElemExprCount(Index index, Index count) override; - Result OnElemSegmentElemExpr_RefNull(Index segment_index) override; + Result OnElemSegmentElemExpr_RefNull(Index segment_index, Type type) override; Result OnElemSegmentElemExpr_RefFunc(Index segment_index, Index func_index) override; @@ -243,7 +243,7 @@ class BinaryReaderInterp : public BinaryReaderNop { Result OnInitExprGlobalGetExpr(Index index, Index global_index) override; Result OnInitExprI32ConstExpr(Index index, uint32_t value) override; Result OnInitExprI64ConstExpr(Index index, uint64_t value) override; - Result OnInitExprRefNull(Index index) override; + Result OnInitExprRefNull(Index index, Type type) override; Result OnInitExprRefFunc(Index index, Index func_index) override; private: @@ -582,7 +582,7 @@ Result BinaryReaderInterp::EndGlobalInitExpr(Index index) { break; case InitExprKind::RefNull: - CHECK_RESULT(validator_.OnGlobalInitExpr_RefNull(loc)); + CHECK_RESULT(validator_.OnGlobalInitExpr_RefNull(loc, init_expr_.type_)); break; case InitExprKind::RefFunc: @@ -640,8 +640,9 @@ Result BinaryReaderInterp::OnInitExprI64ConstExpr(Index index, uint64_t value) { return Result::Ok; } -Result BinaryReaderInterp::OnInitExprRefNull(Index index) { +Result BinaryReaderInterp::OnInitExprRefNull(Index index, Type type) { init_expr_.kind = InitExprKind::RefNull; + init_expr_.type_ = type; return Result::Ok; } @@ -731,8 +732,9 @@ Result BinaryReaderInterp::OnElemSegmentElemExprCount(Index index, return Result::Ok; } -Result BinaryReaderInterp::OnElemSegmentElemExpr_RefNull(Index segment_index) { - CHECK_RESULT(validator_.OnElemSegmentElemExpr_RefNull(loc)); +Result BinaryReaderInterp::OnElemSegmentElemExpr_RefNull(Index segment_index, + Type type) { + CHECK_RESULT(validator_.OnElemSegmentElemExpr_RefNull(loc, type)); ElemDesc& elem = module_.elems.back(); elem.elements.push_back(ElemExpr{ElemKind::RefNull, 0}); return Result::Ok; @@ -1232,14 +1234,14 @@ Result BinaryReaderInterp::OnRefFuncExpr(Index func_index) { return Result::Ok; } -Result BinaryReaderInterp::OnRefNullExpr() { - CHECK_RESULT(validator_.OnRefNull(loc)); +Result BinaryReaderInterp::OnRefNullExpr(Type type) { + CHECK_RESULT(validator_.OnRefNull(loc, type)); istream_.Emit(Opcode::RefNull); return Result::Ok; } -Result BinaryReaderInterp::OnRefIsNullExpr() { - CHECK_RESULT(validator_.OnRefIsNull(loc)); +Result BinaryReaderInterp::OnRefIsNullExpr(Type type) { + CHECK_RESULT(validator_.OnRefIsNull(loc, type)); istream_.Emit(Opcode::RefIsNull); return Result::Ok; } diff --git a/src/interp/interp-inl.h b/src/interp/interp-inl.h index 7650ff1b9..3c713ba90 100644 --- a/src/interp/interp-inl.h +++ b/src/interp/interp-inl.h @@ -365,16 +365,7 @@ template void RequireType(ValueType type) { } inline bool TypesMatch(ValueType expected, ValueType actual) { - if (expected == actual) { - return true; - } - if (!IsReference(expected)) { - return false; - } - if (expected == ValueType::Anyref || actual == ValueType::Nullref) { - return true; - } - return false; + return expected == actual; } //// Value //// diff --git a/src/interp/interp-util.cc b/src/interp/interp-util.cc index 60f17152b..ae16161da 100644 --- a/src/interp/interp-util.cc +++ b/src/interp/interp-util.cc @@ -49,21 +49,15 @@ std::string TypedValueToString(const TypedValue& tv) { case Type::I16: // For SIMD lane. return StringPrintf("i16:%u", tv.value.Get() & 0xffff); - case Type::Nullref: - return StringPrintf("nullref"); - - case Type::Hostref: - return StringPrintf("hostref:%" PRIzd, tv.value.Get().index); - case Type::Funcref: return StringPrintf("funcref:%" PRIzd, tv.value.Get().index); + case Type::Externref: + return StringPrintf("externref:%" PRIzd, tv.value.Get().index); + case Type::Exnref: return StringPrintf("exnref:%" PRIzd, tv.value.Get().index); - case Type::Anyref: - return StringPrintf("anyref:%" PRIzd, tv.value.Get().index); - case Type::Func: case Type::Struct: case Type::Array: diff --git a/src/interp/interp-wasm-c-api.cc b/src/interp/interp-wasm-c-api.cc index 5304b6049..13fe345ea 100644 --- a/src/interp/interp-wasm-c-api.cc +++ b/src/interp/interp-wasm-c-api.cc @@ -310,7 +310,7 @@ static ValueType ToWabtValueType(wasm_valkind_t kind) { case WASM_F64: return ValueType::F64; case WASM_ANYREF: - return ValueType::Anyref; + return ValueType::Externref; case WASM_FUNCREF: return ValueType::Funcref; default: @@ -330,9 +330,7 @@ static wasm_valkind_t FromWabtValueType(ValueType type) { return WASM_F32; case ValueType::F64: return WASM_F64; - case ValueType::Anyref: - case ValueType::Hostref: - case ValueType::Nullref: + case ValueType::Externref: return WASM_ANYREF; case ValueType::Funcref: return WASM_FUNCREF; @@ -431,30 +429,16 @@ static wasm_val_t FromWabtValue(Store& store, const TypedValue& tv) { out_value.kind = WASM_F64; out_value.of.f64 = tv.value.Get(); break; - case Type::Anyref: - case Type::Funcref: - case Type::Hostref: - case Type::Nullref: { + case Type::Funcref: { Ref ref = tv.value.Get(); - // Get the actual type for this reference; tv.type uses the function - // signature, which may be to general (e.g. anyref). - Type type = store.GetValueType(ref); - out_value.kind = FromWabtValueType(type); - switch (type) { - case Type::Funcref: - out_value.of.ref = new wasm_func_t(store.UnsafeGet(ref)); - break; - - case Type::Hostref: - out_value.of.ref = new wasm_foreign_t(store.UnsafeGet(ref)); - break; - - case Type::Nullref: - out_value.of.ref = nullptr; - break; - - default: WABT_UNREACHABLE; - } + out_value.kind = WASM_FUNCREF; + out_value.of.ref = new wasm_func_t(store.UnsafeGet(ref)); + break; + } + case Type::Externref: { + Ref ref = tv.value.Get(); + out_value.kind = WASM_ANYREF; + out_value.of.ref = new wasm_foreign_t(store.UnsafeGet(ref)); break; } default: diff --git a/src/interp/interp.cc b/src/interp/interp.cc index f58dcd9f4..c66aee320 100644 --- a/src/interp/interp.cc +++ b/src/interp/interp.cc @@ -204,9 +204,6 @@ bool Store::HasValueType(Ref ref, ValueType type) const { if (!IsValid(ref)) { return false; } - if (type == ValueType::Anyref) { - return true; - } if (ref == Ref::Null) { return true; } @@ -216,8 +213,6 @@ bool Store::HasValueType(Ref ref, ValueType type) const { case ValueType::Funcref: return obj->kind() == ObjectKind::DefinedFunc || obj->kind() == ObjectKind::HostFunc; - case ValueType::Nullref: - return ref.index == 0; case ValueType::Exnref: // TODO return false; default: @@ -225,17 +220,6 @@ bool Store::HasValueType(Ref ref, ValueType type) const { } } -ValueType Store::GetValueType(Ref ref) const { - Object* obj = objects_.Get(ref.index).get(); - switch (obj->kind()) { - case ObjectKind::Null: return ValueType::Nullref; - case ObjectKind::Foreign: return ValueType::Hostref; - case ObjectKind::DefinedFunc: - case ObjectKind::HostFunc: return ValueType::Funcref; - default: return ValueType::Anyref; - } -} - Store::RootList::Index Store::NewRoot(Ref ref) { return roots_.New(ref); } @@ -2204,10 +2188,9 @@ std::string Thread::TraceSource::Pick(Index index, Instr instr) { v.u32(2), v.u32(3)); } - case ValueType::Nullref: reftype = "nullref"; break; - case ValueType::Funcref: reftype = "funcref"; break; - case ValueType::Exnref: reftype = "exnref"; break; - case ValueType::Anyref: reftype = "anyref"; break; + 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/interp.h b/src/interp/interp.h index 971df7c9a..c8af205e6 100644 --- a/src/interp/interp.h +++ b/src/interp/interp.h @@ -115,6 +115,7 @@ struct InitExpr { f64 f64_; v128 v128_; Index index_; + Type type_; }; }; @@ -426,7 +427,6 @@ class Store { bool IsValid(Ref) const; bool HasValueType(Ref, ValueType) const; - ValueType GetValueType(Ref) const; template bool Is(Ref) const; diff --git a/src/ir.h b/src/ir.h index 0888ce806..96ae051eb 100644 --- a/src/ir.h +++ b/src/ir.h @@ -132,9 +132,9 @@ struct Const { // Only used for expectations. (e.g. wast assertions) void set_f32(ExpectedNan nan) { set_f32(0); set_expected_nan(0, nan); } void set_f64(ExpectedNan nan) { set_f64(0); set_expected_nan(0, nan); } - void set_hostref(uintptr_t x) { From(Type::Hostref, x); } - void set_nullref() { From(Type::Nullref, 0); } void set_funcref() { From(Type::Funcref, 0); } + void set_externref(uintptr_t x) { From(Type::Externref, x); } + void set_null(Type type) { From(type, 0); } bool is_expected_nan(int lane = 0) const { return expected_nan(lane) != ExpectedNan::None; @@ -396,8 +396,18 @@ typedef ExprMixin NopExpr; typedef ExprMixin RethrowExpr; typedef ExprMixin ReturnExpr; typedef ExprMixin UnreachableExpr; -typedef ExprMixin RefNullExpr; -typedef ExprMixin RefIsNullExpr; + +template +class RefTypeExpr : public ExprMixin { + public: + RefTypeExpr(Type type, const Location& loc = Location()) + : ExprMixin(loc), type(type) {} + + Type type; +}; + +typedef RefTypeExpr RefNullExpr; +typedef RefTypeExpr RefIsNullExpr; template class OpcodeExpr : public ExprMixin { @@ -720,11 +730,13 @@ enum class ElemExprKind { }; struct ElemExpr { - ElemExpr() : kind(ElemExprKind::RefNull) {} + ElemExpr() : kind(ElemExprKind::RefNull), type(Type::Funcref) {} explicit ElemExpr(Var var) : kind(ElemExprKind::RefFunc), var(var) {} + explicit ElemExpr(Type type) : kind(ElemExprKind::RefNull), type(type) {} ElemExprKind kind; - Var var; // Only used when kind == RefFunc. + Var var; // Only used when kind == RefFunc. + Type type; // Only used when kind == RefNull }; typedef std::vector ElemExprVector; diff --git a/src/lexer-keywords.txt b/src/lexer-keywords.txt index 0e8d84f2e..9bcd881e9 100644 --- a/src/lexer-keywords.txt +++ b/src/lexer-keywords.txt @@ -4,6 +4,8 @@ struct TokenInfo { : name(name), token_type(token_type) {} TokenInfo(const char* name, Type value_type) : name(name), token_type(TokenType::ValueType), value_type(value_type) {} + TokenInfo(const char* name, Type value_type, TokenType token_type) + : name(name), token_type(token_type), value_type(value_type) {} TokenInfo(const char* name, TokenType token_type, Opcode opcode) : name(name), token_type(token_type), opcode(opcode) {} @@ -15,8 +17,7 @@ struct TokenInfo { }; }; %% -anyref, Type::Anyref -array, TokenType::Array +array, Type::Array, TokenType::Array assert_exhaustion, TokenType::AssertExhaustion assert_invalid, TokenType::AssertInvalid assert_malformed, TokenType::AssertMalformed @@ -44,7 +45,10 @@ 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 f32.abs, TokenType::Unary, Opcode::F32Abs f32.add, TokenType::Binary, Opcode::F32Add @@ -148,7 +152,7 @@ f64x2.sub, TokenType::Binary, Opcode::F64X2Sub f64x2, TokenType::F64X2 field, TokenType::Field funcref, Type::Funcref -func, TokenType::Func +func, Type::Funcref, TokenType::Func get, TokenType::Get global.get, TokenType::GlobalGet, Opcode::GlobalGet global.set, TokenType::GlobalSet, Opcode::GlobalSet @@ -472,12 +476,11 @@ mut, TokenType::Mut nan:arithmetic, TokenType::NanArithmetic nan:canonical, TokenType::NanCanonical nop, TokenType::Nop, Opcode::Nop -nullref, Type::Nullref offset, TokenType::Offset param, TokenType::Param quote, TokenType::Quote +ref.extern, TokenType::RefExtern ref.func, TokenType::RefFunc, Opcode::RefFunc -ref.host, TokenType::RefHost ref.is_null, TokenType::RefIsNull, Opcode::RefIsNull ref.null, TokenType::RefNull, Opcode::RefNull register, TokenType::Register @@ -489,7 +492,7 @@ return, TokenType::Return, Opcode::Return select, TokenType::Select, Opcode::Select shared, TokenType::Shared start, TokenType::Start -struct, TokenType::Struct +struct, Type::Struct, TokenType::Struct table.copy, TokenType::TableCopy, Opcode::TableCopy table.fill, TokenType::TableFill, Opcode::TableFill table.get, TokenType::TableGet, Opcode::TableGet diff --git a/src/prebuilt/lexer-keywords.cc b/src/prebuilt/lexer-keywords.cc index c898af6d3..e7a87e31a 100644 --- a/src/prebuilt/lexer-keywords.cc +++ b/src/prebuilt/lexer-keywords.cc @@ -36,6 +36,8 @@ struct TokenInfo { : name(name), token_type(token_type) {} TokenInfo(const char* name, Type value_type) : name(name), token_type(TokenType::ValueType), value_type(value_type) {} + TokenInfo(const char* name, Type value_type, TokenType token_type) + : name(name), token_type(token_type), value_type(value_type) {} TokenInfo(const char* name, TokenType token_type, Opcode opcode) : name(name), token_type(token_type), opcode(opcode) {} @@ -46,7 +48,7 @@ struct TokenInfo { Opcode opcode; }; }; -/* maximum key range = 2163, duplicates = 0 */ +/* maximum key range = 2156, duplicates = 0 */ class Perfect_Hash { @@ -61,32 +63,32 @@ Perfect_Hash::hash (const char *str, size_t len) { static unsigned short asso_values[] = { - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 6, 53, 2176, 128, - 4, 62, 3, 195, 161, 180, 112, 514, 26, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 3, 11, 70, 19, 155, - 33, 7, 4, 371, 595, 11, 50, 8, 17, 5, - 50, 46, 355, 549, 82, 3, 3, 6, 94, 21, - 351, 612, 85, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, 2176, - 2176, 2176, 2176, 2176, 2176, 2176, 2176 + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 17, 27, 2179, 44, + 10, 94, 9, 392, 162, 310, 240, 516, 11, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 49, 11, 77, 46, 91, + 14, 9, 9, 508, 515, 12, 48, 14, 59, 22, + 20, 11, 416, 585, 10, 12, 12, 25, 101, 22, + 314, 331, 77, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, 2179, + 2179, 2179, 2179, 2179, 2179, 2179, 2179 }; unsigned int hval = len; @@ -150,1422 +152,1422 @@ Perfect_Hash::InWordSet (const char *str, size_t len) { enum { - TOTAL_KEYWORDS = 543, + TOTAL_KEYWORDS = 544, MIN_WORD_LENGTH = 2, MAX_WORD_LENGTH = 26, - MIN_HASH_VALUE = 13, - MAX_HASH_VALUE = 2175 + MIN_HASH_VALUE = 23, + MAX_HASH_VALUE = 2178 }; static struct TokenInfo wordlist[] = { {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, -#line 129 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 459 "src/lexer-keywords.txt" + {"if", TokenType::If, Opcode::If}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 133 "src/lexer-keywords.txt" {"f64", Type::F64}, -#line 471 "src/lexer-keywords.txt" - {"mut", TokenType::Mut}, -#line 78 "src/lexer-keywords.txt" - {"f32", Type::F32}, {""}, -#line 455 "src/lexer-keywords.txt" - {"if", TokenType::If, Opcode::If}, - {""}, {""}, -#line 405 "src/lexer-keywords.txt" +#line 82 "src/lexer-keywords.txt" + {"f32", Type::F32}, +#line 409 "src/lexer-keywords.txt" {"i64", Type::I64}, -#line 44 "src/lexer-keywords.txt" +#line 45 "src/lexer-keywords.txt" {"else", TokenType::Else, Opcode::Else}, -#line 275 "src/lexer-keywords.txt" +#line 279 "src/lexer-keywords.txt" {"i32", Type::I32}, -#line 43 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, +#line 46 "src/lexer-keywords.txt" + {"end", TokenType::End, Opcode::End}, + {""}, {""}, {""}, +#line 44 "src/lexer-keywords.txt" {"elem", TokenType::Elem}, -#line 116 "src/lexer-keywords.txt" - {"f64.lt", TokenType::Compare, Opcode::F64Lt}, -#line 66 "src/lexer-keywords.txt" - {"f32.lt", TokenType::Compare, Opcode::F32Lt}, - {""}, -#line 458 "src/lexer-keywords.txt" +#line 504 "src/lexer-keywords.txt" + {"then", TokenType::Then}, +#line 153 "src/lexer-keywords.txt" + {"field", TokenType::Field}, +#line 462 "src/lexer-keywords.txt" {"item", TokenType::Item}, -#line 46 "src/lexer-keywords.txt" + {""}, +#line 475 "src/lexer-keywords.txt" + {"mut", TokenType::Mut}, + {""}, {""}, +#line 48 "src/lexer-keywords.txt" + {"exn", Type::Exnref, TokenType::Exn}, +#line 126 "src/lexer-keywords.txt" + {"f64.ne", TokenType::Compare, Opcode::F64Ne}, +#line 76 "src/lexer-keywords.txt" + {"f32.ne", TokenType::Compare, Opcode::F32Ne}, + {""}, +#line 385 "src/lexer-keywords.txt" + {"i64.ne", TokenType::Compare, Opcode::I64Ne}, +#line 256 "src/lexer-keywords.txt" + {"i32.ne", TokenType::Compare, Opcode::I32Ne}, +#line 34 "src/lexer-keywords.txt" + {"br", TokenType::Br, Opcode::Br}, +#line 479 "src/lexer-keywords.txt" + {"offset", TokenType::Offset}, +#line 47 "src/lexer-keywords.txt" {"event", TokenType::Event}, - {""}, {""}, {""}, -#line 114 "src/lexer-keywords.txt" + {""}, +#line 49 "src/lexer-keywords.txt" + {"exnref", Type::Exnref}, + {""}, +#line 118 "src/lexer-keywords.txt" {"f64.le", TokenType::Compare, Opcode::F64Le}, -#line 64 "src/lexer-keywords.txt" +#line 68 "src/lexer-keywords.txt" {"f32.le", TokenType::Compare, Opcode::F32Le}, - {""}, {""}, {""}, {""}, -#line 500 "src/lexer-keywords.txt" +#line 495 "src/lexer-keywords.txt" + {"struct", Type::Struct, TokenType::Struct}, + {""}, {""}, {""}, +#line 120 "src/lexer-keywords.txt" + {"f64.lt", TokenType::Compare, Opcode::F64Lt}, +#line 70 "src/lexer-keywords.txt" + {"f32.lt", TokenType::Compare, Opcode::F32Lt}, + {""}, {""}, +#line 487 "src/lexer-keywords.txt" + {"result", TokenType::Result}, +#line 154 "src/lexer-keywords.txt" + {"funcref", Type::Funcref}, + {""}, {""}, {""}, +#line 50 "src/lexer-keywords.txt" + {"extern", Type::Externref, TokenType::Extern}, +#line 491 "src/lexer-keywords.txt" + {"return", TokenType::Return, Opcode::Return}, +#line 503 "src/lexer-keywords.txt" {"table", TokenType::Table}, -#line 378 "src/lexer-keywords.txt" - {"i64.lt_s", TokenType::Compare, Opcode::I64LtS}, -#line 249 "src/lexer-keywords.txt" - {"i32.lt_s", TokenType::Compare, Opcode::I32LtS}, +#line 474 "src/lexer-keywords.txt" + {"module", TokenType::Module}, + {""}, +#line 392 "src/lexer-keywords.txt" + {"i64.rotr", TokenType::Binary, Opcode::I64Rotr}, +#line 263 "src/lexer-keywords.txt" + {"i32.rotr", TokenType::Binary, Opcode::I32Rotr}, + {""}, {""}, {""}, {""}, +#line 130 "src/lexer-keywords.txt" + {"f64.store", TokenType::Store, Opcode::F64Store}, +#line 79 "src/lexer-keywords.txt" + {"f32.store", TokenType::Store, Opcode::F32Store}, + {""}, +#line 399 "src/lexer-keywords.txt" + {"i64.store", TokenType::Store, Opcode::I64Store}, +#line 269 "src/lexer-keywords.txt" + {"i32.store", TokenType::Store, Opcode::I32Store}, + {""}, +#line 488 "src/lexer-keywords.txt" + {"rethrow", TokenType::Rethrow, Opcode::Rethrow}, +#line 122 "src/lexer-keywords.txt" + {"f64.min", TokenType::Binary, Opcode::F64Min}, +#line 72 "src/lexer-keywords.txt" + {"f32.min", TokenType::Binary, Opcode::F32Min}, +#line 51 "src/lexer-keywords.txt" + {"externref", Type::Externref}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 397 "src/lexer-keywords.txt" + {"i64.store32", TokenType::Store, Opcode::I64Store32}, +#line 40 "src/lexer-keywords.txt" + {"data", TokenType::Data}, +#line 107 "src/lexer-keywords.txt" + {"f64.const", TokenType::Const, Opcode::F64Const}, +#line 56 "src/lexer-keywords.txt" + {"f32.const", TokenType::Const, Opcode::F32Const}, + {""}, +#line 358 "src/lexer-keywords.txt" + {"i64.const", TokenType::Const, Opcode::I64Const}, +#line 234 "src/lexer-keywords.txt" + {"i32.const", TokenType::Const, Opcode::I32Const}, +#line 105 "src/lexer-keywords.txt" + {"f64.add", TokenType::Binary, Opcode::F64Add}, +#line 54 "src/lexer-keywords.txt" + {"f32.add", TokenType::Binary, Opcode::F32Add}, +#line 492 "src/lexer-keywords.txt" + {"select", TokenType::Select, Opcode::Select}, +#line 318 "src/lexer-keywords.txt" + {"i64.add", TokenType::Binary, Opcode::I64Add}, +#line 203 "src/lexer-keywords.txt" + {"i32.add", TokenType::Binary, Opcode::I32Add}, + {""}, {""}, {""}, {""}, +#line 319 "src/lexer-keywords.txt" + {"i64.and", TokenType::Binary, Opcode::I64And}, +#line 204 "src/lexer-keywords.txt" + {"i32.and", TokenType::Binary, Opcode::I32And}, +#line 155 "src/lexer-keywords.txt" + {"func", Type::Funcref, TokenType::Func}, {""}, {""}, -#line 369 "src/lexer-keywords.txt" +#line 152 "src/lexer-keywords.txt" + {"f64x2", TokenType::F64X2}, + {""}, {""}, +#line 422 "src/lexer-keywords.txt" + {"i64x2", TokenType::I64X2}, +#line 494 "src/lexer-keywords.txt" + {"start", TokenType::Start}, +#line 493 "src/lexer-keywords.txt" + {"shared", TokenType::Shared}, +#line 373 "src/lexer-keywords.txt" {"i64.le_s", TokenType::Compare, Opcode::I64LeS}, -#line 242 "src/lexer-keywords.txt" +#line 246 "src/lexer-keywords.txt" {"i32.le_s", TokenType::Compare, Opcode::I32LeS}, -#line 379 "src/lexer-keywords.txt" - {"i64.lt_u", TokenType::Compare, Opcode::I64LtU}, -#line 250 "src/lexer-keywords.txt" - {"i32.lt_u", TokenType::Compare, Opcode::I32LtU}, -#line 385 "src/lexer-keywords.txt" - {"i64.rem_s", TokenType::Binary, Opcode::I64RemS}, -#line 256 "src/lexer-keywords.txt" - {"i32.rem_s", TokenType::Binary, Opcode::I32RemS}, -#line 370 "src/lexer-keywords.txt" - {"i64.le_u", TokenType::Compare, Opcode::I64LeU}, -#line 243 "src/lexer-keywords.txt" - {"i32.le_u", TokenType::Compare, Opcode::I32LeU}, - {""}, {""}, -#line 386 "src/lexer-keywords.txt" - {"i64.rem_u", TokenType::Binary, Opcode::I64RemU}, -#line 257 "src/lexer-keywords.txt" - {"i32.rem_u", TokenType::Binary, Opcode::I32RemU}, - {""}, -#line 149 "src/lexer-keywords.txt" - {"field", TokenType::Field}, -#line 498 "src/lexer-keywords.txt" +#line 30 "src/lexer-keywords.txt" + {"block", TokenType::Block, Opcode::Block}, +#line 382 "src/lexer-keywords.txt" + {"i64.lt_s", TokenType::Compare, Opcode::I64LtS}, +#line 253 "src/lexer-keywords.txt" + {"i32.lt_s", TokenType::Compare, Opcode::I32LtS}, +#line 501 "src/lexer-keywords.txt" {"table.set", TokenType::TableSet, Opcode::TableSet}, -#line 100 "src/lexer-keywords.txt" + {""}, {""}, +#line 104 "src/lexer-keywords.txt" {"f64.abs", TokenType::Unary, Opcode::F64Abs}, -#line 49 "src/lexer-keywords.txt" +#line 53 "src/lexer-keywords.txt" {"f32.abs", TokenType::Unary, Opcode::F32Abs}, - {""}, -#line 127 "src/lexer-keywords.txt" + {""}, {""}, {""}, +#line 389 "src/lexer-keywords.txt" + {"i64.rem_s", TokenType::Binary, Opcode::I64RemS}, +#line 260 "src/lexer-keywords.txt" + {"i32.rem_s", TokenType::Binary, Opcode::I32RemS}, + {""}, {""}, +#line 500 "src/lexer-keywords.txt" + {"table.init", TokenType::TableInit, Opcode::TableInit}, + {""}, {""}, {""}, +#line 131 "src/lexer-keywords.txt" {"f64.sub", TokenType::Binary, Opcode::F64Sub}, -#line 76 "src/lexer-keywords.txt" +#line 80 "src/lexer-keywords.txt" {"f32.sub", TokenType::Binary, Opcode::F32Sub}, -#line 470 "src/lexer-keywords.txt" - {"module", TokenType::Module}, -#line 501 "src/lexer-keywords.txt" - {"then", TokenType::Then}, -#line 489 "src/lexer-keywords.txt" - {"select", TokenType::Select, Opcode::Select}, -#line 476 "src/lexer-keywords.txt" - {"offset", TokenType::Offset}, {""}, -#line 396 "src/lexer-keywords.txt" +#line 400 "src/lexer-keywords.txt" {"i64.sub", TokenType::Binary, Opcode::I64Sub}, -#line 266 "src/lexer-keywords.txt" +#line 270 "src/lexer-keywords.txt" {"i32.sub", TokenType::Binary, Opcode::I32Sub}, - {""}, {""}, {""}, -#line 122 "src/lexer-keywords.txt" - {"f64.ne", TokenType::Compare, Opcode::F64Ne}, -#line 72 "src/lexer-keywords.txt" - {"f32.ne", TokenType::Compare, Opcode::F32Ne}, -#line 47 "src/lexer-keywords.txt" - {"exnref", Type::Exnref}, -#line 45 "src/lexer-keywords.txt" - {"end", TokenType::End, Opcode::End}, +#line 374 "src/lexer-keywords.txt" + {"i64.le_u", TokenType::Compare, Opcode::I64LeU}, +#line 247 "src/lexer-keywords.txt" + {"i32.le_u", TokenType::Compare, Opcode::I32LeU}, + {""}, +#line 383 "src/lexer-keywords.txt" + {"i64.lt_u", TokenType::Compare, Opcode::I64LtU}, +#line 254 "src/lexer-keywords.txt" + {"i32.lt_u", TokenType::Compare, Opcode::I32LtU}, +#line 119 "src/lexer-keywords.txt" + {"f64.load", TokenType::Load, Opcode::F64Load}, +#line 69 "src/lexer-keywords.txt" + {"f32.load", TokenType::Load, Opcode::F32Load}, {""}, -#line 148 "src/lexer-keywords.txt" - {"f64x2", TokenType::F64X2}, -#line 150 "src/lexer-keywords.txt" - {"funcref", Type::Funcref}, #line 381 "src/lexer-keywords.txt" - {"i64.ne", TokenType::Compare, Opcode::I64Ne}, + {"i64.load", TokenType::Load, Opcode::I64Load}, #line 252 "src/lexer-keywords.txt" - {"i32.ne", TokenType::Compare, Opcode::I32Ne}, - {""}, {""}, {""}, -#line 418 "src/lexer-keywords.txt" - {"i64x2", TokenType::I64X2}, + {"i32.load", TokenType::Load, Opcode::I32Load}, +#line 124 "src/lexer-keywords.txt" + {"f64.nearest", TokenType::Unary, Opcode::F64Nearest}, +#line 74 "src/lexer-keywords.txt" + {"f32.nearest", TokenType::Unary, Opcode::F32Nearest}, {""}, -#line 491 "src/lexer-keywords.txt" - {"start", TokenType::Start}, - {""}, {""}, {""}, -#line 494 "src/lexer-keywords.txt" - {"table.fill", TokenType::TableFill, Opcode::TableFill}, -#line 475 "src/lexer-keywords.txt" - {"nullref", Type::Nullref}, +#line 390 "src/lexer-keywords.txt" + {"i64.rem_u", TokenType::Binary, Opcode::I64RemU}, +#line 261 "src/lexer-keywords.txt" + {"i32.rem_u", TokenType::Binary, Opcode::I32RemU}, + {""}, +#line 147 "src/lexer-keywords.txt" + {"f64x2.ne", TokenType::Compare, Opcode::F64X2Ne}, +#line 515 "src/lexer-keywords.txt" + {"v128.or", TokenType::Binary, Opcode::V128Or}, {""}, {""}, -#line 29 "src/lexer-keywords.txt" - {"block", TokenType::Block, Opcode::Block}, - {""}, {""}, {""}, -#line 32 "src/lexer-keywords.txt" - {"br_table", TokenType::BrTable, Opcode::BrTable}, -#line 102 "src/lexer-keywords.txt" +#line 106 "src/lexer-keywords.txt" {"f64.ceil", TokenType::Unary, Opcode::F64Ceil}, -#line 51 "src/lexer-keywords.txt" +#line 55 "src/lexer-keywords.txt" {"f32.ceil", TokenType::Unary, Opcode::F32Ceil}, -#line 484 "src/lexer-keywords.txt" - {"result", TokenType::Result}, -#line 33 "src/lexer-keywords.txt" - {"br", TokenType::Br, Opcode::Br}, -#line 119 "src/lexer-keywords.txt" - {"f64.mul", TokenType::Binary, Opcode::F64Mul}, -#line 69 "src/lexer-keywords.txt" - {"f32.mul", TokenType::Binary, Opcode::F32Mul}, -#line 138 "src/lexer-keywords.txt" - {"f64x2.lt", TokenType::Compare, Opcode::F64X2Lt}, {""}, -#line 387 "src/lexer-keywords.txt" +#line 391 "src/lexer-keywords.txt" {"i64.rotl", TokenType::Binary, Opcode::I64Rotl}, -#line 258 "src/lexer-keywords.txt" +#line 262 "src/lexer-keywords.txt" {"i32.rotl", TokenType::Binary, Opcode::I32Rotl}, -#line 39 "src/lexer-keywords.txt" - {"data", TokenType::Data}, -#line 380 "src/lexer-keywords.txt" - {"i64.mul", TokenType::Binary, Opcode::I64Mul}, -#line 251 "src/lexer-keywords.txt" - {"i32.mul", TokenType::Binary, Opcode::I32Mul}, - {""}, -#line 137 "src/lexer-keywords.txt" - {"f64x2.le", TokenType::Compare, Opcode::F64X2Le}, - {""}, {""}, -#line 497 "src/lexer-keywords.txt" - {"table.init", TokenType::TableInit, Opcode::TableInit}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, -#line 141 "src/lexer-keywords.txt" - {"f64x2.mul", TokenType::Binary, Opcode::F64X2Mul}, -#line 492 "src/lexer-keywords.txt" - {"struct", TokenType::Struct}, -#line 147 "src/lexer-keywords.txt" - {"f64x2.sub", TokenType::Binary, Opcode::F64X2Sub}, -#line 101 "src/lexer-keywords.txt" - {"f64.add", TokenType::Binary, Opcode::F64Add}, -#line 50 "src/lexer-keywords.txt" - {"f32.add", TokenType::Binary, Opcode::F32Add}, {""}, {""}, -#line 410 "src/lexer-keywords.txt" - {"i64x2.mul", TokenType::Binary, Opcode::I64X2Mul}, +#line 41 "src/lexer-keywords.txt" + {"declare", TokenType::Declare}, {""}, -#line 417 "src/lexer-keywords.txt" - {"i64x2.sub", TokenType::Binary, Opcode::I64X2Sub}, -#line 314 "src/lexer-keywords.txt" - {"i64.add", TokenType::Binary, Opcode::I64Add}, -#line 199 "src/lexer-keywords.txt" - {"i32.add", TokenType::Binary, Opcode::I32Add}, +#line 123 "src/lexer-keywords.txt" + {"f64.mul", TokenType::Binary, Opcode::F64Mul}, +#line 73 "src/lexer-keywords.txt" + {"f32.mul", TokenType::Binary, Opcode::F32Mul}, {""}, -#line 457 "src/lexer-keywords.txt" +#line 384 "src/lexer-keywords.txt" + {"i64.mul", TokenType::Binary, Opcode::I64Mul}, +#line 255 "src/lexer-keywords.txt" + {"i32.mul", TokenType::Binary, Opcode::I32Mul}, + {""}, {""}, {""}, +#line 461 "src/lexer-keywords.txt" {"invoke", TokenType::Invoke}, + {""}, {""}, {""}, {""}, +#line 514 "src/lexer-keywords.txt" + {"v128.not", TokenType::Unary, Opcode::V128Not}, +#line 516 "src/lexer-keywords.txt" + {"v128.store", TokenType::Store, Opcode::V128Store}, {""}, -#line 356 "src/lexer-keywords.txt" - {"i64.div_s", TokenType::Binary, Opcode::I64DivS}, -#line 232 "src/lexer-keywords.txt" - {"i32.div_s", TokenType::Binary, Opcode::I32DivS}, - {""}, -#line 143 "src/lexer-keywords.txt" - {"f64x2.ne", TokenType::Compare, Opcode::F64X2Ne}, -#line 499 "src/lexer-keywords.txt" +#line 502 "src/lexer-keywords.txt" {"table.size", TokenType::TableSize, Opcode::TableSize}, -#line 490 "src/lexer-keywords.txt" - {"shared", TokenType::Shared}, -#line 357 "src/lexer-keywords.txt" - {"i64.div_u", TokenType::Binary, Opcode::I64DivU}, -#line 233 "src/lexer-keywords.txt" - {"i32.div_u", TokenType::Binary, Opcode::I32DivU}, - {""}, {""}, -#line 103 "src/lexer-keywords.txt" - {"f64.const", TokenType::Const, Opcode::F64Const}, -#line 52 "src/lexer-keywords.txt" - {"f32.const", TokenType::Const, Opcode::F32Const}, -#line 315 "src/lexer-keywords.txt" - {"i64.and", TokenType::Binary, Opcode::I64And}, -#line 200 "src/lexer-keywords.txt" - {"i32.and", TokenType::Binary, Opcode::I32And}, - {""}, {""}, -#line 480 "src/lexer-keywords.txt" - {"ref.host", TokenType::RefHost}, -#line 354 "src/lexer-keywords.txt" - {"i64.const", TokenType::Const, Opcode::I64Const}, -#line 230 "src/lexer-keywords.txt" - {"i32.const", TokenType::Const, Opcode::I32Const}, - {""}, -#line 126 "src/lexer-keywords.txt" - {"f64.store", TokenType::Store, Opcode::F64Store}, -#line 75 "src/lexer-keywords.txt" - {"f32.store", TokenType::Store, Opcode::F32Store}, - {""}, {""}, {""}, {""}, {""}, -#line 395 "src/lexer-keywords.txt" - {"i64.store", TokenType::Store, Opcode::I64Store}, -#line 265 "src/lexer-keywords.txt" - {"i32.store", TokenType::Store, Opcode::I32Store}, - {""}, -#line 393 "src/lexer-keywords.txt" - {"i64.store32", TokenType::Store, Opcode::I64Store32}, -#line 118 "src/lexer-keywords.txt" - {"f64.min", TokenType::Binary, Opcode::F64Min}, -#line 68 "src/lexer-keywords.txt" - {"f32.min", TokenType::Binary, Opcode::F32Min}, - {""}, {""}, -#line 130 "src/lexer-keywords.txt" - {"f64x2.abs", TokenType::Unary, Opcode::F64X2Abs}, {""}, {""}, {""}, -#line 485 "src/lexer-keywords.txt" - {"rethrow", TokenType::Rethrow, Opcode::Rethrow}, - {""}, {""}, -#line 351 "src/lexer-keywords.txt" +#line 359 "src/lexer-keywords.txt" + {"i64.ctz", TokenType::Unary, Opcode::I64Ctz}, +#line 235 "src/lexer-keywords.txt" + {"i32.ctz", TokenType::Unary, Opcode::I32Ctz}, +#line 355 "src/lexer-keywords.txt" {"i64.atomic.store", TokenType::AtomicStore, Opcode::I64AtomicStore}, -#line 227 "src/lexer-keywords.txt" +#line 231 "src/lexer-keywords.txt" {"i32.atomic.store", TokenType::AtomicStore, Opcode::I32AtomicStore}, +#line 144 "src/lexer-keywords.txt" + {"f64x2.min", TokenType::Binary, Opcode::F64X2Min}, +#line 36 "src/lexer-keywords.txt" + {"call", TokenType::Call, Opcode::Call}, +#line 141 "src/lexer-keywords.txt" + {"f64x2.le", TokenType::Compare, Opcode::F64X2Le}, + {""}, {""}, {""}, {""}, {""}, +#line 142 "src/lexer-keywords.txt" + {"f64x2.lt", TokenType::Compare, Opcode::F64X2Lt}, {""}, {""}, {""}, {""}, -#line 349 "src/lexer-keywords.txt" +#line 360 "src/lexer-keywords.txt" + {"i64.div_s", TokenType::Binary, Opcode::I64DivS}, +#line 236 "src/lexer-keywords.txt" + {"i32.div_s", TokenType::Binary, Opcode::I32DivS}, + {""}, {""}, {""}, {""}, {""}, +#line 353 "src/lexer-keywords.txt" {"i64.atomic.store32", TokenType::AtomicStore, Opcode::I64AtomicStore32}, -#line 35 "src/lexer-keywords.txt" - {"call", TokenType::Call, Opcode::Call}, -#line 488 "src/lexer-keywords.txt" - {"return", TokenType::Return, Opcode::Return}, +#line 497 "src/lexer-keywords.txt" + {"table.fill", TokenType::TableFill, Opcode::TableFill}, {""}, {""}, -#line 482 "src/lexer-keywords.txt" - {"ref.null", TokenType::RefNull, Opcode::RefNull}, - {""}, -#line 462 "src/lexer-keywords.txt" +#line 466 "src/lexer-keywords.txt" {"local", TokenType::Local}, -#line 140 "src/lexer-keywords.txt" - {"f64x2.min", TokenType::Binary, Opcode::F64X2Min}, - {""}, -#line 115 "src/lexer-keywords.txt" - {"f64.load", TokenType::Load, Opcode::F64Load}, -#line 65 "src/lexer-keywords.txt" - {"f32.load", TokenType::Load, Opcode::F32Load}, - {""}, {""}, {""}, {""}, -#line 460 "src/lexer-keywords.txt" - {"local.set", TokenType::LocalSet, Opcode::LocalSet}, -#line 377 "src/lexer-keywords.txt" - {"i64.load", TokenType::Load, Opcode::I64Load}, -#line 248 "src/lexer-keywords.txt" - {"i32.load", TokenType::Load, Opcode::I32Load}, -#line 99 "src/lexer-keywords.txt" - {"f32x4", TokenType::F32X4}, - {""}, -#line 151 "src/lexer-keywords.txt" - {"func", TokenType::Func}, -#line 514 "src/lexer-keywords.txt" - {"v128", Type::V128}, - {""}, -#line 461 "src/lexer-keywords.txt" +#line 465 "src/lexer-keywords.txt" {"local.tee", TokenType::LocalTee, Opcode::LocalTee}, + {""}, {""}, +#line 485 "src/lexer-keywords.txt" + {"ref.null", TokenType::RefNull, Opcode::RefNull}, + {""}, {""}, +#line 464 "src/lexer-keywords.txt" + {"local.set", TokenType::LocalSet, Opcode::LocalSet}, {""}, -#line 306 "src/lexer-keywords.txt" - {"i32x4", TokenType::I32X4}, +#line 348 "src/lexer-keywords.txt" + {"i64.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I64AtomicRmwOr}, +#line 225 "src/lexer-keywords.txt" + {"i32.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I32AtomicRmwOr}, {""}, -#line 109 "src/lexer-keywords.txt" +#line 113 "src/lexer-keywords.txt" {"f64.div", TokenType::Binary, Opcode::F64Div}, -#line 59 "src/lexer-keywords.txt" +#line 63 "src/lexer-keywords.txt" {"f32.div", TokenType::Binary, Opcode::F32Div}, - {""}, {""}, -#line 352 "src/lexer-keywords.txt" - {"i64.atomic.wait", TokenType::AtomicWait, Opcode::I64AtomicWait}, -#line 228 "src/lexer-keywords.txt" - {"i32.atomic.wait", TokenType::AtomicWait, Opcode::I32AtomicWait}, {""}, -#line 355 "src/lexer-keywords.txt" - {"i64.ctz", TokenType::Unary, Opcode::I64Ctz}, -#line 231 "src/lexer-keywords.txt" - {"i32.ctz", TokenType::Unary, Opcode::I32Ctz}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 120 "src/lexer-keywords.txt" - {"f64.nearest", TokenType::Unary, Opcode::F64Nearest}, -#line 70 "src/lexer-keywords.txt" - {"f32.nearest", TokenType::Unary, Opcode::F32Nearest}, -#line 388 "src/lexer-keywords.txt" - {"i64.rotr", TokenType::Binary, Opcode::I64Rotr}, -#line 259 "src/lexer-keywords.txt" - {"i32.rotr", TokenType::Binary, Opcode::I32Rotr}, -#line 89 "src/lexer-keywords.txt" - {"f32x4.lt", TokenType::Compare, Opcode::F32X4Lt}, -#line 353 "src/lexer-keywords.txt" +#line 361 "src/lexer-keywords.txt" + {"i64.div_u", TokenType::Binary, Opcode::I64DivU}, +#line 237 "src/lexer-keywords.txt" + {"i32.div_u", TokenType::Binary, Opcode::I32DivU}, + {""}, {""}, +#line 357 "src/lexer-keywords.txt" {"i64.clz", TokenType::Unary, Opcode::I64Clz}, -#line 229 "src/lexer-keywords.txt" +#line 233 "src/lexer-keywords.txt" {"i32.clz", TokenType::Unary, Opcode::I32Clz}, -#line 481 "src/lexer-keywords.txt" - {"ref.is_null", TokenType::RefIsNull, Opcode::RefIsNull}, - {""}, {""}, {""}, {""}, -#line 88 "src/lexer-keywords.txt" - {"f32x4.le", TokenType::Compare, Opcode::F32X4Le}, - {""}, {""}, -#line 373 "src/lexer-keywords.txt" - {"i64.load32_s", TokenType::Load, Opcode::I64Load32S}, -#line 291 "src/lexer-keywords.txt" - {"i32x4.lt_s", TokenType::Compare, Opcode::I32X4LtS}, -#line 131 "src/lexer-keywords.txt" +#line 135 "src/lexer-keywords.txt" {"f64x2.add", TokenType::Binary, Opcode::F64X2Add}, - {""}, -#line 292 "src/lexer-keywords.txt" - {"i32x4.lt_u", TokenType::Compare, Opcode::I32X4LtU}, -#line 287 "src/lexer-keywords.txt" - {"i32x4.le_s", TokenType::Compare, Opcode::I32X4LeS}, -#line 374 "src/lexer-keywords.txt" - {"i64.load32_u", TokenType::Load, Opcode::I64Load32U}, - {""}, -#line 288 "src/lexer-keywords.txt" - {"i32x4.le_u", TokenType::Compare, Opcode::I32X4LeU}, -#line 406 "src/lexer-keywords.txt" + {""}, {""}, +#line 410 "src/lexer-keywords.txt" {"i64x2.add", TokenType::Binary, Opcode::I64X2Add}, -#line 511 "src/lexer-keywords.txt" - {"v128.not", TokenType::Unary, Opcode::V128Not}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 151 "src/lexer-keywords.txt" + {"f64x2.sub", TokenType::Binary, Opcode::F64X2Sub}, {""}, -#line 92 "src/lexer-keywords.txt" - {"f32x4.mul", TokenType::Binary, Opcode::F32X4Mul}, -#line 58 "src/lexer-keywords.txt" - {"f32.demote_f64", TokenType::Convert, Opcode::F32DemoteF64}, -#line 98 "src/lexer-keywords.txt" - {"f32x4.sub", TokenType::Binary, Opcode::F32X4Sub}, +#line 24 "src/lexer-keywords.txt" + {"assert_return", TokenType::AssertReturn}, +#line 421 "src/lexer-keywords.txt" + {"i64x2.sub", TokenType::Binary, Opcode::I64X2Sub}, +#line 510 "src/lexer-keywords.txt" + {"v128.and", TokenType::Binary, Opcode::V128And}, +#line 33 "src/lexer-keywords.txt" + {"br_table", TokenType::BrTable, Opcode::BrTable}, + {""}, +#line 375 "src/lexer-keywords.txt" + {"i64.load16_s", TokenType::Load, Opcode::I64Load16S}, +#line 248 "src/lexer-keywords.txt" + {"i32.load16_s", TokenType::Load, Opcode::I32Load16S}, + {""}, {""}, {""}, +#line 356 "src/lexer-keywords.txt" + {"i64.atomic.wait", TokenType::AtomicWait, Opcode::I64AtomicWait}, +#line 232 "src/lexer-keywords.txt" + {"i32.atomic.wait", TokenType::AtomicWait, Opcode::I32AtomicWait}, {""}, {""}, {""}, {""}, -#line 297 "src/lexer-keywords.txt" - {"i32x4.mul", TokenType::Binary, Opcode::I32X4Mul}, +#line 134 "src/lexer-keywords.txt" + {"f64x2.abs", TokenType::Unary, Opcode::F64X2Abs}, + {""}, {""}, {""}, +#line 132 "src/lexer-keywords.txt" + {"f64.trunc", TokenType::Unary, Opcode::F64Trunc}, +#line 81 "src/lexer-keywords.txt" + {"f32.trunc", TokenType::Unary, Opcode::F32Trunc}, + {""}, {""}, {""}, +#line 512 "src/lexer-keywords.txt" + {"v128.const", TokenType::Const, Opcode::V128Const}, + {""}, {""}, {""}, {""}, +#line 334 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32OrU}, +#line 376 "src/lexer-keywords.txt" + {"i64.load16_u", TokenType::Load, Opcode::I64Load16U}, +#line 249 "src/lexer-keywords.txt" + {"i32.load16_u", TokenType::Load, Opcode::I32Load16U}, +#line 484 "src/lexer-keywords.txt" + {"ref.is_null", TokenType::RefIsNull, Opcode::RefIsNull}, +#line 145 "src/lexer-keywords.txt" + {"f64x2.mul", TokenType::Binary, Opcode::F64X2Mul}, +#line 509 "src/lexer-keywords.txt" + {"v128.andnot", TokenType::Binary, Opcode::V128Andnot}, {""}, -#line 305 "src/lexer-keywords.txt" - {"i32x4.sub", TokenType::Binary, Opcode::I32X4Sub}, -#line 338 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8SubU}, -#line 215 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8SubU}, - {""}, {""}, -#line 394 "src/lexer-keywords.txt" - {"i64.store8", TokenType::Store, Opcode::I64Store8}, -#line 264 "src/lexer-keywords.txt" - {"i32.store8", TokenType::Store, Opcode::I32Store8}, - {""}, {""}, -#line 94 "src/lexer-keywords.txt" - {"f32x4.ne", TokenType::Compare, Opcode::F32X4Ne}, +#line 414 "src/lexer-keywords.txt" + {"i64x2.mul", TokenType::Binary, Opcode::I64X2Mul}, + {""}, {""}, {""}, {""}, {""}, +#line 531 "src/lexer-keywords.txt" + {"f32.demote/f64", TokenType::Convert, Opcode::F32DemoteF64}, {""}, {""}, {""}, -#line 319 "src/lexer-keywords.txt" +#line 335 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32SubU}, +#line 323 "src/lexer-keywords.txt" {"i64.atomic.load", TokenType::AtomicLoad, Opcode::I64AtomicLoad}, -#line 203 "src/lexer-keywords.txt" +#line 207 "src/lexer-keywords.txt" {"i32.atomic.load", TokenType::AtomicLoad, Opcode::I32AtomicLoad}, - {""}, -#line 299 "src/lexer-keywords.txt" - {"i32x4.ne", TokenType::Compare, Opcode::I32X4Ne}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 375 "src/lexer-keywords.txt" - {"i64.load8_s", TokenType::Load, Opcode::I64Load8S}, -#line 246 "src/lexer-keywords.txt" - {"i32.load8_s", TokenType::Load, Opcode::I32Load8S}, -#line 295 "src/lexer-keywords.txt" - {"i32x4.min_s", TokenType::Binary, Opcode::I32X4MinS}, - {""}, {""}, -#line 513 "src/lexer-keywords.txt" - {"v128.store", TokenType::Store, Opcode::V128Store}, -#line 376 "src/lexer-keywords.txt" - {"i64.load8_u", TokenType::Load, Opcode::I64Load8U}, -#line 247 "src/lexer-keywords.txt" - {"i32.load8_u", TokenType::Load, Opcode::I32Load8U}, -#line 296 "src/lexer-keywords.txt" - {"i32x4.min_u", TokenType::Binary, Opcode::I32X4MinU}, -#line 331 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32SubU}, {""}, {""}, {""}, -#line 40 "src/lexer-keywords.txt" - {"declare", TokenType::Declare}, - {""}, {""}, -#line 79 "src/lexer-keywords.txt" - {"f32x4.abs", TokenType::Unary, Opcode::F32X4Abs}, -#line 528 "src/lexer-keywords.txt" - {"f32.demote/f64", TokenType::Convert, Opcode::F32DemoteF64}, +#line 513 "src/lexer-keywords.txt" + {"v128.load", TokenType::Load, Opcode::V128Load}, {""}, -#line 132 "src/lexer-keywords.txt" - {"f64x2.div", TokenType::Binary, Opcode::F64X2Div}, -#line 371 "src/lexer-keywords.txt" - {"i64.load16_s", TokenType::Load, Opcode::I64Load16S}, -#line 244 "src/lexer-keywords.txt" - {"i32.load16_s", TokenType::Load, Opcode::I32Load16S}, +#line 377 "src/lexer-keywords.txt" + {"i64.load32_s", TokenType::Load, Opcode::I64Load32S}, +#line 398 "src/lexer-keywords.txt" + {"i64.store8", TokenType::Store, Opcode::I64Store8}, +#line 268 "src/lexer-keywords.txt" + {"i32.store8", TokenType::Store, Opcode::I32Store8}, +#line 345 "src/lexer-keywords.txt" + {"i64.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I64AtomicRmwAdd}, +#line 222 "src/lexer-keywords.txt" + {"i32.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I32AtomicRmwAdd}, +#line 346 "src/lexer-keywords.txt" + {"i64.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I64AtomicRmwAnd}, +#line 223 "src/lexer-keywords.txt" + {"i32.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I32AtomicRmwAnd}, {""}, -#line 277 "src/lexer-keywords.txt" - {"i32x4.abs", TokenType::Unary, Opcode::I32X4Abs}, -#line 21 "src/lexer-keywords.txt" - {"assert_invalid", TokenType::AssertInvalid}, -#line 25 "src/lexer-keywords.txt" - {"assert_unlinkable", TokenType::AssertUnlinkable}, -#line 372 "src/lexer-keywords.txt" - {"i64.load16_u", TokenType::Load, Opcode::I64Load16U}, -#line 245 "src/lexer-keywords.txt" - {"i32.load16_u", TokenType::Load, Opcode::I32Load16U}, -#line 560 "src/lexer-keywords.txt" - {"set_local", TokenType::LocalSet, Opcode::LocalSet}, - {""}, {""}, {""}, -#line 561 "src/lexer-keywords.txt" - {"tee_local", TokenType::LocalTee, Opcode::LocalTee}, -#line 334 "src/lexer-keywords.txt" +#line 338 "src/lexer-keywords.txt" {"i64.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AddU}, -#line 211 "src/lexer-keywords.txt" +#line 215 "src/lexer-keywords.txt" {"i32.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AddU}, - {""}, {""}, -#line 91 "src/lexer-keywords.txt" - {"f32x4.min", TokenType::Binary, Opcode::F32X4Min}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 104 "src/lexer-keywords.txt" - {"f64.convert_i32_s", TokenType::Convert, Opcode::F64ConvertI32S}, -#line 53 "src/lexer-keywords.txt" - {"f32.convert_i32_s", TokenType::Convert, Opcode::F32ConvertI32S}, - {""}, -#line 507 "src/lexer-keywords.txt" - {"v128.and", TokenType::Binary, Opcode::V128And}, - {""}, -#line 335 "src/lexer-keywords.txt" +#line 62 "src/lexer-keywords.txt" + {"f32.demote_f64", TokenType::Convert, Opcode::F32DemoteF64}, + {""}, {""}, {""}, +#line 339 "src/lexer-keywords.txt" {"i64.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AndU}, -#line 212 "src/lexer-keywords.txt" +#line 216 "src/lexer-keywords.txt" {"i32.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AndU}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 510 "src/lexer-keywords.txt" - {"v128.load", TokenType::Load, Opcode::V128Load}, -#line 344 "src/lexer-keywords.txt" - {"i64.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I64AtomicRmwOr}, -#line 221 "src/lexer-keywords.txt" - {"i32.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I32AtomicRmwOr}, - {""}, {""}, {""}, -#line 345 "src/lexer-keywords.txt" - {"i64.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I64AtomicRmwSub}, -#line 222 "src/lexer-keywords.txt" - {"i32.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I32AtomicRmwSub}, {""}, -#line 512 "src/lexer-keywords.txt" - {"v128.or", TokenType::Binary, Opcode::V128Or}, -#line 504 "src/lexer-keywords.txt" - {"type", TokenType::Type}, +#line 342 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8SubU}, +#line 219 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8SubU}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 564 "src/lexer-keywords.txt" + {"tee_local", TokenType::LocalTee, Opcode::LocalTee}, +#line 378 "src/lexer-keywords.txt" + {"i64.load32_u", TokenType::Load, Opcode::I64Load32U}, {""}, -#line 506 "src/lexer-keywords.txt" - {"v128.andnot", TokenType::Binary, Opcode::V128Andnot}, +#line 563 "src/lexer-keywords.txt" + {"set_local", TokenType::LocalSet, Opcode::LocalSet}, + {""}, {""}, +#line 517 "src/lexer-keywords.txt" + {"v128", Type::V128}, +#line 35 "src/lexer-keywords.txt" + {"call_indirect", TokenType::CallIndirect, Opcode::CallIndirect}, #line 23 "src/lexer-keywords.txt" - {"assert_return", TokenType::AssertReturn}, -#line 341 "src/lexer-keywords.txt" - {"i64.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I64AtomicRmwAdd}, -#line 218 "src/lexer-keywords.txt" - {"i32.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I32AtomicRmwAdd}, - {""}, -#line 22 "src/lexer-keywords.txt" {"assert_malformed", TokenType::AssertMalformed}, -#line 48 "src/lexer-keywords.txt" - {"export", TokenType::Export}, - {""}, {""}, -#line 152 "src/lexer-keywords.txt" - {"get", TokenType::Get}, -#line 456 "src/lexer-keywords.txt" - {"import", TokenType::Import}, - {""}, {""}, {""}, {""}, -#line 508 "src/lexer-keywords.txt" - {"v128.bitselect", TokenType::Ternary, Opcode::V128BitSelect}, -#line 80 "src/lexer-keywords.txt" - {"f32x4.add", TokenType::Binary, Opcode::F32X4Add}, + {""}, +#line 554 "src/lexer-keywords.txt" + {"i64.trunc_s/f32", TokenType::Convert, Opcode::I64TruncF32S}, +#line 542 "src/lexer-keywords.txt" + {"i32.trunc_s/f32", TokenType::Convert, Opcode::I32TruncF32S}, {""}, {""}, -#line 318 "src/lexer-keywords.txt" - {"i64.atomic.load8_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad8U}, -#line 202 "src/lexer-keywords.txt" - {"i32.atomic.load8_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad8U}, +#line 505 "src/lexer-keywords.txt" + {"throw", TokenType::Throw, Opcode::Throw}, {""}, {""}, -#line 278 "src/lexer-keywords.txt" - {"i32x4.add", TokenType::Binary, Opcode::I32X4Add}, -#line 317 "src/lexer-keywords.txt" - {"i64.atomic.load32_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad32U}, - {""}, {""}, {""}, {""}, -#line 327 "src/lexer-keywords.txt" +#line 136 "src/lexer-keywords.txt" + {"f64x2.div", TokenType::Binary, Opcode::F64X2Div}, + {""}, {""}, {""}, +#line 331 "src/lexer-keywords.txt" {"i64.atomic.rmw32.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AddU}, {""}, -#line 30 "src/lexer-keywords.txt" - {"br_if", TokenType::BrIf, Opcode::BrIf}, - {""}, -#line 397 "src/lexer-keywords.txt" - {"i64.trunc_f32_s", TokenType::Convert, Opcode::I64TruncF32S}, -#line 267 "src/lexer-keywords.txt" +#line 558 "src/lexer-keywords.txt" + {"i64.trunc_u/f32", TokenType::Convert, Opcode::I64TruncF32U}, +#line 546 "src/lexer-keywords.txt" + {"i32.trunc_u/f32", TokenType::Convert, Opcode::I32TruncF32U}, + {""}, {""}, +#line 332 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AndU}, + {""}, {""}, {""}, {""}, +#line 401 "src/lexer-keywords.txt" + {"i64.trunc_f32_s", TokenType::Convert, Opcode::I64TruncF32S}, +#line 271 "src/lexer-keywords.txt" {"i32.trunc_f32_s", TokenType::Convert, Opcode::I32TruncF32S}, - {""}, -#line 398 "src/lexer-keywords.txt" +#line 27 "src/lexer-keywords.txt" + {"atomic.fence", TokenType::AtomicFence, Opcode::AtomicFence}, +#line 22 "src/lexer-keywords.txt" + {"assert_invalid", TokenType::AssertInvalid}, + {""}, {""}, {""}, {""}, {""}, +#line 423 "src/lexer-keywords.txt" + {"i64.xor", TokenType::Binary, Opcode::I64Xor}, +#line 317 "src/lexer-keywords.txt" + {"i32.xor", TokenType::Binary, Opcode::I32Xor}, + {""}, {""}, +#line 402 "src/lexer-keywords.txt" {"i64.trunc_f32_u", TokenType::Convert, Opcode::I64TruncF32U}, -#line 268 "src/lexer-keywords.txt" +#line 272 "src/lexer-keywords.txt" {"i32.trunc_f32_u", TokenType::Convert, Opcode::I32TruncF32U}, - {""}, {""}, -#line 487 "src/lexer-keywords.txt" - {"return_call", TokenType::ReturnCall, Opcode::ReturnCall}, -#line 342 "src/lexer-keywords.txt" - {"i64.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I64AtomicRmwAnd}, -#line 219 "src/lexer-keywords.txt" - {"i32.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I32AtomicRmwAnd}, - {""}, {""}, {""}, -#line 328 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AndU}, -#line 509 "src/lexer-keywords.txt" - {"v128.const", TokenType::Const, Opcode::V128Const}, - {""}, {""}, {""}, -#line 463 "src/lexer-keywords.txt" - {"loop", TokenType::Loop, Opcode::Loop}, - {""}, -#line 330 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32OrU}, -#line 495 "src/lexer-keywords.txt" - {"table.get", TokenType::TableGet, Opcode::TableGet}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 105 "src/lexer-keywords.txt" - {"f64.convert_i32_u", TokenType::Convert, Opcode::F64ConvertI32U}, -#line 54 "src/lexer-keywords.txt" - {"f32.convert_i32_u", TokenType::Convert, Opcode::F32ConvertI32U}, -#line 41 "src/lexer-keywords.txt" - {"drop", TokenType::Drop, Opcode::Drop}, -#line 279 "src/lexer-keywords.txt" - {"i32x4.all_true", TokenType::Unary, Opcode::I32X4AllTrue}, - {""}, -#line 106 "src/lexer-keywords.txt" - {"f64.convert_i64_s", TokenType::Convert, Opcode::F64ConvertI64S}, -#line 55 "src/lexer-keywords.txt" - {"f32.convert_i64_s", TokenType::Convert, Opcode::F32ConvertI64S}, - {""}, -#line 530 "src/lexer-keywords.txt" - {"f64.convert_s/i32", TokenType::Convert, Opcode::F64ConvertI32S}, -#line 524 "src/lexer-keywords.txt" - {"f32.convert_s/i32", TokenType::Convert, Opcode::F32ConvertI32S}, - {""}, -#line 532 "src/lexer-keywords.txt" - {"f64.convert_u/i32", TokenType::Convert, Opcode::F64ConvertI32U}, -#line 526 "src/lexer-keywords.txt" - {"f32.convert_u/i32", TokenType::Convert, Opcode::F32ConvertI32U}, - {""}, -#line 83 "src/lexer-keywords.txt" - {"f32x4.div", TokenType::Binary, Opcode::F32X4Div}, - {""}, {""}, {""}, -#line 551 "src/lexer-keywords.txt" - {"i64.trunc_s/f32", TokenType::Convert, Opcode::I64TruncF32S}, -#line 539 "src/lexer-keywords.txt" - {"i32.trunc_s/f32", TokenType::Convert, Opcode::I32TruncF32S}, - {""}, -#line 555 "src/lexer-keywords.txt" - {"i64.trunc_u/f32", TokenType::Convert, Opcode::I64TruncF32U}, -#line 543 "src/lexer-keywords.txt" - {"i32.trunc_u/f32", TokenType::Convert, Opcode::I32TruncF32U}, - {""}, -#line 136 "src/lexer-keywords.txt" - {"f64x2.gt", TokenType::Compare, Opcode::F64X2Gt}, -#line 329 "src/lexer-keywords.txt" +#line 333 "src/lexer-keywords.txt" {"i64.atomic.rmw32.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw32CmpxchgU}, -#line 502 "src/lexer-keywords.txt" - {"throw", TokenType::Throw, Opcode::Throw}, -#line 324 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16SubU}, -#line 208 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16SubU}, - {""}, {""}, -#line 145 "src/lexer-keywords.txt" - {"f64x2.splat", TokenType::Unary, Opcode::F64X2Splat}, -#line 135 "src/lexer-keywords.txt" - {"f64x2.ge", TokenType::Compare, Opcode::F64X2Ge}, -#line 34 "src/lexer-keywords.txt" - {"call_indirect", TokenType::CallIndirect, Opcode::CallIndirect}, -#line 128 "src/lexer-keywords.txt" - {"f64.trunc", TokenType::Unary, Opcode::F64Trunc}, -#line 77 "src/lexer-keywords.txt" - {"f32.trunc", TokenType::Unary, Opcode::F32Trunc}, + {""}, {""}, {""}, +#line 490 "src/lexer-keywords.txt" + {"return_call", TokenType::ReturnCall, Opcode::ReturnCall}, {""}, {""}, -#line 416 "src/lexer-keywords.txt" - {"i64x2.splat", TokenType::Unary, Opcode::I64X2Splat}, - {""}, -#line 155 "src/lexer-keywords.txt" - {"global", TokenType::Global}, - {""}, {""}, {""}, {""}, {""}, -#line 154 "src/lexer-keywords.txt" - {"global.set", TokenType::GlobalSet, Opcode::GlobalSet}, - {""}, {""}, {""}, {""}, {""}, -#line 392 "src/lexer-keywords.txt" +#line 482 "src/lexer-keywords.txt" + {"ref.extern", TokenType::RefExtern}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 396 "src/lexer-keywords.txt" {"i64.store16", TokenType::Store, Opcode::I64Store16}, -#line 263 "src/lexer-keywords.txt" +#line 267 "src/lexer-keywords.txt" {"i32.store16", TokenType::Store, Opcode::I32Store16}, + {""}, {""}, {""}, {""}, {""}, +#line 511 "src/lexer-keywords.txt" + {"v128.bitselect", TokenType::Ternary, Opcode::V128BitSelect}, +#line 349 "src/lexer-keywords.txt" + {"i64.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I64AtomicRmwSub}, +#line 226 "src/lexer-keywords.txt" + {"i32.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I32AtomicRmwSub}, +#line 379 "src/lexer-keywords.txt" + {"i64.load8_s", TokenType::Load, Opcode::I64Load8S}, +#line 250 "src/lexer-keywords.txt" + {"i32.load8_s", TokenType::Load, Opcode::I32Load8S}, + {""}, {""}, +#line 26 "src/lexer-keywords.txt" + {"assert_unlinkable", TokenType::AssertUnlinkable}, +#line 103 "src/lexer-keywords.txt" + {"f32x4", TokenType::F32X4}, +#line 555 "src/lexer-keywords.txt" + {"i64.trunc_s/f64", TokenType::Convert, Opcode::I64TruncF64S}, +#line 543 "src/lexer-keywords.txt" + {"i32.trunc_s/f64", TokenType::Convert, Opcode::I32TruncF64S}, +#line 310 "src/lexer-keywords.txt" + {"i32x4", TokenType::I32X4}, + {""}, +#line 108 "src/lexer-keywords.txt" + {"f64.convert_i32_s", TokenType::Convert, Opcode::F64ConvertI32S}, +#line 57 "src/lexer-keywords.txt" + {"f32.convert_i32_s", TokenType::Convert, Opcode::F32ConvertI32S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 477 "src/lexer-keywords.txt" - {"param", TokenType::Param}, - {""}, {""}, {""}, {""}, -#line 399 "src/lexer-keywords.txt" +#line 559 "src/lexer-keywords.txt" + {"i64.trunc_u/f64", TokenType::Convert, Opcode::I64TruncF64U}, +#line 547 "src/lexer-keywords.txt" + {"i32.trunc_u/f64", TokenType::Convert, Opcode::I32TruncF64U}, +#line 507 "src/lexer-keywords.txt" + {"type", TokenType::Type}, + {""}, {""}, {""}, +#line 42 "src/lexer-keywords.txt" + {"drop", TokenType::Drop, Opcode::Drop}, +#line 380 "src/lexer-keywords.txt" + {"i64.load8_u", TokenType::Load, Opcode::I64Load8U}, +#line 251 "src/lexer-keywords.txt" + {"i32.load8_u", TokenType::Load, Opcode::I32Load8U}, +#line 403 "src/lexer-keywords.txt" {"i64.trunc_f64_s", TokenType::Convert, Opcode::I64TruncF64S}, -#line 269 "src/lexer-keywords.txt" +#line 273 "src/lexer-keywords.txt" {"i32.trunc_f64_s", TokenType::Convert, Opcode::I32TruncF64S}, {""}, -#line 400 "src/lexer-keywords.txt" - {"i64.trunc_f64_u", TokenType::Convert, Opcode::I64TruncF64U}, -#line 270 "src/lexer-keywords.txt" - {"i32.trunc_f64_u", TokenType::Convert, Opcode::I32TruncF64U}, -#line 348 "src/lexer-keywords.txt" - {"i64.atomic.store16", TokenType::AtomicStore, Opcode::I64AtomicStore16}, -#line 225 "src/lexer-keywords.txt" - {"i32.atomic.store16", TokenType::AtomicStore, Opcode::I32AtomicStore16}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 361 "src/lexer-keywords.txt" - {"i64.extend32_s", TokenType::Unary, Opcode::I64Extend32S}, -#line 26 "src/lexer-keywords.txt" - {"atomic.fence", TokenType::AtomicFence, Opcode::AtomicFence}, - {""}, {""}, {""}, -#line 548 "src/lexer-keywords.txt" - {"i64.extend_s/i32", TokenType::Convert, Opcode::I64ExtendI32S}, - {""}, {""}, -#line 549 "src/lexer-keywords.txt" - {"i64.extend_u/i32", TokenType::Convert, Opcode::I64ExtendI32U}, +#line 327 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16OrU}, +#line 211 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16OrU}, {""}, {""}, {""}, {""}, -#line 363 "src/lexer-keywords.txt" - {"i64.extend_i32_s", TokenType::Convert, Opcode::I64ExtendI32S}, +#line 472 "src/lexer-keywords.txt" + {"memory.size", TokenType::MemorySize, Opcode::MemorySize}, {""}, {""}, {""}, -#line 107 "src/lexer-keywords.txt" - {"f64.convert_i64_u", TokenType::Convert, Opcode::F64ConvertI64U}, -#line 56 "src/lexer-keywords.txt" - {"f32.convert_i64_u", TokenType::Convert, Opcode::F32ConvertI64U}, -#line 364 "src/lexer-keywords.txt" - {"i64.extend_i32_u", TokenType::Convert, Opcode::I64ExtendI32U}, -#line 31 "src/lexer-keywords.txt" - {"br_on_exn", TokenType::BrOnExn, Opcode::BrOnExn}, -#line 382 "src/lexer-keywords.txt" +#line 404 "src/lexer-keywords.txt" + {"i64.trunc_f64_u", TokenType::Convert, Opcode::I64TruncF64U}, +#line 274 "src/lexer-keywords.txt" + {"i32.trunc_f64_u", TokenType::Convert, Opcode::I32TruncF64U}, +#line 386 "src/lexer-keywords.txt" {"i64.or", TokenType::Binary, Opcode::I64Or}, -#line 253 "src/lexer-keywords.txt" +#line 257 "src/lexer-keywords.txt" {"i32.or", TokenType::Binary, Opcode::I32Or}, + {""}, {""}, +#line 52 "src/lexer-keywords.txt" + {"export", TokenType::Export}, +#line 328 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16SubU}, +#line 212 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16SubU}, +#line 460 "src/lexer-keywords.txt" + {"import", TokenType::Import}, +#line 471 "src/lexer-keywords.txt" + {"memory.init", TokenType::MemoryInit, Opcode::MemoryInit}, + {""}, +#line 480 "src/lexer-keywords.txt" + {"param", TokenType::Param}, +#line 98 "src/lexer-keywords.txt" + {"f32x4.ne", TokenType::Compare, Opcode::F32X4Ne}, + {""}, {""}, +#line 303 "src/lexer-keywords.txt" + {"i32x4.ne", TokenType::Compare, Opcode::I32X4Ne}, {""}, {""}, {""}, -#line 401 "src/lexer-keywords.txt" - {"i64.trunc_sat_f32_s", TokenType::Convert, Opcode::I64TruncSatF32S}, -#line 271 "src/lexer-keywords.txt" - {"i32.trunc_sat_f32_s", TokenType::Convert, Opcode::I32TruncSatF32S}, - {""}, {""}, {""}, {""}, -#line 402 "src/lexer-keywords.txt" - {"i64.trunc_sat_f32_u", TokenType::Convert, Opcode::I64TruncSatF32U}, -#line 272 "src/lexer-keywords.txt" - {"i32.trunc_sat_f32_u", TokenType::Convert, Opcode::I32TruncSatF32U}, -#line 552 "src/lexer-keywords.txt" - {"i64.trunc_s/f64", TokenType::Convert, Opcode::I64TruncF64S}, -#line 540 "src/lexer-keywords.txt" - {"i32.trunc_s/f64", TokenType::Convert, Opcode::I32TruncF64S}, +#line 477 "src/lexer-keywords.txt" + {"nan:canonical", TokenType::NanCanonical}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 533 "src/lexer-keywords.txt" + {"f64.convert_s/i32", TokenType::Convert, Opcode::F64ConvertI32S}, +#line 527 "src/lexer-keywords.txt" + {"f32.convert_s/i32", TokenType::Convert, Opcode::F32ConvertI32S}, +#line 467 "src/lexer-keywords.txt" + {"loop", TokenType::Loop, Opcode::Loop}, +#line 518 "src/lexer-keywords.txt" + {"v128.xor", TokenType::Binary, Opcode::V128Xor}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 110 "src/lexer-keywords.txt" + {"f64.convert_i64_s", TokenType::Convert, Opcode::F64ConvertI64S}, +#line 59 "src/lexer-keywords.txt" + {"f32.convert_i64_s", TokenType::Convert, Opcode::F32ConvertI64S}, +#line 20 "src/lexer-keywords.txt" + {"array", Type::Array, TokenType::Array}, +#line 535 "src/lexer-keywords.txt" + {"f64.convert_u/i32", TokenType::Convert, Opcode::F64ConvertI32U}, +#line 529 "src/lexer-keywords.txt" + {"f32.convert_u/i32", TokenType::Convert, Opcode::F32ConvertI32U}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 95 "src/lexer-keywords.txt" + {"f32x4.min", TokenType::Binary, Opcode::F32X4Min}, {""}, -#line 556 "src/lexer-keywords.txt" - {"i64.trunc_u/f64", TokenType::Convert, Opcode::I64TruncF64U}, -#line 544 "src/lexer-keywords.txt" - {"i32.trunc_u/f64", TokenType::Convert, Opcode::I32TruncF64U}, -#line 320 "src/lexer-keywords.txt" +#line 92 "src/lexer-keywords.txt" + {"f32x4.le", TokenType::Compare, Opcode::F32X4Le}, + {""}, {""}, {""}, {""}, {""}, +#line 93 "src/lexer-keywords.txt" + {"f32x4.lt", TokenType::Compare, Opcode::F32X4Lt}, +#line 299 "src/lexer-keywords.txt" + {"i32x4.min_s", TokenType::Binary, Opcode::I32X4MinS}, +#line 551 "src/lexer-keywords.txt" + {"i64.extend_s/i32", TokenType::Convert, Opcode::I64ExtendI32S}, +#line 324 "src/lexer-keywords.txt" {"i64.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AddU}, -#line 204 "src/lexer-keywords.txt" +#line 208 "src/lexer-keywords.txt" {"i32.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AddU}, {""}, {""}, {""}, -#line 496 "src/lexer-keywords.txt" - {"table.grow", TokenType::TableGrow, Opcode::TableGrow}, -#line 362 "src/lexer-keywords.txt" - {"i64.extend8_s", TokenType::Unary, Opcode::I64Extend8S}, -#line 237 "src/lexer-keywords.txt" - {"i32.extend8_s", TokenType::Unary, Opcode::I32Extend8S}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 321 "src/lexer-keywords.txt" +#line 32 "src/lexer-keywords.txt" + {"br_on_exn", TokenType::BrOnExn, Opcode::BrOnExn}, +#line 325 "src/lexer-keywords.txt" {"i64.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AndU}, -#line 205 "src/lexer-keywords.txt" +#line 209 "src/lexer-keywords.txt" {"i32.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AndU}, -#line 459 "src/lexer-keywords.txt" - {"local.get", TokenType::LocalGet, Opcode::LocalGet}, {""}, {""}, -#line 316 "src/lexer-keywords.txt" - {"i64.atomic.load16_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad16U}, -#line 201 "src/lexer-keywords.txt" - {"i32.atomic.load16_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad16U}, -#line 323 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16OrU}, -#line 207 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16OrU}, +#line 109 "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 552 "src/lexer-keywords.txt" + {"i64.extend_u/i32", TokenType::Convert, Opcode::I64ExtendI32U}, +#line 156 "src/lexer-keywords.txt" + {"get", TokenType::Get}, {""}, -#line 436 "src/lexer-keywords.txt" - {"i8x16.lt_s", TokenType::Compare, Opcode::I8X16LtS}, +#line 352 "src/lexer-keywords.txt" + {"i64.atomic.store16", TokenType::AtomicStore, Opcode::I64AtomicStore16}, +#line 229 "src/lexer-keywords.txt" + {"i32.atomic.store16", TokenType::AtomicStore, Opcode::I32AtomicStore16}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 300 "src/lexer-keywords.txt" + {"i32x4.min_u", TokenType::Binary, Opcode::I32X4MinU}, + {""}, +#line 326 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw16CmpxchgU}, +#line 210 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw16CmpxchgU}, + {""}, {""}, {""}, {""}, +#line 469 "src/lexer-keywords.txt" + {"memory.fill", TokenType::MemoryFill, Opcode::MemoryFill}, + {""}, +#line 84 "src/lexer-keywords.txt" + {"f32x4.add", TokenType::Binary, Opcode::F32X4Add}, +#line 116 "src/lexer-keywords.txt" + {"f64.ge", TokenType::Compare, Opcode::F64Ge}, +#line 66 "src/lexer-keywords.txt" + {"f32.ge", TokenType::Compare, Opcode::F32Ge}, +#line 282 "src/lexer-keywords.txt" + {"i32x4.add", TokenType::Binary, Opcode::I32X4Add}, + {""}, {""}, {""}, +#line 117 "src/lexer-keywords.txt" + {"f64.gt", TokenType::Compare, Opcode::F64Gt}, +#line 67 "src/lexer-keywords.txt" + {"f32.gt", TokenType::Compare, Opcode::F32Gt}, + {""}, +#line 102 "src/lexer-keywords.txt" + {"f32x4.sub", TokenType::Binary, Opcode::F32X4Sub}, +#line 489 "src/lexer-keywords.txt" + {"return_call_indirect", TokenType::ReturnCallIndirect, Opcode::ReturnCallIndirect}, + {""}, +#line 309 "src/lexer-keywords.txt" + {"i32x4.sub", TokenType::Binary, Opcode::I32X4Sub}, +#line 291 "src/lexer-keywords.txt" + {"i32x4.le_s", TokenType::Compare, Opcode::I32X4LeS}, {""}, {""}, -#line 437 "src/lexer-keywords.txt" - {"i8x16.lt_u", TokenType::Compare, Opcode::I8X16LtU}, -#line 434 "src/lexer-keywords.txt" - {"i8x16.le_s", TokenType::Compare, Opcode::I8X16LeS}, +#line 295 "src/lexer-keywords.txt" + {"i32x4.lt_s", TokenType::Compare, Opcode::I32X4LtS}, {""}, {""}, -#line 435 "src/lexer-keywords.txt" - {"i8x16.le_u", TokenType::Compare, Opcode::I8X16LeU}, +#line 365 "src/lexer-keywords.txt" + {"i64.extend32_s", TokenType::Unary, Opcode::I64Extend32S}, {""}, {""}, -#line 87 "src/lexer-keywords.txt" - {"f32x4.gt", TokenType::Compare, Opcode::F32X4Gt}, - {""}, {""}, {""}, {""}, {""}, {""}, +#line 486 "src/lexer-keywords.txt" + {"register", TokenType::Register}, + {""}, {""}, {""}, +#line 292 "src/lexer-keywords.txt" + {"i32x4.le_u", TokenType::Compare, Opcode::I32X4LeU}, +#line 83 "src/lexer-keywords.txt" + {"f32x4.abs", TokenType::Unary, Opcode::F32X4Abs}, + {""}, +#line 296 "src/lexer-keywords.txt" + {"i32x4.lt_u", TokenType::Compare, Opcode::I32X4LtU}, +#line 281 "src/lexer-keywords.txt" + {"i32x4.abs", TokenType::Unary, Opcode::I32X4Abs}, + {""}, {""}, +#line 367 "src/lexer-keywords.txt" + {"i64.extend_i32_s", TokenType::Convert, Opcode::I64ExtendI32S}, + {""}, {""}, {""}, +#line 321 "src/lexer-keywords.txt" + {"i64.atomic.load32_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad32U}, + {""}, {""}, {""}, {""}, {""}, +#line 111 "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 96 "src/lexer-keywords.txt" - {"f32x4.splat", TokenType::Unary, Opcode::F32X4Splat}, -#line 86 "src/lexer-keywords.txt" - {"f32x4.ge", TokenType::Compare, Opcode::F32X4Ge}, + {"f32x4.mul", TokenType::Binary, Opcode::F32X4Mul}, {""}, -#line 453 "src/lexer-keywords.txt" - {"i8x16.sub", TokenType::Binary, Opcode::I8X16Sub}, +#line 337 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XorU}, +#line 301 "src/lexer-keywords.txt" + {"i32x4.mul", TokenType::Binary, Opcode::I32X4Mul}, {""}, -#line 285 "src/lexer-keywords.txt" - {"i32x4.gt_s", TokenType::Compare, Opcode::I32X4GtS}, +#line 322 "src/lexer-keywords.txt" + {"i64.atomic.load8_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad8U}, +#line 206 "src/lexer-keywords.txt" + {"i32.atomic.load8_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad8U}, {""}, -#line 304 "src/lexer-keywords.txt" - {"i32x4.splat", TokenType::Unary, Opcode::I32X4Splat}, -#line 286 "src/lexer-keywords.txt" - {"i32x4.gt_u", TokenType::Compare, Opcode::I32X4GtU}, -#line 283 "src/lexer-keywords.txt" - {"i32x4.ge_s", TokenType::Compare, Opcode::I32X4GeS}, -#line 478 "src/lexer-keywords.txt" - {"quote", TokenType::Quote}, +#line 344 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XorU}, +#line 221 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XorU}, + {""}, {""}, {""}, {""}, +#line 368 "src/lexer-keywords.txt" + {"i64.extend_i32_u", TokenType::Convert, Opcode::I64ExtendI32U}, +#line 31 "src/lexer-keywords.txt" + {"br_if", TokenType::BrIf, Opcode::BrIf}, {""}, -#line 284 "src/lexer-keywords.txt" - {"i32x4.ge_u", TokenType::Compare, Opcode::I32X4GeU}, -#line 113 "src/lexer-keywords.txt" - {"f64.gt", TokenType::Compare, Opcode::F64Gt}, -#line 63 "src/lexer-keywords.txt" - {"f32.gt", TokenType::Compare, Opcode::F32Gt}, +#line 481 "src/lexer-keywords.txt" + {"quote", TokenType::Quote}, {""}, {""}, -#line 322 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw16CmpxchgU}, -#line 206 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw16CmpxchgU}, -#line 445 "src/lexer-keywords.txt" - {"i8x16.ne", TokenType::Compare, Opcode::I8X16Ne}, -#line 473 "src/lexer-keywords.txt" - {"nan:canonical", TokenType::NanCanonical}, -#line 112 "src/lexer-keywords.txt" - {"f64.ge", TokenType::Compare, Opcode::F64Ge}, -#line 62 "src/lexer-keywords.txt" - {"f32.ge", TokenType::Compare, Opcode::F32Ge}, - {""}, {""}, {""}, {""}, {""}, -#line 367 "src/lexer-keywords.txt" +#line 405 "src/lexer-keywords.txt" + {"i64.trunc_sat_f32_s", TokenType::Convert, Opcode::I64TruncSatF32S}, +#line 275 "src/lexer-keywords.txt" + {"i32.trunc_sat_f32_s", TokenType::Convert, Opcode::I32TruncSatF32S}, + {""}, {""}, +#line 369 "src/lexer-keywords.txt" + {"i64.ge_s", TokenType::Compare, Opcode::I64GeS}, +#line 242 "src/lexer-keywords.txt" + {"i32.ge_s", TokenType::Compare, Opcode::I32GeS}, + {""}, +#line 371 "src/lexer-keywords.txt" {"i64.gt_s", TokenType::Compare, Opcode::I64GtS}, -#line 240 "src/lexer-keywords.txt" +#line 244 "src/lexer-keywords.txt" {"i32.gt_s", TokenType::Compare, Opcode::I32GtS}, -#line 440 "src/lexer-keywords.txt" - {"i8x16.min_s", TokenType::Binary, Opcode::I8X16MinS}, + {""}, {""}, {""}, +#line 498 "src/lexer-keywords.txt" + {"table.get", TokenType::TableGet, Opcode::TableGet}, +#line 37 "src/lexer-keywords.txt" + {"catch", TokenType::Catch, Opcode::Catch}, +#line 115 "src/lexer-keywords.txt" + {"f64.floor", TokenType::Unary, Opcode::F64Floor}, +#line 65 "src/lexer-keywords.txt" + {"f32.floor", TokenType::Unary, Opcode::F32Floor}, + {""}, {""}, +#line 394 "src/lexer-keywords.txt" + {"i64.shr_s", TokenType::Binary, Opcode::I64ShrS}, +#line 265 "src/lexer-keywords.txt" + {"i32.shr_s", TokenType::Binary, Opcode::I32ShrS}, + {""}, {""}, {""}, +#line 499 "src/lexer-keywords.txt" + {"table.grow", TokenType::TableGrow, Opcode::TableGrow}, + {""}, {""}, +#line 406 "src/lexer-keywords.txt" + {"i64.trunc_sat_f32_u", TokenType::Convert, Opcode::I64TruncSatF32U}, +#line 276 "src/lexer-keywords.txt" + {"i32.trunc_sat_f32_u", TokenType::Convert, Opcode::I32TruncSatF32U}, {""}, -#line 365 "src/lexer-keywords.txt" - {"i64.ge_s", TokenType::Compare, Opcode::I64GeS}, -#line 238 "src/lexer-keywords.txt" - {"i32.ge_s", TokenType::Compare, Opcode::I32GeS}, -#line 368 "src/lexer-keywords.txt" - {"i64.gt_u", TokenType::Compare, Opcode::I64GtU}, -#line 241 "src/lexer-keywords.txt" - {"i32.gt_u", TokenType::Compare, Opcode::I32GtU}, -#line 441 "src/lexer-keywords.txt" - {"i8x16.min_u", TokenType::Binary, Opcode::I8X16MinU}, -#line 483 "src/lexer-keywords.txt" - {"register", TokenType::Register}, -#line 366 "src/lexer-keywords.txt" +#line 149 "src/lexer-keywords.txt" + {"f64x2.splat", TokenType::Unary, Opcode::F64X2Splat}, +#line 370 "src/lexer-keywords.txt" {"i64.ge_u", TokenType::Compare, Opcode::I64GeU}, -#line 239 "src/lexer-keywords.txt" +#line 243 "src/lexer-keywords.txt" {"i32.ge_u", TokenType::Compare, Opcode::I32GeU}, - {""}, -#line 336 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw8CmpxchgU}, -#line 213 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw8CmpxchgU}, - {""}, {""}, -#line 486 "src/lexer-keywords.txt" - {"return_call_indirect", TokenType::ReturnCallIndirect, Opcode::ReturnCallIndirect}, - {""}, {""}, {""}, {""}, {""}, #line 420 "src/lexer-keywords.txt" - {"i8x16.abs", TokenType::Unary, Opcode::I8X16Abs}, -#line 389 "src/lexer-keywords.txt" + {"i64x2.splat", TokenType::Unary, Opcode::I64X2Splat}, +#line 372 "src/lexer-keywords.txt" + {"i64.gt_u", TokenType::Compare, Opcode::I64GtU}, +#line 245 "src/lexer-keywords.txt" + {"i32.gt_u", TokenType::Compare, Opcode::I32GtU}, +#line 129 "src/lexer-keywords.txt" + {"f64.sqrt", TokenType::Unary, Opcode::F64Sqrt}, +#line 78 "src/lexer-keywords.txt" + {"f32.sqrt", TokenType::Unary, Opcode::F32Sqrt}, + {""}, {""}, {""}, {""}, +#line 139 "src/lexer-keywords.txt" + {"f64x2.ge", TokenType::Compare, Opcode::F64X2Ge}, + {""}, +#line 87 "src/lexer-keywords.txt" + {"f32x4.div", TokenType::Binary, Opcode::F32X4Div}, +#line 395 "src/lexer-keywords.txt" + {"i64.shr_u", TokenType::Binary, Opcode::I64ShrU}, +#line 266 "src/lexer-keywords.txt" + {"i32.shr_u", TokenType::Binary, Opcode::I32ShrU}, + {""}, +#line 140 "src/lexer-keywords.txt" + {"f64x2.gt", TokenType::Compare, Opcode::F64X2Gt}, +#line 21 "src/lexer-keywords.txt" + {"assert_exhaustion", TokenType::AssertExhaustion}, + {""}, {""}, +#line 393 "src/lexer-keywords.txt" {"i64.shl", TokenType::Binary, Opcode::I64Shl}, -#line 260 "src/lexer-keywords.txt" +#line 264 "src/lexer-keywords.txt" {"i32.shl", TokenType::Binary, Opcode::I32Shl}, -#line 125 "src/lexer-keywords.txt" - {"f64.sqrt", TokenType::Unary, Opcode::F64Sqrt}, -#line 74 "src/lexer-keywords.txt" - {"f32.sqrt", TokenType::Unary, Opcode::F32Sqrt}, - {""}, -#line 408 "src/lexer-keywords.txt" - {"i64x2.load32x2_s", TokenType::Load, Opcode::I64X2Load32X2S}, -#line 293 "src/lexer-keywords.txt" - {"i32x4.max_s", TokenType::Binary, Opcode::I32X4MaxS}, -#line 111 "src/lexer-keywords.txt" - {"f64.floor", TokenType::Unary, Opcode::F64Floor}, -#line 61 "src/lexer-keywords.txt" - {"f32.floor", TokenType::Unary, Opcode::F32Floor}, {""}, {""}, -#line 409 "src/lexer-keywords.txt" - {"i64x2.load32x2_u", TokenType::Load, Opcode::I64X2Load32X2U}, -#line 294 "src/lexer-keywords.txt" - {"i32x4.max_u", TokenType::Binary, Opcode::I32X4MaxU}, +#line 506 "src/lexer-keywords.txt" + {"try", TokenType::Try, Opcode::Try}, +#line 364 "src/lexer-keywords.txt" + {"i64.extend16_s", TokenType::Unary, Opcode::I64Extend16S}, +#line 240 "src/lexer-keywords.txt" + {"i32.extend16_s", TokenType::Unary, Opcode::I32Extend16S}, {""}, {""}, {""}, {""}, -#line 468 "src/lexer-keywords.txt" - {"memory.size", TokenType::MemorySize, Opcode::MemorySize}, +#line 158 "src/lexer-keywords.txt" + {"global.set", TokenType::GlobalSet, Opcode::GlobalSet}, +#line 336 "src/lexer-keywords.txt" + {"i64.atomic.rmw32.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XchgU}, + {""}, {""}, {""}, +#line 159 "src/lexer-keywords.txt" + {"global", TokenType::Global}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 449 "src/lexer-keywords.txt" + {"i8x16.ne", TokenType::Compare, Opcode::I8X16Ne}, {""}, {""}, {""}, {""}, -#line 531 "src/lexer-keywords.txt" - {"f64.convert_s/i64", TokenType::Convert, Opcode::F64ConvertI64S}, -#line 525 "src/lexer-keywords.txt" - {"f32.convert_s/i64", TokenType::Convert, Opcode::F32ConvertI64S}, - {""}, -#line 533 "src/lexer-keywords.txt" - {"f64.convert_u/i64", TokenType::Convert, Opcode::F64ConvertI64U}, -#line 527 "src/lexer-keywords.txt" - {"f32.convert_u/i64", TokenType::Convert, Opcode::F32ConvertI64U}, +#line 418 "src/lexer-keywords.txt" + {"i64x2.shr_s", TokenType::Binary, Opcode::I64X2ShrS}, +#line 283 "src/lexer-keywords.txt" + {"i32x4.all_true", TokenType::Unary, Opcode::I32X4AllTrue}, + {""}, {""}, {""}, {""}, {""}, +#line 366 "src/lexer-keywords.txt" + {"i64.extend8_s", TokenType::Unary, Opcode::I64Extend8S}, +#line 241 "src/lexer-keywords.txt" + {"i32.extend8_s", TokenType::Unary, Opcode::I32Extend8S}, {""}, -#line 20 "src/lexer-keywords.txt" - {"assert_exhaustion", TokenType::AssertExhaustion}, +#line 340 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw8CmpxchgU}, +#line 217 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw8CmpxchgU}, {""}, {""}, -#line 337 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8OrU}, -#line 214 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8OrU}, +#line 526 "src/lexer-keywords.txt" + {"anyfunc", Type::Funcref}, {""}, {""}, {""}, {""}, {""}, -#line 465 "src/lexer-keywords.txt" - {"memory.fill", TokenType::MemoryFill, Opcode::MemoryFill}, +#line 473 "src/lexer-keywords.txt" + {"memory", TokenType::Memory}, + {""}, {""}, {""}, {""}, {""}, +#line 419 "src/lexer-keywords.txt" + {"i64x2.shr_u", TokenType::Binary, Opcode::I64X2ShrU}, {""}, -#line 537 "src/lexer-keywords.txt" - {"get_local", TokenType::LocalGet, Opcode::LocalGet}, -#line 333 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XorU}, +#line 341 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8OrU}, +#line 218 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8OrU}, {""}, {""}, {""}, -#line 518 "src/lexer-keywords.txt" - {"v64x2.load_splat", TokenType::Load, Opcode::V64X2LoadSplat}, +#line 532 "src/lexer-keywords.txt" + {"f32.reinterpret/i32", TokenType::Convert, Opcode::F32ReinterpretI32}, {""}, -#line 18 "src/lexer-keywords.txt" - {"anyref", Type::Anyref}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 454 "src/lexer-keywords.txt" - {"i8x16", TokenType::I8X16}, -#line 467 "src/lexer-keywords.txt" - {"memory.init", TokenType::MemoryInit, Opcode::MemoryInit}, +#line 463 "src/lexer-keywords.txt" + {"local.get", TokenType::LocalGet, Opcode::LocalGet}, {""}, {""}, -#line 390 "src/lexer-keywords.txt" - {"i64.shr_s", TokenType::Binary, Opcode::I64ShrS}, -#line 261 "src/lexer-keywords.txt" - {"i32.shr_s", TokenType::Binary, Opcode::I32ShrS}, - {""}, {""}, {""}, {""}, -#line 391 "src/lexer-keywords.txt" - {"i64.shr_u", TokenType::Binary, Opcode::I64ShrU}, -#line 262 "src/lexer-keywords.txt" - {"i32.shr_u", TokenType::Binary, Opcode::I32ShrU}, -#line 515 "src/lexer-keywords.txt" - {"v128.xor", TokenType::Binary, Opcode::V128Xor}, - {""}, -#line 146 "src/lexer-keywords.txt" - {"f64x2.sqrt", TokenType::Unary, Opcode::F64X2Sqrt}, -#line 413 "src/lexer-keywords.txt" - {"i64x2.shl", TokenType::Binary, Opcode::I64X2Shl}, +#line 444 "src/lexer-keywords.txt" + {"i8x16.min_s", TokenType::Binary, Opcode::I8X16MinS}, + {""}, {""}, {""}, +#line 29 "src/lexer-keywords.txt" + {"binary", TokenType::Bin}, +#line 412 "src/lexer-keywords.txt" + {"i64x2.load32x2_s", TokenType::Load, Opcode::I64X2Load32X2S}, {""}, {""}, -#line 423 "src/lexer-keywords.txt" - {"i8x16.add", TokenType::Binary, Opcode::I8X16Add}, +#line 121 "src/lexer-keywords.txt" + {"f64.max", TokenType::Binary, Opcode::F64Max}, +#line 71 "src/lexer-keywords.txt" + {"f32.max", TokenType::Binary, Opcode::F32Max}, {""}, -#line 175 "src/lexer-keywords.txt" - {"i16x8.lt_s", TokenType::Compare, Opcode::I16X8LtS}, - {""}, {""}, -#line 176 "src/lexer-keywords.txt" - {"i16x8.lt_u", TokenType::Compare, Opcode::I16X8LtU}, -#line 171 "src/lexer-keywords.txt" - {"i16x8.le_s", TokenType::Compare, Opcode::I16X8LeS}, +#line 189 "src/lexer-keywords.txt" + {"i16x8.ne", TokenType::Compare, Opcode::I16X8Ne}, {""}, {""}, -#line 172 "src/lexer-keywords.txt" - {"i16x8.le_u", TokenType::Compare, Opcode::I16X8LeU}, +#line 330 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XorU}, +#line 214 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XorU}, +#line 150 "src/lexer-keywords.txt" + {"f64x2.sqrt", TokenType::Unary, Opcode::F64X2Sqrt}, +#line 77 "src/lexer-keywords.txt" + {"f32.reinterpret_i32", TokenType::Convert, Opcode::F32ReinterpretI32}, +#line 320 "src/lexer-keywords.txt" + {"i64.atomic.load16_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad16U}, +#line 205 "src/lexer-keywords.txt" + {"i32.atomic.load16_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad16U}, +#line 483 "src/lexer-keywords.txt" + {"ref.func", TokenType::RefFunc, Opcode::RefFunc}, {""}, {""}, {""}, {""}, {""}, -#line 360 "src/lexer-keywords.txt" - {"i64.extend16_s", TokenType::Unary, Opcode::I64Extend16S}, -#line 236 "src/lexer-keywords.txt" - {"i32.extend16_s", TokenType::Unary, Opcode::I32Extend16S}, - {""}, -#line 359 "src/lexer-keywords.txt" +#line 445 "src/lexer-keywords.txt" + {"i8x16.min_u", TokenType::Binary, Opcode::I8X16MinU}, + {""}, {""}, {""}, {""}, +#line 413 "src/lexer-keywords.txt" + {"i64x2.load32x2_u", TokenType::Load, Opcode::I64X2Load32X2U}, + {""}, {""}, +#line 363 "src/lexer-keywords.txt" {"i64.eqz", TokenType::Convert, Opcode::I64Eqz}, -#line 235 "src/lexer-keywords.txt" +#line 239 "src/lexer-keywords.txt" {"i32.eqz", TokenType::Convert, Opcode::I32Eqz}, -#line 181 "src/lexer-keywords.txt" - {"i16x8.mul", TokenType::Binary, Opcode::I16X8Mul}, - {""}, -#line 193 "src/lexer-keywords.txt" - {"i16x8.sub", TokenType::Binary, Opcode::I16X8Sub}, - {""}, -#line 73 "src/lexer-keywords.txt" - {"f32.reinterpret_i32", TokenType::Convert, Opcode::F32ReinterpretI32}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, -#line 474 "src/lexer-keywords.txt" - {"nop", TokenType::Nop, Opcode::Nop}, -#line 185 "src/lexer-keywords.txt" - {"i16x8.ne", TokenType::Compare, Opcode::I16X8Ne}, -#line 311 "src/lexer-keywords.txt" - {"i32x4.widen_low_i16x8_s", TokenType::Unary, Opcode::I32X4WidenLowI16X8S}, - {""}, -#line 451 "src/lexer-keywords.txt" - {"i8x16.sub_saturate_s", TokenType::Binary, Opcode::I8X16SubSaturateS}, -#line 312 "src/lexer-keywords.txt" - {"i32x4.widen_low_i16x8_u", TokenType::Unary, Opcode::I32X4WidenLowI16X8U}, -#line 36 "src/lexer-keywords.txt" - {"catch", TokenType::Catch, Opcode::Catch}, -#line 452 "src/lexer-keywords.txt" - {"i8x16.sub_saturate_u", TokenType::Binary, Opcode::I8X16SubSaturateU}, -#line 424 "src/lexer-keywords.txt" - {"i8x16.all_true", TokenType::Unary, Opcode::I8X16AllTrue}, {""}, {""}, {""}, -#line 179 "src/lexer-keywords.txt" +#line 427 "src/lexer-keywords.txt" + {"i8x16.add", TokenType::Binary, Opcode::I8X16Add}, + {""}, {""}, {""}, {""}, +#line 417 "src/lexer-keywords.txt" + {"i64x2.shl", TokenType::Binary, Opcode::I64X2Shl}, + {""}, {""}, {""}, {""}, +#line 457 "src/lexer-keywords.txt" + {"i8x16.sub", TokenType::Binary, Opcode::I8X16Sub}, +#line 438 "src/lexer-keywords.txt" + {"i8x16.le_s", TokenType::Compare, Opcode::I8X16LeS}, + {""}, {""}, +#line 440 "src/lexer-keywords.txt" + {"i8x16.lt_s", TokenType::Compare, Opcode::I8X16LtS}, +#line 183 "src/lexer-keywords.txt" {"i16x8.min_s", TokenType::Binary, Opcode::I16X8MinS}, -#line 403 "src/lexer-keywords.txt" - {"i64.trunc_sat_f64_s", TokenType::Convert, Opcode::I64TruncSatF64S}, -#line 273 "src/lexer-keywords.txt" - {"i32.trunc_sat_f64_s", TokenType::Convert, Opcode::I32TruncSatF64S}, - {""}, -#line 414 "src/lexer-keywords.txt" - {"i64x2.shr_s", TokenType::Binary, Opcode::I64X2ShrS}, -#line 559 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, +#line 562 "src/lexer-keywords.txt" {"set_global", TokenType::GlobalSet, Opcode::GlobalSet}, -#line 180 "src/lexer-keywords.txt" - {"i16x8.min_u", TokenType::Binary, Opcode::I16X8MinU}, -#line 404 "src/lexer-keywords.txt" - {"i64.trunc_sat_f64_u", TokenType::Convert, Opcode::I64TruncSatF64U}, -#line 274 "src/lexer-keywords.txt" - {"i32.trunc_sat_f64_u", TokenType::Convert, Opcode::I32TruncSatF64U}, +#line 538 "src/lexer-keywords.txt" + {"f64.reinterpret/i64", TokenType::Convert, Opcode::F64ReinterpretI64}, +#line 458 "src/lexer-keywords.txt" + {"i8x16", TokenType::I8X16}, {""}, -#line 415 "src/lexer-keywords.txt" - {"i64x2.shr_u", TokenType::Binary, Opcode::I64X2ShrU}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 521 "src/lexer-keywords.txt" - {"v8x16.swizzle", TokenType::Binary, Opcode::V8X16Swizzle}, -#line 157 "src/lexer-keywords.txt" - {"i16x8.abs", TokenType::Unary, Opcode::I16X8Abs}, - {""}, {""}, {""}, -#line 529 "src/lexer-keywords.txt" - {"f32.reinterpret/i32", TokenType::Convert, Opcode::F32ReinterpretI32}, +#line 439 "src/lexer-keywords.txt" + {"i8x16.le_u", TokenType::Compare, Opcode::I8X16LeU}, {""}, {""}, -#line 194 "src/lexer-keywords.txt" - {"i16x8", TokenType::I16X8}, -#line 332 "src/lexer-keywords.txt" - {"i64.atomic.rmw32.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XchgU}, - {""}, -#line 350 "src/lexer-keywords.txt" - {"i64.atomic.store8", TokenType::AtomicStore, Opcode::I64AtomicStore8}, -#line 226 "src/lexer-keywords.txt" - {"i32.atomic.store8", TokenType::AtomicStore, Opcode::I32AtomicStore8}, - {""}, -#line 121 "src/lexer-keywords.txt" - {"f64.neg", TokenType::Unary, Opcode::F64Neg}, -#line 71 "src/lexer-keywords.txt" - {"f32.neg", TokenType::Unary, Opcode::F32Neg}, - {""}, {""}, {""}, {""}, -#line 134 "src/lexer-keywords.txt" +#line 441 "src/lexer-keywords.txt" + {"i8x16.lt_u", TokenType::Compare, Opcode::I8X16LtU}, +#line 424 "src/lexer-keywords.txt" + {"i8x16.abs", TokenType::Unary, Opcode::I8X16Abs}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 138 "src/lexer-keywords.txt" {"f64x2.extract_lane", TokenType::SimdLaneOp, Opcode::F64X2ExtractLane}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 407 "src/lexer-keywords.txt" + {""}, {""}, +#line 411 "src/lexer-keywords.txt" {"i64x2.extract_lane", TokenType::SimdLaneOp, Opcode::I64X2ExtractLane}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 123 "src/lexer-keywords.txt" - {"f64.promote_f32", TokenType::Convert, Opcode::F64PromoteF32}, -#line 479 "src/lexer-keywords.txt" - {"ref.func", TokenType::RefFunc, Opcode::RefFunc}, -#line 517 "src/lexer-keywords.txt" - {"v32x4.load_splat", TokenType::Load, Opcode::V32X4LoadSplat}, - {""}, {""}, {""}, -#line 117 "src/lexer-keywords.txt" - {"f64.max", TokenType::Binary, Opcode::F64Max}, -#line 67 "src/lexer-keywords.txt" - {"f32.max", TokenType::Binary, Opcode::F32Max}, - {""}, {""}, {""}, {""}, {""}, -#line 419 "src/lexer-keywords.txt" - {"i64.xor", TokenType::Binary, Opcode::I64Xor}, -#line 313 "src/lexer-keywords.txt" - {"i32.xor", TokenType::Binary, Opcode::I32Xor}, +#line 537 "src/lexer-keywords.txt" + {"f64.promote/f32", TokenType::Convert, Opcode::F64PromoteF32}, +#line 184 "src/lexer-keywords.txt" + {"i16x8.min_u", TokenType::Binary, Opcode::I16X8MinU}, {""}, -#line 124 "src/lexer-keywords.txt" +#line 128 "src/lexer-keywords.txt" {"f64.reinterpret_i64", TokenType::Convert, Opcode::F64ReinterpretI64}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 164 "src/lexer-keywords.txt" + {"i16x8.add", TokenType::Binary, Opcode::I16X8Add}, + {""}, +#line 329 "src/lexer-keywords.txt" + {"i64.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XchgU}, +#line 213 "src/lexer-keywords.txt" + {"i32.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XchgU}, +#line 508 "src/lexer-keywords.txt" + {"unreachable", TokenType::Unreachable, Opcode::Unreachable}, {""}, {""}, {""}, -#line 153 "src/lexer-keywords.txt" - {"global.get", TokenType::GlobalGet, Opcode::GlobalGet}, -#line 326 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XorU}, -#line 210 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XorU}, +#line 127 "src/lexer-keywords.txt" + {"f64.promote_f32", TokenType::Convert, Opcode::F64PromoteF32}, {""}, -#line 19 "src/lexer-keywords.txt" - {"array", TokenType::Array}, +#line 197 "src/lexer-keywords.txt" + {"i16x8.sub", TokenType::Binary, Opcode::I16X8Sub}, +#line 175 "src/lexer-keywords.txt" + {"i16x8.le_s", TokenType::Compare, Opcode::I16X8LeS}, {""}, -#line 97 "src/lexer-keywords.txt" - {"f32x4.sqrt", TokenType::Unary, Opcode::F32X4Sqrt}, -#line 301 "src/lexer-keywords.txt" - {"i32x4.shl", TokenType::Binary, Opcode::I32X4Shl}, +#line 540 "src/lexer-keywords.txt" + {"get_local", TokenType::LocalGet, Opcode::LocalGet}, +#line 179 "src/lexer-keywords.txt" + {"i16x8.lt_s", TokenType::Compare, Opcode::I16X8LtS}, {""}, {""}, {""}, -#line 139 "src/lexer-keywords.txt" +#line 534 "src/lexer-keywords.txt" + {"f64.convert_s/i64", TokenType::Convert, Opcode::F64ConvertI64S}, +#line 528 "src/lexer-keywords.txt" + {"f32.convert_s/i64", TokenType::Convert, Opcode::F32ConvertI64S}, +#line 478 "src/lexer-keywords.txt" + {"nop", TokenType::Nop, Opcode::Nop}, + {""}, {""}, {""}, +#line 176 "src/lexer-keywords.txt" + {"i16x8.le_u", TokenType::Compare, Opcode::I16X8LeU}, + {""}, {""}, +#line 180 "src/lexer-keywords.txt" + {"i16x8.lt_u", TokenType::Compare, Opcode::I16X8LtU}, +#line 161 "src/lexer-keywords.txt" + {"i16x8.abs", TokenType::Unary, Opcode::I16X8Abs}, +#line 476 "src/lexer-keywords.txt" + {"nan:arithmetic", TokenType::NanArithmetic}, +#line 143 "src/lexer-keywords.txt" {"f64x2.max", TokenType::Binary, Opcode::F64X2Max}, +#line 536 "src/lexer-keywords.txt" + {"f64.convert_u/i64", TokenType::Convert, Opcode::F64ConvertI64U}, +#line 530 "src/lexer-keywords.txt" + {"f32.convert_u/i64", TokenType::Convert, Opcode::F32ConvertI64U}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 297 "src/lexer-keywords.txt" + {"i32x4.max_s", TokenType::Binary, Opcode::I32X4MaxS}, + {""}, +#line 185 "src/lexer-keywords.txt" + {"i16x8.mul", TokenType::Binary, Opcode::I16X8Mul}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 298 "src/lexer-keywords.txt" + {"i32x4.max_u", TokenType::Binary, Opcode::I32X4MaxU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 160 "src/lexer-keywords.txt" - {"i16x8.add", TokenType::Binary, Opcode::I16X8Add}, - {""}, {""}, {""}, {""}, -#line 421 "src/lexer-keywords.txt" - {"i8x16.add_saturate_s", TokenType::Binary, Opcode::I8X16AddSaturateS}, +#line 148 "src/lexer-keywords.txt" + {"f64x2.replace_lane", TokenType::SimdLaneOp, Opcode::F64X2ReplaceLane}, {""}, {""}, -#line 422 "src/lexer-keywords.txt" - {"i8x16.add_saturate_u", TokenType::Binary, Opcode::I8X16AddSaturateU}, +#line 416 "src/lexer-keywords.txt" + {"i64x2.replace_lane", TokenType::SimdLaneOp, Opcode::I64X2ReplaceLane}, + {""}, {""}, {""}, +#line 43 "src/lexer-keywords.txt" + {"elem.drop", TokenType::ElemDrop, Opcode::ElemDrop}, + {""}, {""}, {""}, {""}, {""}, +#line 428 "src/lexer-keywords.txt" + {"i8x16.all_true", TokenType::Unary, Opcode::I8X16AllTrue}, {""}, -#line 534 "src/lexer-keywords.txt" - {"f64.promote/f32", TokenType::Convert, Opcode::F64PromoteF32}, +#line 39 "src/lexer-keywords.txt" + {"data.drop", TokenType::DataDrop, Opcode::DataDrop}, {""}, {""}, -#line 142 "src/lexer-keywords.txt" - {"f64x2.neg", TokenType::Unary, Opcode::F64X2Neg}, +#line 38 "src/lexer-keywords.txt" + {"current_memory", TokenType::MemorySize, Opcode::MemorySize}, + {""}, {""}, +#line 198 "src/lexer-keywords.txt" + {"i16x8", TokenType::I16X8}, + {""}, {""}, +#line 284 "src/lexer-keywords.txt" + {"i32x4.any_true", TokenType::Unary, Opcode::I32X4AnyTrue}, {""}, {""}, {""}, {""}, -#line 24 "src/lexer-keywords.txt" - {"assert_trap", TokenType::AssertTrap}, - {""}, -#line 411 "src/lexer-keywords.txt" - {"i64x2.neg", TokenType::Unary, Opcode::I64X2Neg}, - {""}, {""}, {""}, {""}, {""}, -#line 535 "src/lexer-keywords.txt" - {"f64.reinterpret/i64", TokenType::Convert, Opcode::F64ReinterpretI64}, +#line 496 "src/lexer-keywords.txt" + {"table.copy", TokenType::TableCopy, Opcode::TableCopy}, +#line 521 "src/lexer-keywords.txt" + {"v64x2.load_splat", TokenType::Load, Opcode::V64X2LoadSplat}, {""}, {""}, {""}, {""}, {""}, -#line 144 "src/lexer-keywords.txt" - {"f64x2.replace_lane", TokenType::SimdLaneOp, Opcode::F64X2ReplaceLane}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 412 "src/lexer-keywords.txt" - {"i64x2.replace_lane", TokenType::SimdLaneOp, Opcode::I64X2ReplaceLane}, +#line 100 "src/lexer-keywords.txt" + {"f32x4.splat", TokenType::Unary, Opcode::F32X4Splat}, + {""}, {""}, +#line 308 "src/lexer-keywords.txt" + {"i32x4.splat", TokenType::Unary, Opcode::I32X4Splat}, {""}, -#line 191 "src/lexer-keywords.txt" - {"i16x8.sub_saturate_s", TokenType::Binary, Opcode::I16X8SubSaturateS}, +#line 524 "src/lexer-keywords.txt" + {"v8x16.swizzle", TokenType::Binary, Opcode::V8X16Swizzle}, +#line 315 "src/lexer-keywords.txt" + {"i32x4.widen_low_i16x8_s", TokenType::Unary, Opcode::I32X4WidenLowI16X8S}, {""}, -#line 302 "src/lexer-keywords.txt" - {"i32x4.shr_s", TokenType::Binary, Opcode::I32X4ShrS}, -#line 192 "src/lexer-keywords.txt" - {"i16x8.sub_saturate_u", TokenType::Binary, Opcode::I16X8SubSaturateU}, -#line 161 "src/lexer-keywords.txt" - {"i16x8.all_true", TokenType::Unary, Opcode::I16X8AllTrue}, +#line 354 "src/lexer-keywords.txt" + {"i64.atomic.store8", TokenType::AtomicStore, Opcode::I64AtomicStore8}, +#line 230 "src/lexer-keywords.txt" + {"i32.atomic.store8", TokenType::AtomicStore, Opcode::I32AtomicStore8}, + {""}, {""}, +#line 90 "src/lexer-keywords.txt" + {"f32x4.ge", TokenType::Compare, Opcode::F32X4Ge}, +#line 351 "src/lexer-keywords.txt" + {"i64.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I64AtomicRmwXor}, +#line 228 "src/lexer-keywords.txt" + {"i32.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I32AtomicRmwXor}, {""}, {""}, {""}, -#line 303 "src/lexer-keywords.txt" - {"i32x4.shr_u", TokenType::Binary, Opcode::I32X4ShrU}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 553 "src/lexer-keywords.txt" +#line 91 "src/lexer-keywords.txt" + {"f32x4.gt", TokenType::Compare, Opcode::F32X4Gt}, +#line 316 "src/lexer-keywords.txt" + {"i32x4.widen_low_i16x8_u", TokenType::Unary, Opcode::I32X4WidenLowI16X8U}, + {""}, +#line 28 "src/lexer-keywords.txt" + {"atomic.notify", TokenType::AtomicNotify, Opcode::AtomicNotify}, +#line 556 "src/lexer-keywords.txt" {"i64.trunc_s:sat/f32", TokenType::Convert, Opcode::I64TruncSatF32S}, -#line 541 "src/lexer-keywords.txt" +#line 544 "src/lexer-keywords.txt" {"i32.trunc_s:sat/f32", TokenType::Convert, Opcode::I32TruncSatF32S}, - {""}, -#line 557 "src/lexer-keywords.txt" + {""}, {""}, {""}, +#line 470 "src/lexer-keywords.txt" + {"memory.grow", TokenType::MemoryGrow, Opcode::MemoryGrow}, + {""}, {""}, {""}, +#line 165 "src/lexer-keywords.txt" + {"i16x8.all_true", TokenType::Unary, Opcode::I16X8AllTrue}, + {""}, {""}, {""}, +#line 560 "src/lexer-keywords.txt" {"i64.trunc_u:sat/f32", TokenType::Convert, Opcode::I64TruncSatF32U}, -#line 545 "src/lexer-keywords.txt" +#line 548 "src/lexer-keywords.txt" {"i32.trunc_u:sat/f32", TokenType::Convert, Opcode::I32TruncSatF32U}, - {""}, {""}, {""}, {""}, {""}, -#line 432 "src/lexer-keywords.txt" - {"i8x16.gt_s", TokenType::Compare, Opcode::I8X16GtS}, - {""}, -#line 450 "src/lexer-keywords.txt" - {"i8x16.splat", TokenType::Unary, Opcode::I8X16Splat}, -#line 433 "src/lexer-keywords.txt" - {"i8x16.gt_u", TokenType::Compare, Opcode::I8X16GtU}, -#line 430 "src/lexer-keywords.txt" - {"i8x16.ge_s", TokenType::Compare, Opcode::I8X16GeS}, - {""}, {""}, -#line 431 "src/lexer-keywords.txt" - {"i8x16.ge_u", TokenType::Compare, Opcode::I8X16GeU}, - {""}, -#line 42 "src/lexer-keywords.txt" - {"elem.drop", TokenType::ElemDrop, Opcode::ElemDrop}, - {""}, -#line 85 "src/lexer-keywords.txt" - {"f32x4.extract_lane", TokenType::SimdLaneOp, Opcode::F32X4ExtractLane}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 282 "src/lexer-keywords.txt" - {"i32x4.extract_lane", TokenType::SimdLaneOp, Opcode::I32X4ExtractLane}, - {""}, {""}, {""}, {""}, -#line 325 "src/lexer-keywords.txt" - {"i64.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XchgU}, -#line 209 "src/lexer-keywords.txt" - {"i32.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XchgU}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 38 "src/lexer-keywords.txt" - {"data.drop", TokenType::DataDrop, Opcode::DataDrop}, {""}, -#line 505 "src/lexer-keywords.txt" - {"unreachable", TokenType::Unreachable, Opcode::Unreachable}, +#line 407 "src/lexer-keywords.txt" + {"i64.trunc_sat_f64_s", TokenType::Convert, Opcode::I64TruncSatF64S}, +#line 277 "src/lexer-keywords.txt" + {"i32.trunc_sat_f64_s", TokenType::Convert, Opcode::I32TruncSatF64S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 340 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XorU}, -#line 217 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XorU}, - {""}, {""}, {""}, {""}, -#line 438 "src/lexer-keywords.txt" - {"i8x16.max_s", TokenType::Binary, Opcode::I8X16MaxS}, +#line 306 "src/lexer-keywords.txt" + {"i32x4.shr_s", TokenType::Binary, Opcode::I32X4ShrS}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, +#line 408 "src/lexer-keywords.txt" + {"i64.trunc_sat_f64_u", TokenType::Convert, Opcode::I64TruncSatF64U}, +#line 278 "src/lexer-keywords.txt" + {"i32.trunc_sat_f64_u", TokenType::Convert, Opcode::I32TruncSatF64U}, {""}, {""}, {""}, -#line 90 "src/lexer-keywords.txt" - {"f32x4.max", TokenType::Binary, Opcode::F32X4Max}, +#line 287 "src/lexer-keywords.txt" + {"i32x4.ge_s", TokenType::Compare, Opcode::I32X4GeS}, + {""}, {""}, +#line 289 "src/lexer-keywords.txt" + {"i32x4.gt_s", TokenType::Compare, Opcode::I32X4GtS}, + {""}, {""}, {""}, {""}, +#line 25 "src/lexer-keywords.txt" + {"assert_trap", TokenType::AssertTrap}, {""}, -#line 439 "src/lexer-keywords.txt" - {"i8x16.max_u", TokenType::Binary, Opcode::I8X16MaxU}, - {""}, {""}, {""}, {""}, {""}, {""}, #line 307 "src/lexer-keywords.txt" - {"i32x4.trunc_sat_f32x4_s", TokenType::Unary, Opcode::I32X4TruncSatF32X4S}, + {"i32x4.shr_u", TokenType::Binary, Opcode::I32X4ShrU}, {""}, {""}, -#line 308 "src/lexer-keywords.txt" - {"i32x4.trunc_sat_f32x4_u", TokenType::Unary, Opcode::I32X4TruncSatF32X4U}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 289 "src/lexer-keywords.txt" - {"i32x4.load16x4_s", TokenType::Load, Opcode::I32X4Load16X4S}, +#line 288 "src/lexer-keywords.txt" + {"i32x4.ge_u", TokenType::Compare, Opcode::I32X4GeU}, {""}, {""}, -#line 93 "src/lexer-keywords.txt" - {"f32x4.neg", TokenType::Unary, Opcode::F32X4Neg}, - {""}, -#line 158 "src/lexer-keywords.txt" - {"i16x8.add_saturate_s", TokenType::Binary, Opcode::I16X8AddSaturateS}, #line 290 "src/lexer-keywords.txt" - {"i32x4.load16x4_u", TokenType::Load, Opcode::I32X4Load16X4U}, - {""}, -#line 159 "src/lexer-keywords.txt" - {"i16x8.add_saturate_u", TokenType::Binary, Opcode::I16X8AddSaturateU}, - {""}, -#line 298 "src/lexer-keywords.txt" - {"i32x4.neg", TokenType::Unary, Opcode::I32X4Neg}, -#line 554 "src/lexer-keywords.txt" + {"i32x4.gt_u", TokenType::Compare, Opcode::I32X4GtU}, + {""}, {""}, +#line 557 "src/lexer-keywords.txt" {"i64.trunc_s:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64S}, -#line 542 "src/lexer-keywords.txt" +#line 545 "src/lexer-keywords.txt" {"i32.trunc_s:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64S}, - {""}, -#line 558 "src/lexer-keywords.txt" - {"i64.trunc_u:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64U}, -#line 546 "src/lexer-keywords.txt" - {"i32.trunc_u:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64U}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 95 "src/lexer-keywords.txt" - {"f32x4.replace_lane", TokenType::SimdLaneOp, Opcode::F32X4ReplaceLane}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 300 "src/lexer-keywords.txt" - {"i32x4.replace_lane", TokenType::SimdLaneOp, Opcode::I32X4ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 276 "src/lexer-keywords.txt" - {"i32.wrap_i64", TokenType::Convert, Opcode::I32WrapI64}, +#line 561 "src/lexer-keywords.txt" + {"i64.trunc_u:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64U}, +#line 549 "src/lexer-keywords.txt" + {"i32.trunc_u:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64U}, {""}, -#line 81 "src/lexer-keywords.txt" - {"f32x4.convert_i32x4_s", TokenType::Unary, Opcode::F32X4ConvertI32X4S}, +#line 455 "src/lexer-keywords.txt" + {"i8x16.sub_saturate_s", TokenType::Binary, Opcode::I8X16SubSaturateS}, {""}, {""}, -#line 82 "src/lexer-keywords.txt" - {"f32x4.convert_i32x4_u", TokenType::Unary, Opcode::F32X4ConvertI32X4U}, - {""}, {""}, {""}, {""}, {""}, {""}, +#line 101 "src/lexer-keywords.txt" + {"f32x4.sqrt", TokenType::Unary, Opcode::F32X4Sqrt}, +#line 550 "src/lexer-keywords.txt" + {"i32.wrap/i64", TokenType::Convert, Opcode::I32WrapI64}, + {""}, {""}, +#line 125 "src/lexer-keywords.txt" + {"f64.neg", TokenType::Unary, Opcode::F64Neg}, +#line 75 "src/lexer-keywords.txt" + {"f32.neg", TokenType::Unary, Opcode::F32Neg}, + {""}, {""}, {""}, {""}, +#line 456 "src/lexer-keywords.txt" + {"i8x16.sub_saturate_u", TokenType::Binary, Opcode::I8X16SubSaturateU}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 425 "src/lexer-keywords.txt" + {"i8x16.add_saturate_s", TokenType::Binary, Opcode::I8X16AddSaturateS}, + {""}, {""}, {""}, #line 280 "src/lexer-keywords.txt" - {"i32x4.any_true", TokenType::Unary, Opcode::I32X4AnyTrue}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 255 "src/lexer-keywords.txt" - {"i32.reinterpret_f32", TokenType::Convert, Opcode::I32ReinterpretF32}, + {"i32.wrap_i64", TokenType::Convert, Opcode::I32WrapI64}, + {""}, {""}, {""}, {""}, +#line 305 "src/lexer-keywords.txt" + {"i32x4.shl", TokenType::Binary, Opcode::I32X4Shl}, {""}, {""}, {""}, -#line 169 "src/lexer-keywords.txt" - {"i16x8.gt_s", TokenType::Compare, Opcode::I16X8GtS}, +#line 426 "src/lexer-keywords.txt" + {"i8x16.add_saturate_u", TokenType::Binary, Opcode::I8X16AddSaturateU}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 442 "src/lexer-keywords.txt" + {"i8x16.max_s", TokenType::Binary, Opcode::I8X16MaxS}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 195 "src/lexer-keywords.txt" + {"i16x8.sub_saturate_s", TokenType::Binary, Opcode::I16X8SubSaturateS}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 89 "src/lexer-keywords.txt" + {"f32x4.extract_lane", TokenType::SimdLaneOp, Opcode::F32X4ExtractLane}, + {""}, {""}, +#line 286 "src/lexer-keywords.txt" + {"i32x4.extract_lane", TokenType::SimdLaneOp, Opcode::I32X4ExtractLane}, {""}, -#line 190 "src/lexer-keywords.txt" - {"i16x8.splat", TokenType::Unary, Opcode::I16X8Splat}, -#line 170 "src/lexer-keywords.txt" - {"i16x8.gt_u", TokenType::Compare, Opcode::I16X8GtU}, -#line 167 "src/lexer-keywords.txt" - {"i16x8.ge_s", TokenType::Compare, Opcode::I16X8GeS}, +#line 196 "src/lexer-keywords.txt" + {"i16x8.sub_saturate_u", TokenType::Binary, Opcode::I16X8SubSaturateU}, + {""}, {""}, {""}, {""}, {""}, +#line 443 "src/lexer-keywords.txt" + {"i8x16.max_u", TokenType::Binary, Opcode::I8X16MaxU}, {""}, {""}, -#line 168 "src/lexer-keywords.txt" - {"i16x8.ge_u", TokenType::Compare, Opcode::I16X8GeU}, +#line 162 "src/lexer-keywords.txt" + {"i16x8.add_saturate_s", TokenType::Binary, Opcode::I16X8AddSaturateS}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 347 "src/lexer-keywords.txt" - {"i64.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I64AtomicRmwXor}, -#line 224 "src/lexer-keywords.txt" - {"i32.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I32AtomicRmwXor}, {""}, {""}, {""}, -#line 547 "src/lexer-keywords.txt" - {"i32.wrap/i64", TokenType::Convert, Opcode::I32WrapI64}, - {""}, {""}, {""}, {""}, -#line 426 "src/lexer-keywords.txt" - {"i8x16.avgr_u", TokenType::Binary, Opcode::I8X16AvgrU}, +#line 163 "src/lexer-keywords.txt" + {"i16x8.add_saturate_u", TokenType::Binary, Opcode::I16X8AddSaturateU}, + {""}, {""}, {""}, +#line 293 "src/lexer-keywords.txt" + {"i32x4.load16x4_s", TokenType::Load, Opcode::I32X4Load16X4S}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 181 "src/lexer-keywords.txt" + {"i16x8.max_s", TokenType::Binary, Opcode::I16X8MaxS}, {""}, {""}, {""}, {""}, -#line 110 "src/lexer-keywords.txt" +#line 429 "src/lexer-keywords.txt" + {"i8x16.any_true", TokenType::Unary, Opcode::I8X16AnyTrue}, + {""}, {""}, {""}, +#line 94 "src/lexer-keywords.txt" + {"f32x4.max", TokenType::Binary, Opcode::F32X4Max}, + {""}, +#line 387 "src/lexer-keywords.txt" + {"i64.popcnt", TokenType::Unary, Opcode::I64Popcnt}, +#line 258 "src/lexer-keywords.txt" + {"i32.popcnt", TokenType::Unary, Opcode::I32Popcnt}, + {""}, {""}, {""}, {""}, {""}, +#line 294 "src/lexer-keywords.txt" + {"i32x4.load16x4_u", TokenType::Load, Opcode::I32X4Load16X4U}, +#line 85 "src/lexer-keywords.txt" + {"f32x4.convert_i32x4_s", TokenType::Unary, Opcode::F32X4ConvertI32X4S}, +#line 454 "src/lexer-keywords.txt" + {"i8x16.splat", TokenType::Unary, Opcode::I8X16Splat}, + {""}, {""}, {""}, +#line 468 "src/lexer-keywords.txt" + {"memory.copy", TokenType::MemoryCopy, Opcode::MemoryCopy}, +#line 157 "src/lexer-keywords.txt" + {"global.get", TokenType::GlobalGet, Opcode::GlobalGet}, +#line 182 "src/lexer-keywords.txt" + {"i16x8.max_u", TokenType::Binary, Opcode::I16X8MaxU}, + {""}, +#line 146 "src/lexer-keywords.txt" + {"f64x2.neg", TokenType::Unary, Opcode::F64X2Neg}, + {""}, {""}, +#line 415 "src/lexer-keywords.txt" + {"i64x2.neg", TokenType::Unary, Opcode::I64X2Neg}, +#line 86 "src/lexer-keywords.txt" + {"f32x4.convert_i32x4_u", TokenType::Unary, Opcode::F32X4ConvertI32X4U}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 343 "src/lexer-keywords.txt" + {"i64.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XchgU}, +#line 220 "src/lexer-keywords.txt" + {"i32.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XchgU}, + {""}, {""}, +#line 541 "src/lexer-keywords.txt" + {"i32.reinterpret/f32", TokenType::Convert, Opcode::I32ReinterpretF32}, + {""}, {""}, +#line 114 "src/lexer-keywords.txt" {"f64.eq", TokenType::Compare, Opcode::F64Eq}, -#line 60 "src/lexer-keywords.txt" +#line 64 "src/lexer-keywords.txt" {"f32.eq", TokenType::Compare, Opcode::F32Eq}, - {""}, {""}, {""}, {""}, {""}, -#line 358 "src/lexer-keywords.txt" + {""}, +#line 362 "src/lexer-keywords.txt" {"i64.eq", TokenType::Compare, Opcode::I64Eq}, -#line 234 "src/lexer-keywords.txt" +#line 238 "src/lexer-keywords.txt" {"i32.eq", TokenType::Compare, Opcode::I32Eq}, - {""}, {""}, {""}, {""}, -#line 538 "src/lexer-keywords.txt" - {"i32.reinterpret/f32", TokenType::Convert, Opcode::I32ReinterpretF32}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 177 "src/lexer-keywords.txt" - {"i16x8.max_s", TokenType::Binary, Opcode::I16X8MaxS}, + {""}, {""}, {""}, {""}, {""}, +#line 99 "src/lexer-keywords.txt" + {"f32x4.replace_lane", TokenType::SimdLaneOp, Opcode::F32X4ReplaceLane}, +#line 166 "src/lexer-keywords.txt" + {"i16x8.any_true", TokenType::Unary, Opcode::I16X8AnyTrue}, {""}, -#line 466 "src/lexer-keywords.txt" - {"memory.grow", TokenType::MemoryGrow, Opcode::MemoryGrow}, +#line 304 "src/lexer-keywords.txt" + {"i32x4.replace_lane", TokenType::SimdLaneOp, Opcode::I32X4ReplaceLane}, + {""}, {""}, {""}, {""}, {""}, +#line 259 "src/lexer-keywords.txt" + {"i32.reinterpret_f32", TokenType::Convert, Opcode::I32ReinterpretF32}, + {""}, {""}, +#line 452 "src/lexer-keywords.txt" + {"i8x16.shr_s", TokenType::Binary, Opcode::I8X16ShrS}, {""}, {""}, {""}, -#line 178 "src/lexer-keywords.txt" - {"i16x8.max_u", TokenType::Binary, Opcode::I16X8MaxU}, +#line 194 "src/lexer-keywords.txt" + {"i16x8.splat", TokenType::Unary, Opcode::I16X8Splat}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 434 "src/lexer-keywords.txt" + {"i8x16.ge_s", TokenType::Compare, Opcode::I8X16GeS}, {""}, -#line 523 "src/lexer-keywords.txt" - {"anyfunc", Type::Funcref}, - {""}, {""}, {""}, {""}, -#line 536 "src/lexer-keywords.txt" - {"get_global", TokenType::GlobalGet, Opcode::GlobalGet}, +#line 520 "src/lexer-keywords.txt" + {"v32x4.load_splat", TokenType::Load, Opcode::V32X4LoadSplat}, +#line 436 "src/lexer-keywords.txt" + {"i8x16.gt_s", TokenType::Compare, Opcode::I8X16GtS}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 472 "src/lexer-keywords.txt" - {"nan:arithmetic", TokenType::NanArithmetic}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 519 "src/lexer-keywords.txt" - {"v8x16.load_splat", TokenType::Load, Opcode::V8X16LoadSplat}, +#line 453 "src/lexer-keywords.txt" + {"i8x16.shr_u", TokenType::Binary, Opcode::I8X16ShrU}, + {""}, {""}, +#line 435 "src/lexer-keywords.txt" + {"i8x16.ge_u", TokenType::Compare, Opcode::I8X16GeU}, + {""}, {""}, +#line 437 "src/lexer-keywords.txt" + {"i8x16.gt_u", TokenType::Compare, Opcode::I8X16GtU}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 553 "src/lexer-keywords.txt" + {"i64.reinterpret/f64", TokenType::Convert, Opcode::I64ReinterpretF64}, + {""}, +#line 160 "src/lexer-keywords.txt" + {"grow_memory", TokenType::MemoryGrow, Opcode::MemoryGrow}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 384 "src/lexer-keywords.txt" + {""}, {""}, +#line 192 "src/lexer-keywords.txt" + {"i16x8.shr_s", TokenType::Binary, Opcode::I16X8ShrS}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 388 "src/lexer-keywords.txt" {"i64.reinterpret_f64", TokenType::Convert, Opcode::I64ReinterpretF64}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 383 "src/lexer-keywords.txt" - {"i64.popcnt", TokenType::Unary, Opcode::I64Popcnt}, -#line 254 "src/lexer-keywords.txt" - {"i32.popcnt", TokenType::Unary, Opcode::I32Popcnt}, +#line 171 "src/lexer-keywords.txt" + {"i16x8.ge_s", TokenType::Compare, Opcode::I16X8GeS}, + {""}, +#line 539 "src/lexer-keywords.txt" + {"get_global", TokenType::GlobalGet, Opcode::GlobalGet}, +#line 173 "src/lexer-keywords.txt" + {"i16x8.gt_s", TokenType::Compare, Opcode::I16X8GtS}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 193 "src/lexer-keywords.txt" + {"i16x8.shr_u", TokenType::Binary, Opcode::I16X8ShrU}, + {""}, +#line 451 "src/lexer-keywords.txt" + {"i8x16.shl", TokenType::Binary, Opcode::I8X16Shl}, +#line 172 "src/lexer-keywords.txt" + {"i16x8.ge_u", TokenType::Compare, Opcode::I16X8GeU}, + {""}, {""}, +#line 174 "src/lexer-keywords.txt" + {"i16x8.gt_u", TokenType::Compare, Opcode::I16X8GtU}, {""}, {""}, {""}, {""}, -#line 133 "src/lexer-keywords.txt" +#line 137 "src/lexer-keywords.txt" {"f64x2.eq", TokenType::Compare, Opcode::F64X2Eq}, -#line 447 "src/lexer-keywords.txt" - {"i8x16.shl", TokenType::Binary, Opcode::I8X16Shl}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, -#line 493 "src/lexer-keywords.txt" - {"table.copy", TokenType::TableCopy, Opcode::TableCopy}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 550 "src/lexer-keywords.txt" - {"i64.reinterpret/f64", TokenType::Convert, Opcode::I64ReinterpretF64}, - {""}, {""}, {""}, {""}, {""}, -#line 503 "src/lexer-keywords.txt" - {"try", TokenType::Try, Opcode::Try}, +#line 186 "src/lexer-keywords.txt" + {"i16x8.narrow_i32x4_s", TokenType::Binary, Opcode::I16X8NarrowI32X4S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 469 "src/lexer-keywords.txt" - {"memory", TokenType::Memory}, - {""}, -#line 448 "src/lexer-keywords.txt" - {"i8x16.shr_s", TokenType::Binary, Opcode::I8X16ShrS}, - {""}, {""}, {""}, {""}, {""}, -#line 449 "src/lexer-keywords.txt" - {"i8x16.shr_u", TokenType::Binary, Opcode::I8X16ShrU}, - {""}, {""}, -#line 163 "src/lexer-keywords.txt" - {"i16x8.avgr_u", TokenType::Binary, Opcode::I16X8AvgrU}, +#line 187 "src/lexer-keywords.txt" + {"i16x8.narrow_i32x4_u", TokenType::Binary, Opcode::I16X8NarrowI32X4U}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 191 "src/lexer-keywords.txt" + {"i16x8.shl", TokenType::Binary, Opcode::I16X8Shl}, +#line 112 "src/lexer-keywords.txt" + {"f64.copysign", TokenType::Binary, Opcode::F64Copysign}, +#line 61 "src/lexer-keywords.txt" + {"f32.copysign", TokenType::Binary, Opcode::F32Copysign}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 520 "src/lexer-keywords.txt" + {""}, {""}, +#line 523 "src/lexer-keywords.txt" {"v8x16.shuffle", TokenType::SimdShuffleOp, Opcode::V8X16Shuffle}, - {""}, {""}, {""}, {""}, {""}, -#line 428 "src/lexer-keywords.txt" + {""}, +#line 432 "src/lexer-keywords.txt" {"i8x16.extract_lane_s", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneS}, - {""}, {""}, -#line 429 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 311 "src/lexer-keywords.txt" + {"i32x4.trunc_sat_f32x4_s", TokenType::Unary, Opcode::I32X4TruncSatF32X4S}, + {""}, {""}, {""}, {""}, +#line 433 "src/lexer-keywords.txt" {"i8x16.extract_lane_u", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneU}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 312 "src/lexer-keywords.txt" + {"i32x4.trunc_sat_f32x4_u", TokenType::Unary, Opcode::I32X4TruncSatF32X4U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 28 "src/lexer-keywords.txt" - {"binary", TokenType::Bin}, - {""}, {""}, {""}, {""}, {""}, -#line 516 "src/lexer-keywords.txt" - {"v16x8.load_splat", TokenType::Load, Opcode::V16X8LoadSplat}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, -#line 84 "src/lexer-keywords.txt" - {"f32x4.eq", TokenType::Compare, Opcode::F32X4Eq}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 281 "src/lexer-keywords.txt" - {"i32x4.eq", TokenType::Compare, Opcode::I32X4Eq}, {""}, {""}, {""}, -#line 187 "src/lexer-keywords.txt" - {"i16x8.shl", TokenType::Binary, Opcode::I16X8Shl}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, -#line 444 "src/lexer-keywords.txt" - {"i8x16.neg", TokenType::Unary, Opcode::I8X16Neg}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 446 "src/lexer-keywords.txt" +#line 450 "src/lexer-keywords.txt" {"i8x16.replace_lane", TokenType::SimdLaneOp, Opcode::I8X16ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, -#line 188 "src/lexer-keywords.txt" - {"i16x8.shr_s", TokenType::Binary, Opcode::I16X8ShrS}, - {""}, {""}, {""}, {""}, {""}, -#line 189 "src/lexer-keywords.txt" - {"i16x8.shr_u", TokenType::Binary, Opcode::I16X8ShrU}, - {""}, {""}, {""}, -#line 425 "src/lexer-keywords.txt" - {"i8x16.any_true", TokenType::Unary, Opcode::I8X16AnyTrue}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 197 "src/lexer-keywords.txt" - {"i16x8.widen_low_i8x16_s", TokenType::Unary, Opcode::I16X8WidenLowI8X16S}, - {""}, {""}, -#line 198 "src/lexer-keywords.txt" - {"i16x8.widen_low_i8x16_u", TokenType::Unary, Opcode::I16X8WidenLowI8X16U}, - {""}, {""}, -#line 173 "src/lexer-keywords.txt" - {"i16x8.load8x8_s", TokenType::Load, Opcode::I16X8Load8X8S}, - {""}, {""}, -#line 174 "src/lexer-keywords.txt" - {"i16x8.load8x8_u", TokenType::Load, Opcode::I16X8Load8X8U}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 165 "src/lexer-keywords.txt" + {""}, +#line 169 "src/lexer-keywords.txt" {"i16x8.extract_lane_s", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneS}, +#line 430 "src/lexer-keywords.txt" + {"i8x16.avgr_u", TokenType::Binary, Opcode::I8X16AvgrU}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 166 "src/lexer-keywords.txt" +#line 170 "src/lexer-keywords.txt" {"i16x8.extract_lane_u", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneU}, + {""}, {""}, +#line 522 "src/lexer-keywords.txt" + {"v8x16.load_splat", TokenType::Load, Opcode::V8X16LoadSplat}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 184 "src/lexer-keywords.txt" - {"i16x8.neg", TokenType::Unary, Opcode::I16X8Neg}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 97 "src/lexer-keywords.txt" + {"f32x4.neg", TokenType::Unary, Opcode::F32X4Neg}, + {""}, {""}, +#line 302 "src/lexer-keywords.txt" + {"i32x4.neg", TokenType::Unary, Opcode::I32X4Neg}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 343 "src/lexer-keywords.txt" - {"i64.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmwCmpxchg}, -#line 220 "src/lexer-keywords.txt" - {"i32.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmwCmpxchg}, - {""}, -#line 186 "src/lexer-keywords.txt" +#line 190 "src/lexer-keywords.txt" {"i16x8.replace_lane", TokenType::SimdLaneOp, Opcode::I16X8ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 108 "src/lexer-keywords.txt" - {"f64.copysign", TokenType::Binary, Opcode::F64Copysign}, -#line 57 "src/lexer-keywords.txt" - {"f32.copysign", TokenType::Binary, Opcode::F32Copysign}, {""}, {""}, -#line 162 "src/lexer-keywords.txt" - {"i16x8.any_true", TokenType::Unary, Opcode::I16X8AnyTrue}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 167 "src/lexer-keywords.txt" + {"i16x8.avgr_u", TokenType::Binary, Opcode::I16X8AvgrU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, +#line 519 "src/lexer-keywords.txt" + {"v16x8.load_splat", TokenType::Load, Opcode::V16X8LoadSplat}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 339 "src/lexer-keywords.txt" - {"i64.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XchgU}, -#line 216 "src/lexer-keywords.txt" - {"i32.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XchgU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 182 "src/lexer-keywords.txt" - {"i16x8.narrow_i32x4_s", TokenType::Binary, Opcode::I16X8NarrowI32X4S}, - {""}, {""}, -#line 183 "src/lexer-keywords.txt" - {"i16x8.narrow_i32x4_u", TokenType::Binary, Opcode::I16X8NarrowI32X4U}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 347 "src/lexer-keywords.txt" + {"i64.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmwCmpxchg}, +#line 224 "src/lexer-keywords.txt" + {"i32.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmwCmpxchg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 201 "src/lexer-keywords.txt" + {"i16x8.widen_low_i8x16_s", TokenType::Unary, Opcode::I16X8WidenLowI8X16S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 202 "src/lexer-keywords.txt" + {"i16x8.widen_low_i8x16_u", TokenType::Unary, Opcode::I16X8WidenLowI8X16U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 427 "src/lexer-keywords.txt" - {"i8x16.eq", TokenType::Compare, Opcode::I8X16Eq}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 88 "src/lexer-keywords.txt" + {"f32x4.eq", TokenType::Compare, Opcode::F32X4Eq}, {""}, {""}, -#line 37 "src/lexer-keywords.txt" - {"current_memory", TokenType::MemorySize, Opcode::MemorySize}, - {""}, -#line 27 "src/lexer-keywords.txt" - {"atomic.notify", TokenType::AtomicNotify, Opcode::AtomicNotify}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 285 "src/lexer-keywords.txt" + {"i32x4.eq", TokenType::Compare, Opcode::I32X4Eq}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 309 "src/lexer-keywords.txt" - {"i32x4.widen_high_i16x8_s", TokenType::Unary, Opcode::I32X4WidenHighI16X8S}, - {""}, {""}, -#line 310 "src/lexer-keywords.txt" - {"i32x4.widen_high_i16x8_u", TokenType::Unary, Opcode::I32X4WidenHighI16X8U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, -#line 156 "src/lexer-keywords.txt" - {"grow_memory", TokenType::MemoryGrow, Opcode::MemoryGrow}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, {""}, -#line 442 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, +#line 446 "src/lexer-keywords.txt" {"i8x16.narrow_i16x8_s", TokenType::Binary, Opcode::I8X16NarrowI16X8S}, - {""}, {""}, -#line 443 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 447 "src/lexer-keywords.txt" {"i8x16.narrow_i16x8_u", TokenType::Binary, Opcode::I8X16NarrowI16X8U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, +#line 313 "src/lexer-keywords.txt" + {"i32x4.widen_high_i16x8_s", TokenType::Unary, Opcode::I32X4WidenHighI16X8S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 314 "src/lexer-keywords.txt" + {"i32x4.widen_high_i16x8_u", TokenType::Unary, Opcode::I32X4WidenHighI16X8U}, +#line 448 "src/lexer-keywords.txt" + {"i8x16.neg", TokenType::Unary, Opcode::I8X16Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 177 "src/lexer-keywords.txt" + {"i16x8.load8x8_s", TokenType::Load, Opcode::I16X8Load8X8S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 178 "src/lexer-keywords.txt" + {"i16x8.load8x8_u", TokenType::Load, Opcode::I16X8Load8X8U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 164 "src/lexer-keywords.txt" - {"i16x8.eq", TokenType::Compare, Opcode::I16X8Eq}, +#line 188 "src/lexer-keywords.txt" + {"i16x8.neg", TokenType::Unary, Opcode::I16X8Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1574,19 +1576,20 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, +#line 431 "src/lexer-keywords.txt" + {"i8x16.eq", TokenType::Compare, Opcode::I8X16Eq}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 168 "src/lexer-keywords.txt" + {"i16x8.eq", TokenType::Compare, Opcode::I16X8Eq}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, -#line 346 "src/lexer-keywords.txt" - {"i64.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I64AtomicRmwXchg}, -#line 223 "src/lexer-keywords.txt" - {"i32.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I32AtomicRmwXchg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1599,13 +1602,15 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, -#line 464 "src/lexer-keywords.txt" - {"memory.copy", TokenType::MemoryCopy, Opcode::MemoryCopy}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 350 "src/lexer-keywords.txt" + {"i64.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I64AtomicRmwXchg}, +#line 227 "src/lexer-keywords.txt" + {"i32.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I32AtomicRmwXchg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1613,11 +1618,14 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, - {""}, {""}, {""}, {""}, {""}, -#line 195 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 199 "src/lexer-keywords.txt" {"i16x8.widen_high_i8x16_s", TokenType::Unary, Opcode::I16X8WidenHighI8X16S}, - {""}, {""}, -#line 196 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, + {""}, {""}, {""}, +#line 200 "src/lexer-keywords.txt" {"i16x8.widen_high_i8x16_u", TokenType::Unary, Opcode::I16X8WidenHighI8X16U} }; diff --git a/src/shared-validator.cc b/src/shared-validator.cc index e84ccf12a..a2bc3539a 100644 --- a/src/shared-validator.cc +++ b/src/shared-validator.cc @@ -209,8 +209,9 @@ Result SharedValidator::OnGlobalInitExpr_GlobalGet(const Location& loc, return result; } -Result SharedValidator::OnGlobalInitExpr_RefNull(const Location& loc) { - return CheckType(loc, Type::Nullref, globals_.back().type, +Result SharedValidator::OnGlobalInitExpr_RefNull(const Location& loc, + Type type) { + return CheckType(loc, type, globals_.back().type, "global initializer expression"); } @@ -335,8 +336,9 @@ Result SharedValidator::OnElemSegmentInitExpr_Other(const Location& loc) { "global.get."); } -Result SharedValidator::OnElemSegmentElemExpr_RefNull(const Location& loc) { - return Result::Ok; +Result SharedValidator::OnElemSegmentElemExpr_RefNull(const Location& loc, + Type type) { + return CheckType(loc, type, elems_.back().element, "elem expression"); } Result SharedValidator::OnElemSegmentElemExpr_RefFunc(const Location& loc, @@ -966,17 +968,17 @@ Result SharedValidator::OnRefFunc(const Location& loc, Var func_var) { return result; } -Result SharedValidator::OnRefIsNull(const Location& loc) { +Result SharedValidator::OnRefIsNull(const Location& loc, Type type) { Result result = Result::Ok; expr_loc_ = &loc; - result |= typechecker_.OnRefIsNullExpr(); + result |= typechecker_.OnRefIsNullExpr(type); return result; } -Result SharedValidator::OnRefNull(const Location& loc) { +Result SharedValidator::OnRefNull(const Location& loc, Type type) { Result result = Result::Ok; expr_loc_ = &loc; - result |= typechecker_.OnRefNullExpr(); + result |= typechecker_.OnRefNullExpr(type); return result; } diff --git a/src/shared-validator.h b/src/shared-validator.h index 71032e167..dadb09308 100644 --- a/src/shared-validator.h +++ b/src/shared-validator.h @@ -76,7 +76,7 @@ class SharedValidator { Result OnGlobal(const Location&, Type type, bool mutable_); Result OnGlobalInitExpr_Const(const Location&, Type); Result OnGlobalInitExpr_GlobalGet(const Location&, Var global_var); - Result OnGlobalInitExpr_RefNull(const Location&); + Result OnGlobalInitExpr_RefNull(const Location&, Type type); Result OnGlobalInitExpr_RefFunc(const Location&, Var func_var); Result OnGlobalInitExpr_Other(const Location&); Result OnEvent(const Location&, Var sig_var); @@ -93,7 +93,7 @@ class SharedValidator { Result OnElemSegmentInitExpr_Const(const Location&, Type); Result OnElemSegmentInitExpr_GlobalGet(const Location&, Var global_var); Result OnElemSegmentInitExpr_Other(const Location&); - Result OnElemSegmentElemExpr_RefNull(const Location&); + Result OnElemSegmentElemExpr_RefNull(const Location&, Type type); Result OnElemSegmentElemExpr_RefFunc(const Location&, Var func_var); Result OnElemSegmentElemExpr_Other(const Location&); @@ -150,8 +150,8 @@ class SharedValidator { Result OnMemorySize(const Location&); Result OnNop(const Location&); Result OnRefFunc(const Location&, Var func_var); - Result OnRefIsNull(const Location&); - Result OnRefNull(const Location&); + Result OnRefIsNull(const Location&, Type type); + Result OnRefNull(const Location&, Type type); Result OnRethrow(const Location&); Result OnReturnCall(const Location&, Var func_var); Result OnReturnCallIndirect(const Location&, Var sig_var, Var table_var); diff --git a/src/test-interp.cc b/src/test-interp.cc index b72d1bac8..1c1bcc412 100644 --- a/src/test-interp.cc +++ b/src/test-interp.cc @@ -572,7 +572,7 @@ TEST_F(InterpGCTest, Collect_Basic) { } TEST_F(InterpGCTest, Collect_GlobalCycle) { - auto gt = GlobalType{ValueType::Anyref, Mutability::Var}; + auto gt = GlobalType{ValueType::Externref, Mutability::Var}; auto g1 = Global::New(store_, gt, Value::Make(Ref::Null)); auto g2 = Global::New(store_, gt, Value::Make(g1->self())); g1->Set(store_, g2->self()); @@ -590,7 +590,7 @@ TEST_F(InterpGCTest, Collect_GlobalCycle) { } TEST_F(InterpGCTest, Collect_TableCycle) { - auto tt = TableType{ValueType::Anyref, Limits{2}}; + auto tt = TableType{ValueType::Externref, Limits{2}}; auto t1 = Table::New(store_, tt); auto t2 = Table::New(store_, tt); auto t3 = Table::New(store_, tt); diff --git a/src/token.cc b/src/token.cc index f5aef7860..657d37bed 100644 --- a/src/token.cc +++ b/src/token.cc @@ -79,6 +79,8 @@ std::string Token::to_string() const { return opcode_.GetName(); } else if (HasText()) { return text_.to_string(); + } else if (IsTokenTypeRefKind(token_type_)) { + return type_.GetRefKindName(); } else { assert(HasType()); return type_.GetName(); diff --git a/src/token.def b/src/token.def index 40c3ef81a..ce9308339 100644 --- a/src/token.def +++ b/src/token.def @@ -20,7 +20,6 @@ /* Tokens with no additional data (i.e. bare). */ WABT_TOKEN(Invalid, "Invalid") -WABT_TOKEN(Array, "array") WABT_TOKEN(AssertExhaustion, "assert_exhaustion") WABT_TOKEN(AssertInvalid, "assert_invalid") WABT_TOKEN(AssertMalformed, "assert_malformed") @@ -36,7 +35,6 @@ WABT_TOKEN(Eof, "EOF") WABT_TOKEN(Event, "event") WABT_TOKEN(Export, "export") WABT_TOKEN(Field, "field") -WABT_TOKEN(Func, "func") WABT_TOKEN(Get, "get") WABT_TOKEN(Global, "global") WABT_TOKEN(Import, "import") @@ -56,7 +54,6 @@ WABT_TOKEN(Result, "result") WABT_TOKEN(Rpar, ")") WABT_TOKEN(Shared, "shared") WABT_TOKEN(Start, "start") -WABT_TOKEN(Struct, "struct") WABT_TOKEN(Table, "table") WABT_TOKEN(Then, "then") WABT_TOKEN(Type, "type") @@ -115,10 +112,10 @@ WABT_TOKEN(MemoryGrow, "memory.grow") WABT_TOKEN(MemoryInit, "memory.init") WABT_TOKEN(MemorySize, "memory.size") WABT_TOKEN(Nop, "nop") +WABT_TOKEN(RefExtern, "ref.extern") WABT_TOKEN(RefFunc, "ref.func") WABT_TOKEN(RefIsNull, "ref.is_null") WABT_TOKEN(RefNull, "ref.null") -WABT_TOKEN(RefHost, "ref.host") WABT_TOKEN(Rethrow, "rethrow") WABT_TOKEN(ReturnCallIndirect, "return_call_indirect") WABT_TOKEN(ReturnCall, "return_call") @@ -157,3 +154,12 @@ WABT_TOKEN_LAST(String, Var) WABT_TOKEN(ValueType, "VALUETYPE") WABT_TOKEN_FIRST(Type, ValueType) WABT_TOKEN_LAST(Type, ValueType) + +/* Tokens with Type data, but are reference kinds. */ +WABT_TOKEN(Func, "func") +WABT_TOKEN(Extern, "extern") +WABT_TOKEN(Exn, "exn") +WABT_TOKEN(Struct, "struct") +WABT_TOKEN(Array, "array") +WABT_TOKEN_FIRST(RefKind, Func) +WABT_TOKEN_LAST(RefKind, Array) diff --git a/src/token.h b/src/token.h index 8a3b1f007..719e1aee5 100644 --- a/src/token.h +++ b/src/token.h @@ -41,7 +41,7 @@ enum class TokenType { #undef WABT_TOKEN_LAST First = First_Bare, - Last = Last_Type, + Last = Last_RefKind, }; const char* GetTokenTypeName(TokenType); @@ -70,6 +70,11 @@ inline bool IsTokenTypeLiteral(TokenType token_type) { token_type <= TokenType::Last_Literal; } +inline bool IsTokenTypeRefKind(TokenType token_type) { + return token_type >= TokenType::First_RefKind && + token_type <= TokenType::Last_RefKind; +} + struct Token { Token() : token_type_(TokenType::Invalid) {} Token(Location, TokenType); @@ -83,7 +88,9 @@ struct Token { TokenType token_type() const { return token_type_; } bool HasText() const { return IsTokenTypeString(token_type_); } - bool HasType() const { return IsTokenTypeType(token_type_); } + bool HasType() const { + return IsTokenTypeType(token_type_) || IsTokenTypeRefKind(token_type_); + } bool HasOpcode() const { return IsTokenTypeOpcode(token_type_); } bool HasLiteral() const { return IsTokenTypeLiteral(token_type_); } diff --git a/src/tools/spectest-interp.cc b/src/tools/spectest-interp.cc index cc61e8c32..60050e50d 100644 --- a/src/tools/spectest-interp.cc +++ b/src/tools/spectest-interp.cc @@ -588,14 +588,10 @@ wabt::Result JSONParser::ParseType(Type* out_type) { *out_type = Type::I16; } else if (type_str == "funcref") { *out_type = Type::Funcref; - } else if (type_str == "anyref") { - *out_type = Type::Anyref; - } else if (type_str == "nullref") { - *out_type = Type::Nullref; + } else if (type_str == "externref") { + *out_type = Type::Externref; } else if (type_str == "exnref") { *out_type = Type::Exnref; - } else if (type_str == "hostref") { - *out_type = Type::Hostref; } else { PrintError("unknown type: \"%s\"", type_str.c_str()); return wabt::Result::Error; @@ -807,12 +803,7 @@ wabt::Result JSONParser::ParseConstValue(Type type, assert(false); // Should use ParseLaneConstValue instead. break; - case Type::Nullref: { - out_value->Set(Ref::Null); - break; - } - - case Type::Hostref: { + case Type::Externref: { uint32_t value; CHECK_RESULT(ParseI32Value(&value, value_str)); // TODO: hack, just whatever ref is at this index; but skip null (which is @@ -1726,17 +1717,13 @@ wabt::Result CommandRunner::CheckAssertReturnResult( break; } - case Type::Nullref: - ok = actual.value.Get() == Ref::Null; - break; - case Type::Funcref: // A funcref expectation only requires that the reference be a function, // but it doesn't check the actual index. ok = store_.HasValueType(actual.value.Get(), Type::Funcref); break; - case Type::Hostref: + case Type::Externref: ok = expected.value.value.Get() == actual.value.Get(); break; diff --git a/src/type-checker.cc b/src/type-checker.cc index 4ffdee8c4..77474a120 100644 --- a/src/type-checker.cc +++ b/src/type-checker.cc @@ -165,31 +165,13 @@ Result TypeChecker::CheckTypeStackEnd(const char* desc) { return result; } -static bool IsSubtype(Type sub, Type super) { - if (super == sub) { - return true; - } - if (super.IsRef() != sub.IsRef()) { - return false; - } - if (super == Type::Anyref) { - return sub.IsRef(); - } - if (super.IsNullableRef()) { - return sub == Type::Nullref; - } - return false; -} - Result TypeChecker::CheckType(Type actual, Type expected) { if (expected == Type::Any || actual == Type::Any) { return Result::Ok; } - - if (!IsSubtype(actual, expected)) { + if (actual != expected) { return Result::Error; } - return Result::Ok; } @@ -693,13 +675,13 @@ Result TypeChecker::OnRefFuncExpr(Index) { return Result::Ok; } -Result TypeChecker::OnRefNullExpr() { - PushType(Type::Nullref); +Result TypeChecker::OnRefNullExpr(Type type) { + PushType(type); return Result::Ok; } -Result TypeChecker::OnRefIsNullExpr() { - Result result = PopAndCheck1Type(Type::Anyref, "ref.is_null"); +Result TypeChecker::OnRefIsNullExpr(Type type) { + Result result = PopAndCheck1Type(type, "ref.is_null"); PushType(Type::I32); return result; } diff --git a/src/type-checker.h b/src/type-checker.h index b59e55881..0b3560a96 100644 --- a/src/type-checker.h +++ b/src/type-checker.h @@ -109,8 +109,8 @@ class TypeChecker { Result OnTableSize(); Result OnTableFill(Type elem_type); Result OnRefFuncExpr(Index func_index); - Result OnRefNullExpr(); - Result OnRefIsNullExpr(); + Result OnRefNullExpr(Type type); + Result OnRefIsNullExpr(Type type); Result OnRethrow(); Result OnReturn(); Result OnSelect(Type expected); diff --git a/src/type.h b/src/type.h index fb51e0130..841a5da11 100644 --- a/src/type.h +++ b/src/type.h @@ -31,25 +31,23 @@ class Type { public: // Matches binary format, do not change. enum Enum { - I32 = -0x01, // 0x7f - I64 = -0x02, // 0x7e - F32 = -0x03, // 0x7d - F64 = -0x04, // 0x7c - V128 = -0x05, // 0x7b - I8 = -0x06, // 0x7a : packed-type only, used in gc and as v128 lane - I16 = -0x07, // 0x79 : packed-type only, used in gc and as v128 lane - Funcref = -0x10, // 0x70 - Anyref = -0x11, // 0x6f - Nullref = -0x12, // 0x6e - Exnref = -0x18, // 0x68 - Func = -0x20, // 0x60 - Struct = -0x21, // 0x5f - Array = -0x22, // 0x5e - Void = -0x40, // 0x40 - ___ = Void, // Convenient for the opcode table in opcode.h + I32 = -0x01, // 0x7f + I64 = -0x02, // 0x7e + F32 = -0x03, // 0x7d + F64 = -0x04, // 0x7c + V128 = -0x05, // 0x7b + I8 = -0x06, // 0x7a : packed-type only, used in gc and as v128 lane + 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 + Void = -0x40, // 0x40 + ___ = Void, // Convenient for the opcode table in opcode.h Any = 0, // Not actually specified, but useful for type-checking - Hostref = 2, // Not actually specified, but used in testing and type-checking I8U = 4, // Not actually specified, but used internally with load/store I16U = 6, // Not actually specified, but used internally with load/store I32U = 7, // Not actually specified, but used internally with load/store @@ -61,9 +59,8 @@ class Type { operator Enum() const { return enum_; } bool IsRef() const { - return enum_ == Type::Anyref || enum_ == Type::Funcref || - enum_ == Type::Nullref || enum_ == Type::Exnref || - enum_ == Type::Hostref; + return enum_ == Type::Externref || enum_ == Type::Funcref || + enum_ == Type::Exnref; } bool IsNullableRef() const { @@ -73,21 +70,31 @@ class Type { const char* GetName() const { switch (enum_) { - case Type::I32: return "i32"; - case Type::I64: return "i64"; - case Type::F32: return "f32"; - case Type::F64: return "f64"; - case Type::V128: return "v128"; - case Type::I8: return "i8"; - 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::Anyref: return "anyref"; - case Type::Nullref: return "nullref"; - default: return ""; + case Type::I32: return "i32"; + case Type::I64: return "i64"; + case Type::F32: return "f32"; + case Type::F64: return "f64"; + case Type::V128: return "v128"; + case Type::I8: return "i8"; + 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"; + default: return ""; + } + } + + const char* GetRefKindName() const { + 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 ""; } } @@ -122,8 +129,7 @@ class Type { case Type::F64: case Type::V128: case Type::Funcref: - case Type::Anyref: - case Type::Nullref: + case Type::Externref: case Type::Exnref: return TypeVector(this, this + 1); diff --git a/src/validator.cc b/src/validator.cc index b879d2eac..8884059e9 100644 --- a/src/validator.cc +++ b/src/validator.cc @@ -433,12 +433,12 @@ Result Validator::OnRefFuncExpr(RefFuncExpr* expr) { } Result Validator::OnRefNullExpr(RefNullExpr* expr) { - result_ |= validator_.OnRefNull(expr->loc); + result_ |= validator_.OnRefNull(expr->loc, expr->type); return Result::Ok; } Result Validator::OnRefIsNullExpr(RefIsNullExpr* expr) { - result_ |= validator_.OnRefIsNull(expr->loc); + result_ |= validator_.OnRefIsNull(expr->loc, expr->type); return Result::Ok; } @@ -715,7 +715,8 @@ Result Validator::CheckModule() { break; case ExprType::RefNull: - result_ |= validator_.OnGlobalInitExpr_RefNull(expr->loc); + result_ |= validator_.OnGlobalInitExpr_RefNull( + expr->loc, cast(expr)->type); break; default: @@ -789,7 +790,8 @@ Result Validator::CheckModule() { switch (elem_expr.kind) { case ElemExprKind::RefNull: // TODO: better location? - result_ |= validator_.OnElemSegmentElemExpr_RefNull(field.loc); + result_ |= validator_.OnElemSegmentElemExpr_RefNull(field.loc, + elem_expr.type); break; case ElemExprKind::RefFunc: diff --git a/src/wast-lexer.cc b/src/wast-lexer.cc index 59bc0d717..05ac736a5 100644 --- a/src/wast-lexer.cc +++ b/src/wast-lexer.cc @@ -540,7 +540,8 @@ Token WastLexer::GetKeywordToken() { } if (IsTokenTypeBare(info->token_type)) { return BareToken(info->token_type); - } else if (IsTokenTypeType(info->token_type)) { + } else if (IsTokenTypeType(info->token_type) || + IsTokenTypeRefKind(info->token_type)) { return Token(GetLocation(), info->token_type, info->value_type); } else { assert(IsTokenTypeOpcode(info->token_type)); diff --git a/src/wast-parser.cc b/src/wast-parser.cc index e443f3b27..4f5a8ffbf 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -731,7 +731,9 @@ bool WastParser::ParseElemExprOpt(ElemExpr* out_elem_expr) { options_->features.reference_types_enabled())) { Error(loc, "ref.null not allowed"); } - *out_elem_expr = ElemExpr(); + Type type; + CHECK_RESULT(ParseRefKind(&type)); + *out_elem_expr = ElemExpr(type); } else if (Match(TokenType::RefFunc)) { Var var; CHECK_RESULT(ParseVar(&var)); @@ -768,7 +770,7 @@ bool WastParser::ParseElemExprVarListOpt(ElemExprVector* out_list) { Result WastParser::ParseValueType(Type* out_type) { WABT_TRACE(ParseValueType); if (!PeekMatch(TokenType::ValueType)) { - return ErrorExpected({"i32", "i64", "f32", "f64", "v128", "anyref"}); + return ErrorExpected({"i32", "i64", "f32", "f64", "v128", "externref"}); } Token token = Consume(); @@ -778,9 +780,8 @@ Result WastParser::ParseValueType(Type* out_type) { case Type::V128: is_enabled = options_->features.simd_enabled(); break; - case Type::Anyref: case Type::Funcref: - case Type::Hostref: + case Type::Externref: is_enabled = options_->features.reference_types_enabled(); break; case Type::Exnref: @@ -808,15 +809,37 @@ Result WastParser::ParseValueTypeList(TypeVector* out_type_list) { return Result::Ok; } +Result WastParser::ParseRefKind(Type* out_type) { + WABT_TRACE(ParseRefKind); + if (!IsTokenTypeRefKind(Peek())) { + return ErrorExpected({"func", "extern", "exn"}); + } + + Token token = Consume(); + Type type = token.type(); + + if ((type == Type::Externref && + !options_->features.reference_types_enabled()) || + ((type == Type::Struct || type == Type::Array) && + !options_->features.gc_enabled())) { + Error(token.loc, "value type not allowed: %s", type.GetName()); + return Result::Error; + } + + *out_type = type; + return Result::Ok; +} + Result WastParser::ParseRefType(Type* out_type) { WABT_TRACE(ParseRefType); if (!PeekMatch(TokenType::ValueType)) { - return ErrorExpected({"funcref", "anyref", "nullref", "exnref"}); + return ErrorExpected({"funcref", "externref", "exnref"}); } Token token = Consume(); Type type = token.type(); - if (type == Type::Anyref && !options_->features.reference_types_enabled()) { + if (type == Type::Externref && + !options_->features.reference_types_enabled()) { Error(token.loc, "value type not allowed: %s", type.GetName()); return Result::Error; } @@ -833,7 +856,8 @@ bool WastParser::ParseRefTypeOpt(Type* out_type) { Token token = Consume(); Type type = token.type(); - if (type == Type::Anyref && !options_->features.reference_types_enabled()) { + if (type == Type::Externref && + !options_->features.reference_types_enabled()) { return false; } @@ -1948,15 +1972,21 @@ Result WastParser::ParsePlainInstr(std::unique_ptr* out_expr) { CHECK_RESULT(ParsePlainInstrVar(loc, out_expr)); break; - case TokenType::RefNull: + case TokenType::RefNull: { ErrorUnlessOpcodeEnabled(Consume()); - out_expr->reset(new RefNullExpr(loc)); + Type type; + CHECK_RESULT(ParseRefKind(&type)); + out_expr->reset(new RefNullExpr(type, loc)); break; + } - case TokenType::RefIsNull: + case TokenType::RefIsNull: { ErrorUnlessOpcodeEnabled(Consume()); - out_expr->reset(new RefIsNullExpr(loc)); + Type type; + CHECK_RESULT(ParseRefKind(&type)); + out_expr->reset(new RefIsNullExpr(type, loc)); break; + } case TokenType::Throw: ErrorUnlessOpcodeEnabled(Consume()); @@ -2359,11 +2389,11 @@ Result WastParser::ParseConst(Const* const_, ConstType const_type) { return Result::Ok; } -Result WastParser::ParseHostRef(Const* const_) { - WABT_TRACE(ParseHostRef); +Result WastParser::ParseExternref(Const* const_) { + WABT_TRACE(ParseExternref); Token token = Consume(); if (!options_->features.reference_types_enabled()) { - Error(token.loc, "hostref not allowed"); + Error(token.loc, "externref not allowed"); return Result::Error; } @@ -2390,7 +2420,7 @@ Result WastParser::ParseHostRef(Const* const_) { uint64_t ref_bits; Result result = ParseInt64(s, end, &ref_bits, ParseIntType::UnsignedOnly); - const_->set_hostref(static_cast(ref_bits)); + const_->set_externref(static_cast(ref_bits)); if (Failed(result)) { Error(const_->loc, "invalid literal \"" PRIstringview "\"", @@ -2405,7 +2435,7 @@ Result WastParser::ParseHostRef(Const* const_) { Result WastParser::ParseConstList(ConstVector* consts, ConstType type) { WABT_TRACE(ParseConstList); while (PeekMatchLpar(TokenType::Const) || PeekMatchLpar(TokenType::RefNull) || - PeekMatchLpar(TokenType::RefHost) || + PeekMatchLpar(TokenType::RefExtern) || PeekMatchLpar(TokenType::RefFunc)) { Consume(); Const const_; @@ -2415,9 +2445,11 @@ Result WastParser::ParseConstList(ConstVector* consts, ConstType type) { break; case TokenType::RefNull: { auto token = Consume(); + Type type; + CHECK_RESULT(ParseRefType(&type)); ErrorUnlessOpcodeEnabled(token); const_.loc = GetLocation(); - const_.set_nullref(); + const_.set_null(type); break; } case TokenType::RefFunc: { @@ -2427,8 +2459,8 @@ Result WastParser::ParseConstList(ConstVector* consts, ConstType type) { const_.set_funcref(); break; } - case TokenType::RefHost: - CHECK_RESULT(ParseHostRef(&const_)); + case TokenType::RefExtern: + CHECK_RESULT(ParseExternref(&const_)); break; default: assert(!"unreachable"); diff --git a/src/wast-parser.h b/src/wast-parser.h index 7dd4d038f..adac244de 100644 --- a/src/wast-parser.h +++ b/src/wast-parser.h @@ -131,6 +131,7 @@ class WastParser { bool ParseElemExprVarListOpt(ElemExprVector* out_list); Result ParseValueType(Type* out_type); Result ParseValueTypeList(TypeVector* out_type_list); + Result ParseRefKind(Type* out_type); Result ParseRefType(Type* out_type); bool ParseRefTypeOpt(Type* out_type); Result ParseQuotedText(std::string* text); @@ -172,7 +173,7 @@ class WastParser { Result ParseF32(Const*, ConstType type); Result ParseF64(Const*, ConstType type); Result ParseConst(Const*, ConstType type); - Result ParseHostRef(Const*); + Result ParseExternref(Const*); Result ParseExpectedNan(ExpectedNan* expected); Result ParseConstList(ConstVector*, ConstType type); Result ParseBlockInstr(std::unique_ptr*); diff --git a/src/wat-writer.cc b/src/wat-writer.cc index bdaa943b9..b2c78b7d3 100644 --- a/src/wat-writer.cc +++ b/src/wat-writer.cc @@ -122,6 +122,7 @@ class WatWriter : ModuleContext { void WriteQuotedString(string_view str, NextChar next_char); void WriteVar(const Var& var, NextChar next_char); void WriteBrVar(const Var& var, NextChar next_char); + void WriteRefKind(Type type, NextChar next_char); void WriteType(Type type, NextChar next_char); void WriteTypes(const TypeVector& types, const char* name); void WriteFuncSigSpace(const FuncSignature& func_sig); @@ -377,6 +378,10 @@ void WatWriter::WriteBrVar(const Var& var, NextChar next_char) { } } +void WatWriter::WriteRefKind(Type type, NextChar next_char) { + WritePuts(type.GetRefKindName(), next_char); +} + void WatWriter::WriteType(Type type, NextChar next_char) { const char* type_name = type.GetName(); assert(type_name); @@ -797,12 +802,14 @@ Result WatWriter::ExprVisitorDelegate::OnRefFuncExpr(RefFuncExpr* expr) { } Result WatWriter::ExprVisitorDelegate::OnRefNullExpr(RefNullExpr* expr) { - writer_->WritePutsNewline(Opcode::RefNull_Opcode.GetName()); + writer_->WritePutsSpace(Opcode::RefNull_Opcode.GetName()); + writer_->WriteRefKind(expr->type, NextChar::Newline); return Result::Ok; } Result WatWriter::ExprVisitorDelegate::OnRefIsNullExpr(RefIsNullExpr* expr) { - writer_->WritePutsNewline(Opcode::RefIsNull_Opcode.GetName()); + writer_->WritePutsSpace(Opcode::RefIsNull_Opcode.GetName()); + writer_->WriteRefKind(expr->type, NextChar::Newline); return Result::Ok; } @@ -1284,6 +1291,7 @@ void WatWriter::WriteElemSegment(const ElemSegment& segment) { if (flags & SegUseElemExprs) { if (expr.kind == ElemExprKind::RefNull) { WriteOpenSpace("ref.null"); + WriteRefKind(expr.type, NextChar::Space); WriteCloseSpace(); } else { WriteOpenSpace("ref.func"); diff --git a/test/decompile/basic.txt b/test/decompile/basic.txt index 31be88b90..ae69af259 100644 --- a/test/decompile/basic.txt +++ b/test/decompile/basic.txt @@ -95,8 +95,8 @@ end set_local 0 nop - ref.null - ref.is_null + ref.null func + ref.is_null func drop i32.const 0 ;; fi call_indirect diff --git a/test/dump/reference-types.txt b/test/dump/reference-types.txt index a1279635a..9650b0d96 100644 --- a/test/dump/reference-types.txt +++ b/test/dump/reference-types.txt @@ -3,46 +3,46 @@ ;;; ARGS1: -x (module - (table $foo 1 anyref) - (table $bar 1 anyref) - (table $baz 1 anyfunc) + (table $foo 1 externref) + (table $bar 1 externref) + (table $baz 1 funcref) (elem (table $baz) (i32.const 0) $f1) - (elem funcref (ref.null)) + (elem funcref (ref.null func)) - (func $f1 (result anyref) + (func $f1 (result externref) i32.const 0 table.get $foo ) - (func (result anyref) + (func (result externref) i32.const 0 table.get $bar ) - (func (param anyref) + (func (param externref) i32.const 0 get_local 0 table.set $foo ) - (func (param anyref) + (func (param externref) i32.const 0 get_local 0 table.set $bar ) (func (result i32) - ref.null + ref.null extern i32.const 0 table.grow $foo ) (func (result i32) - ref.null + ref.null extern i32.const 0 table.grow $bar ) - (func (param anyref) (result i32) + (func (param externref) (result i32) local.get 0 - ref.is_null + ref.is_null extern ) @@ -56,7 +56,6 @@ table.size $baz ) ) - (;; STDOUT ;;; reference-types.wasm: file format wasm 0x1 @@ -64,10 +63,10 @@ reference-types.wasm: file format wasm 0x1 Section Details: Type[4]: - - type[0] () -> anyref - - type[1] (anyref) -> nil + - type[0] () -> externref + - type[1] (externref) -> nil - type[2] () -> i32 - - type[3] (anyref) -> i32 + - type[3] (externref) -> i32 Function[10]: - func[0] sig=0 - func[1] sig=0 @@ -80,67 +79,67 @@ Function[10]: - func[8] sig=2 - func[9] sig=2 Table[3]: - - table[0] type=anyref initial=1 - - table[1] type=anyref initial=1 + - table[0] type=externref initial=1 + - table[1] type=externref initial=1 - table[2] type=funcref initial=1 Elem[2]: - segment[0] flags=2 table=2 count=1 - init i32=0 - elem[0] = func[0] - segment[1] flags=5 table=0 count=1 - - elem[0] = nullref + - elem[0] = ref.null funcref Code[10]: - func[0] size=6 - func[1] size=6 - func[2] size=8 - func[3] size=8 - - func[4] size=8 - - func[5] size=8 - - func[6] size=5 + - func[4] size=9 + - func[5] size=9 + - func[6] size=6 - func[7] size=5 - func[8] size=5 - func[9] size=5 Code Disassembly: -000049 func[0]: - 00004a: 41 00 | i32.const 0 - 00004c: 25 00 | table.get 0 - 00004e: 0b | end -000050 func[1]: - 000051: 41 00 | i32.const 0 - 000053: 25 01 | table.get 1 - 000055: 0b | end -000057 func[2]: - 000058: 41 00 | i32.const 0 - 00005a: 20 00 | local.get 0 - 00005c: 26 00 | table.set 0 - 00005e: 0b | end -000060 func[3]: - 000061: 41 00 | i32.const 0 - 000063: 20 00 | local.get 0 - 000065: 26 01 | table.set 1 - 000067: 0b | end -000069 func[4]: - 00006a: d0 | ref.null - 00006b: 41 00 | i32.const 0 - 00006d: fc 0f 00 | table.grow 0 - 000070: 0b | end -000072 func[5]: - 000073: d0 | ref.null - 000074: 41 00 | i32.const 0 - 000076: fc 0f 01 | table.grow 1 - 000079: 0b | end -00007b func[6]: - 00007c: 20 00 | local.get 0 - 00007e: d1 | ref.is_null - 00007f: 0b | end -000081 func[7]: - 000082: fc 10 00 | table.size 0 - 000085: 0b | end -000087 func[8]: - 000088: fc 10 01 | table.size 1 - 00008b: 0b | end -00008d func[9]: - 00008e: fc 10 02 | table.size 2 - 000091: 0b | end +00004a func[0]: + 00004b: 41 00 | i32.const 0 + 00004d: 25 00 | table.get 0 + 00004f: 0b | end +000051 func[1]: + 000052: 41 00 | i32.const 0 + 000054: 25 01 | table.get 1 + 000056: 0b | end +000058 func[2]: + 000059: 41 00 | i32.const 0 + 00005b: 20 00 | local.get 0 + 00005d: 26 00 | table.set 0 + 00005f: 0b | end +000061 func[3]: + 000062: 41 00 | i32.const 0 + 000064: 20 00 | local.get 0 + 000066: 26 01 | table.set 1 + 000068: 0b | end +00006a func[4]: + 00006b: d0 6f | ref.null extern + 00006d: 41 00 | i32.const 0 + 00006f: fc 0f 00 | table.grow 0 + 000072: 0b | end +000074 func[5]: + 000075: d0 6f | ref.null extern + 000077: 41 00 | i32.const 0 + 000079: fc 0f 01 | table.grow 1 + 00007c: 0b | end +00007e func[6]: + 00007f: 20 00 | local.get 0 + 000081: d1 6f | ref.is_null extern + 000083: 0b | end +000085 func[7]: + 000086: fc 10 00 | table.size 0 + 000089: 0b | end +00008b func[8]: + 00008c: fc 10 01 | table.size 1 + 00008f: 0b | end +000091 func[9]: + 000092: fc 10 02 | table.size 2 + 000095: 0b | end ;;; STDOUT ;;) diff --git a/test/gen-spec-wast.py b/test/gen-spec-wast.py index 648870b57..728d22141 100755 --- a/test/gen-spec-wast.py +++ b/test/gen-spec-wast.py @@ -198,10 +198,8 @@ def _Constant(self, const): return F32ToWasm(int(value)) elif type_ == 'f64': return F64ToWasm(int(value)) - elif type_ == 'nullref': - return type_ - elif type_ == 'hostref': - return 'ref.host %s' % value + elif type_ == 'externref': + return 'ref.extern %s' % value elif type_ == 'funcref': return 'ref.func %s' % value else: diff --git a/test/help/spectest-interp.txt b/test/help/spectest-interp.txt index 1e453d884..2d6e81650 100644 --- a/test/help/spectest-interp.txt +++ b/test/help/spectest-interp.txt @@ -22,7 +22,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/help/wasm-interp.txt b/test/help/wasm-interp.txt index 733a0c501..503980edb 100644 --- a/test/help/wasm-interp.txt +++ b/test/help/wasm-interp.txt @@ -33,7 +33,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/help/wasm-opcodecnt.txt b/test/help/wasm-opcodecnt.txt index d3affc1c0..619d017b7 100644 --- a/test/help/wasm-opcodecnt.txt +++ b/test/help/wasm-opcodecnt.txt @@ -23,7 +23,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/help/wasm-validate.txt b/test/help/wasm-validate.txt index 8e16befd6..be4c68f3e 100644 --- a/test/help/wasm-validate.txt +++ b/test/help/wasm-validate.txt @@ -22,7 +22,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/help/wasm2wat.txt b/test/help/wasm2wat.txt index 5f739807a..91f7619d4 100644 --- a/test/help/wasm2wat.txt +++ b/test/help/wasm2wat.txt @@ -28,7 +28,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/help/wast2json.txt b/test/help/wast2json.txt index 18f265d52..99a0f4390 100644 --- a/test/help/wast2json.txt +++ b/test/help/wast2json.txt @@ -25,7 +25,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/help/wat-desugar.txt b/test/help/wat-desugar.txt index 15df0e0f5..ba22b643b 100644 --- a/test/help/wat-desugar.txt +++ b/test/help/wat-desugar.txt @@ -32,7 +32,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/help/wat2wasm.txt b/test/help/wat2wasm.txt index d2c1e2b01..cdc35c83c 100644 --- a/test/help/wat2wasm.txt +++ b/test/help/wat2wasm.txt @@ -32,7 +32,7 @@ options: --enable-multi-value Enable Multi-value --enable-tail-call Enable Tail-call support --enable-bulk-memory Enable Bulk-memory operations - --enable-reference-types Enable Reference types (anyref) + --enable-reference-types Enable Reference types (externref) --enable-annotations Enable Custom annotation syntax --enable-gc Enable Garbage collection --enable-all Enable all features diff --git a/test/interp/reference-types.txt b/test/interp/reference-types.txt index 77e3d6910..9b9c45de6 100644 --- a/test/interp/reference-types.txt +++ b/test/interp/reference-types.txt @@ -2,23 +2,27 @@ ;;; ARGS*: --enable-reference-types (module - (table $t_func 1 anyfunc) - (table $t_any 1 anyref) - (elem $t_func funcref (ref.func 1) (ref.null)) - (elem $t_any anyref (ref.func 1) (ref.null)) - (global $g (mut anyref) (ref.null)) - - (func $ref_null (export "ref_null") (result nullref) - ref.null + (table $t_func 1 funcref) + (table $t_extern 1 externref) + (elem funcref (ref.func 2) (ref.null func)) + (elem externref (ref.null extern)) + (global $g (mut funcref) (ref.null func)) + + (func (export "ref_null_func") (result funcref) + ref.null func + ) + + (func (export "ref_null_extern") (result externref) + ref.null extern ) - (func $ref_is_null (export "ref_is_null") (result i32) + (func $ref_is_null_func (export "ref_is_null_func") (result i32) global.get $g - ref.is_null + ref.is_null func ) - (func $ref_func (export "ref_func") (result anyfunc) - ref.func $ref_is_null + (func $ref_func (export "ref_func") (result funcref) + ref.func $ref_is_null_func ) (func $table_set (export "table_set") @@ -31,20 +35,21 @@ call $table_set i32.const 0 table.get $t_func - ref.is_null + ref.is_null func ) - (func $global_set (export "global_set") (result anyref) - ref.func $ref_is_null + (func $global_set (export "global_set") (result funcref) + ref.func $ref_is_null_func global.set $g global.get $g ) ) (;; STDOUT ;;; -ref_null() => nullref -ref_is_null() => i32:1 -ref_func() => funcref:4 +ref_null_func() => funcref:0 +ref_null_extern() => externref:0 +ref_is_null_func() => i32:1 +ref_func() => funcref:5 table_set() => table_get() => i32:0 -global_set() => anyref:4 +global_set() => funcref:5 ;;; STDOUT ;;) diff --git a/test/parse/all-features.txt b/test/parse/all-features.txt index 8806d1915..f434a9ac8 100644 --- a/test/parse/all-features.txt +++ b/test/parse/all-features.txt @@ -56,7 +56,7 @@ memory.copy ;; reference types - ref.null + ref.null func drop ;; exceptions diff --git a/test/parse/expr/bulk-memory-disabled.txt b/test/parse/expr/bulk-memory-disabled.txt index c46f021ae..def935d68 100644 --- a/test/parse/expr/bulk-memory-disabled.txt +++ b/test/parse/expr/bulk-memory-disabled.txt @@ -13,7 +13,7 @@ (table 1 anyfunc) (elem $elem funcref 0) - (elem funcref (ref.null)) + (elem funcref (ref.null func)) (func i32.const 0 i32.const 0 i32.const 0 table.init 0 elem.drop 0 @@ -40,7 +40,7 @@ out/test/parse/expr/bulk-memory-disabled.txt:15:23: error: unexpected token 0, e (elem $elem funcref 0) ^ out/test/parse/expr/bulk-memory-disabled.txt:16:17: error: ref.null not allowed - (elem funcref (ref.null)) + (elem funcref (ref.null func)) ^ out/test/parse/expr/bulk-memory-disabled.txt:18:41: error: opcode not allowed: table.init i32.const 0 i32.const 0 i32.const 0 table.init 0 diff --git a/test/parse/expr/bulk-memory-named.txt b/test/parse/expr/bulk-memory-named.txt index a4418baf4..b63b5b0cc 100644 --- a/test/parse/expr/bulk-memory-named.txt +++ b/test/parse/expr/bulk-memory-named.txt @@ -10,7 +10,7 @@ ) (table 1 anyfunc) - (elem $elem funcref (ref.func 0) (ref.null)) + (elem $elem funcref (ref.func 0) (ref.null func)) (elem $elem2 func 0) (func i32.const 0 i32.const 0 i32.const 0 table.init $elem diff --git a/test/parse/expr/reference-types-named.txt b/test/parse/expr/reference-types-named.txt index 065b870d5..5a2d5d1bd 100644 --- a/test/parse/expr/reference-types-named.txt +++ b/test/parse/expr/reference-types-named.txt @@ -2,18 +2,18 @@ ;;; ARGS: --enable-reference-types (module - (table $foo 1 anyref) - (func (result anyref) + (table $foo 1 externref) + (func (result externref) i32.const 0 table.get $foo ) - (func (param anyref) + (func (param externref) i32.const 0 get_local 0 table.set $foo ) (func (result i32) - ref.null + ref.null extern i32.const 0 table.grow $foo ) diff --git a/test/parse/expr/reference-types.txt b/test/parse/expr/reference-types.txt index e5e87ecdb..2cb156f57 100644 --- a/test/parse/expr/reference-types.txt +++ b/test/parse/expr/reference-types.txt @@ -2,63 +2,50 @@ ;;; ARGS: --enable-reference-types (module - (table $foo 1 anyref) - (table $bar 1 anyref) - (table $baz 1 anyfunc) - (table $qux 1 nullref) + (table $foo 1 externref) + (table $bar 1 externref) + (table $baz 1 funcref) (elem declare func 0) - (func (result anyref) + (func (result externref) i32.const 0 table.get $foo ) - (func (result anyref) + (func (result externref) i32.const 0 table.get $bar ) - (func (result nullref) - i32.const 0 - table.get $qux - ) - (func (param anyref) + (func (param externref) i32.const 0 get_local 0 table.set $foo ) - (func (param anyref) + (func (param externref) i32.const 0 get_local 0 table.set $bar ) - (func (param nullref) - i32.const 0 - get_local 0 - table.set $qux - ) (func (result i32) - ref.null + ref.null extern i32.const 0 table.grow $foo ) (func (result i32) - ref.null + ref.null extern i32.const 0 table.grow $bar ) - (func (param anyref) (result i32) + (func (param externref) (result i32) local.get 0 - ref.is_null + ref.is_null extern ) - (func (result anyref) + (func (result funcref) ref.func 0 ) - (func (result nullref) - ref.null - ) (func (result i32) table.size $foo diff --git a/test/parse/expr/table-get.txt b/test/parse/expr/table-get.txt index ed2e71555..a1d3074a2 100644 --- a/test/parse/expr/table-get.txt +++ b/test/parse/expr/table-get.txt @@ -1,8 +1,8 @@ ;;; TOOL: wat2wasm ;;; ARGS: --enable-reference-types (module - (func (result anyref) + (func (result externref) i32.const 0 table.get 0) - (table 1 anyref)) + (table 1 externref)) diff --git a/test/parse/expr/table-grow.txt b/test/parse/expr/table-grow.txt index 1f3d5b368..f40e9092e 100644 --- a/test/parse/expr/table-grow.txt +++ b/test/parse/expr/table-grow.txt @@ -2,8 +2,8 @@ ;;; ARGS: --enable-reference-types (module (func (result i32) - ref.null + ref.null extern i32.const 0 table.grow 0) - (table 1 anyref)) + (table 1 externref)) diff --git a/test/parse/expr/table-set.txt b/test/parse/expr/table-set.txt index d441437ec..16f8b917d 100644 --- a/test/parse/expr/table-set.txt +++ b/test/parse/expr/table-set.txt @@ -1,9 +1,9 @@ ;;; TOOL: wat2wasm ;;; ARGS: --enable-reference-types (module - (func (param anyref) + (func (param externref) i32.const 0 get_local 0 table.set 0) - (table 1 anyref)) + (table 1 externref)) diff --git a/test/parse/func/bad-local-binding-no-type.txt b/test/parse/func/bad-local-binding-no-type.txt index 029218e9a..371205f34 100644 --- a/test/parse/func/bad-local-binding-no-type.txt +++ b/test/parse/func/bad-local-binding-no-type.txt @@ -2,7 +2,7 @@ ;;; ERROR: 1 (module (func (local $n))) (;; STDERR ;;; -out/test/parse/func/bad-local-binding-no-type.txt:3:24: error: unexpected token ")", expected i32, i64, f32, f64, v128 or anyref. +out/test/parse/func/bad-local-binding-no-type.txt:3:24: error: unexpected token ")", expected i32, i64, f32, f64, v128 or externref. (module (func (local $n))) ^ ;;; STDERR ;;) diff --git a/test/parse/func/bad-local-binding.txt b/test/parse/func/bad-local-binding.txt index 51110dfeb..2a70cd84d 100644 --- a/test/parse/func/bad-local-binding.txt +++ b/test/parse/func/bad-local-binding.txt @@ -2,7 +2,7 @@ ;;; ERROR: 1 (module (func (local $foo $bar))) (;; STDERR ;;; -out/test/parse/func/bad-local-binding.txt:3:27: error: unexpected token "$bar", expected i32, i64, f32, f64, v128 or anyref. +out/test/parse/func/bad-local-binding.txt:3:27: error: unexpected token "$bar", expected i32, i64, f32, f64, v128 or externref. (module (func (local $foo $bar))) ^^^^ ;;; STDERR ;;) diff --git a/test/parse/func/bad-param-binding.txt b/test/parse/func/bad-param-binding.txt index f813b23cf..9f91b1bba 100644 --- a/test/parse/func/bad-param-binding.txt +++ b/test/parse/func/bad-param-binding.txt @@ -2,7 +2,7 @@ ;;; ERROR: 1 (module (func (param $bar $baz))) (;; STDERR ;;; -out/test/parse/func/bad-param-binding.txt:3:27: error: unexpected token "$baz", expected i32, i64, f32, f64, v128 or anyref. +out/test/parse/func/bad-param-binding.txt:3:27: error: unexpected token "$baz", expected i32, i64, f32, f64, v128 or externref. (module (func (param $bar $baz))) ^^^^ ;;; STDERR ;;) diff --git a/test/parse/func/result-exnref.txt b/test/parse/func/result-exnref.txt index c104ee0b0..92435f806 100644 --- a/test/parse/func/result-exnref.txt +++ b/test/parse/func/result-exnref.txt @@ -1,3 +1,3 @@ ;;; TOOL: wat2wasm ;;; ARGS: --enable-exceptions -(module (func (result exnref) ref.null)) +(module (func (result exnref) ref.null exn)) diff --git a/test/parse/module/bad-array-no-fields.txt b/test/parse/module/bad-array-no-fields.txt index d01e4d319..c1bbe2681 100644 --- a/test/parse/module/bad-array-no-fields.txt +++ b/test/parse/module/bad-array-no-fields.txt @@ -3,7 +3,7 @@ ;;; ERROR: 1 (type (array)) (;; STDERR ;;; -out/test/parse/module/bad-array-no-fields.txt:4:13: error: unexpected token ")", expected i32, i64, f32, f64, v128 or anyref. +out/test/parse/module/bad-array-no-fields.txt:4:13: error: unexpected token ")", expected i32, i64, f32, f64, v128 or externref. (type (array)) ^ ;;; STDERR ;;) diff --git a/test/parse/module/global-exnref.txt b/test/parse/module/global-exnref.txt index 4e5d39319..56f5e57b2 100644 --- a/test/parse/module/global-exnref.txt +++ b/test/parse/module/global-exnref.txt @@ -1,3 +1,3 @@ ;;; TOOL: wat2wasm ;;; ARGS: --enable-exceptions -(module (global exnref (ref.null))) +(module (global exnref (ref.null exn))) diff --git a/test/parse/module/global.txt b/test/parse/module/global.txt index 0763ee47e..2578131cb 100644 --- a/test/parse/module/global.txt +++ b/test/parse/module/global.txt @@ -19,6 +19,5 @@ (global f64 (get_global 3)) (func $foo) - (global anyref (ref.null)) - (global funcref (ref.func $foo)) - (global nullref (ref.null))) + (global externref (ref.null extern)) + (global funcref (ref.func $foo))) diff --git a/test/parse/module/reference-types-disabled.txt b/test/parse/module/reference-types-disabled.txt index 8d241c8b9..e4ba27361 100644 --- a/test/parse/module/reference-types-disabled.txt +++ b/test/parse/module/reference-types-disabled.txt @@ -2,7 +2,7 @@ ;;; ERROR: 1 (module - (table $t 1 anyref) + (table $t 1 externref) (func i32.const 0 i32.const 0 @@ -11,9 +11,9 @@ ) ) (;; STDERR ;;; -out/test/parse/module/reference-types-disabled.txt:5:15: error: value type not allowed: anyref - (table $t 1 anyref) - ^^^^^^ +out/test/parse/module/reference-types-disabled.txt:5:15: error: value type not allowed: externref + (table $t 1 externref) + ^^^^^^^^^ out/test/parse/module/reference-types-disabled.txt:9:5: error: opcode not allowed: table.get table.get $t ^^^^^^^^^ diff --git a/test/roundtrip/bulk-memory.txt b/test/roundtrip/bulk-memory.txt index 3c932961e..a84135ea6 100644 --- a/test/roundtrip/bulk-memory.txt +++ b/test/roundtrip/bulk-memory.txt @@ -39,7 +39,7 @@ (func) (data "hi") - (elem funcref (ref.func 0) (ref.null)) + (elem funcref (ref.func 0) (ref.null func)) (elem func 1) ) @@ -72,7 +72,7 @@ (func (;1;) (type 0)) (table (;0;) 0 funcref) (memory (;0;) 0) - (elem (;0;) funcref (ref.func 0) (ref.null)) + (elem (;0;) funcref (ref.func 0) (ref.null func)) (elem (;1;) func 1) (data (;0;) "hi")) ;;; STDOUT ;;) diff --git a/test/roundtrip/fold-reference-types.txt b/test/roundtrip/fold-reference-types.txt index 23412a5f3..54a6c1504 100644 --- a/test/roundtrip/fold-reference-types.txt +++ b/test/roundtrip/fold-reference-types.txt @@ -2,7 +2,7 @@ ;;; ARGS: --stdout --fold-exprs --enable-reference-types (module - (table $t 1 anyref) + (table $t 1 externref) (func i32.const 0 i32.const 0 @@ -18,5 +18,5 @@ (i32.const 0) (table.get 0 (i32.const 0)))) - (table (;0;) 1 anyref)) + (table (;0;) 1 externref)) ;;; STDOUT ;;) diff --git a/test/typecheck/if-anyref.txt b/test/typecheck/if-anyref.txt index a6b17f6e6..049d79922 100644 --- a/test/typecheck/if-anyref.txt +++ b/test/typecheck/if-anyref.txt @@ -1,9 +1,9 @@ ;;; TOOL: wat2wasm ;;; ARGS: --enable-reference-types (module - (func (param anyref) (result anyref) + (func (param externref) (result externref) i32.const 0 - if (result anyref) + if (result externref) local.get 0 else local.get 0