diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/binary-writer-spec.cc | 46 | ||||
-rw-r--r-- | src/common.h | 6 | ||||
-rw-r--r-- | src/interp/binary-reader-interp.cc | 16 | ||||
-rw-r--r-- | src/interp/interp.cc | 99 | ||||
-rw-r--r-- | src/interp/interp.h | 10 | ||||
-rw-r--r-- | src/ir.h | 9 | ||||
-rw-r--r-- | src/lexer-keywords.txt | 4 | ||||
-rw-r--r-- | src/prebuilt/lexer-keywords.cc | 859 | ||||
-rw-r--r-- | src/resolve-names.cc | 2 | ||||
-rw-r--r-- | src/token.def | 4 | ||||
-rw-r--r-- | src/tools/spectest-interp.cc | 187 | ||||
-rw-r--r-- | src/validator.cc | 48 | ||||
-rw-r--r-- | src/wast-parser.cc | 64 | ||||
-rw-r--r-- | src/wast-parser.h | 12 |
14 files changed, 653 insertions, 713 deletions
diff --git a/src/binary-writer-spec.cc b/src/binary-writer-spec.cc index 2c169426..d547f7d6 100644 --- a/src/binary-writer-spec.cc +++ b/src/binary-writer-spec.cc @@ -131,8 +131,6 @@ void BinaryWriterSpec::WriteCommandType(const Command& command) { "assert_uninstantiable", "assert_return", "assert_return_func", - "assert_return_canonical_nan", - "assert_return_arithmetic_nan", "assert_trap", "assert_exhaustion", }; @@ -189,7 +187,15 @@ void BinaryWriterSpec::WriteConst(const Const& const_) { WriteString("f32"); WriteSeparator(); WriteKey("value"); - json_stream_->Writef("\"%u\"", const_.f32_bits); + if (const_.is_expected_nan) { + if (const_.expected == ExpectedNan::Arithmetic) { + WriteString("nan:arithmetic"); + } else { + WriteString("nan:canonical"); + } + } else { + json_stream_->Writef("\"%u\"", const_.f32_bits); + } break; } @@ -198,7 +204,15 @@ void BinaryWriterSpec::WriteConst(const Const& const_) { WriteString("f64"); WriteSeparator(); WriteKey("value"); - json_stream_->Writef("\"%" PRIu64 "\"", const_.f64_bits); + if (const_.is_expected_nan) { + if (const_.expected == ExpectedNan::Arithmetic) { + WriteString("nan:arithmetic"); + } else { + WriteString("nan:canonical"); + } + } else { + json_stream_->Writef("\"%" PRIu64 "\"", const_.f64_bits); + } break; } @@ -490,30 +504,6 @@ void BinaryWriterSpec::WriteCommands() { break; } - case CommandType::AssertReturnCanonicalNan: { - auto* assert_return_canonical_nan_command = - cast<AssertReturnCanonicalNanCommand>(command); - WriteLocation(assert_return_canonical_nan_command->action->loc); - WriteSeparator(); - WriteAction(*assert_return_canonical_nan_command->action); - WriteSeparator(); - WriteKey("expected"); - WriteActionResultType(*assert_return_canonical_nan_command->action); - break; - } - - case CommandType::AssertReturnArithmeticNan: { - auto* assert_return_arithmetic_nan_command = - cast<AssertReturnArithmeticNanCommand>(command); - WriteLocation(assert_return_arithmetic_nan_command->action->loc); - WriteSeparator(); - WriteAction(*assert_return_arithmetic_nan_command->action); - WriteSeparator(); - WriteKey("expected"); - WriteActionResultType(*assert_return_arithmetic_nan_command->action); - break; - } - case CommandType::AssertTrap: { auto* assert_trap_command = cast<AssertTrapCommand>(command); WriteLocation(assert_trap_command->action->loc); diff --git a/src/common.h b/src/common.h index a01b2989..6437bb7a 100644 --- a/src/common.h +++ b/src/common.h @@ -235,6 +235,12 @@ enum class SegmentKind { Declared, }; +// Used in test asserts for special expected values "nan:canonical" and "nan:arithmetic" +enum class ExpectedNan { + Canonical, + Arithmetic, +}; + // Matches binary format, do not change. enum SegmentFlags : uint8_t { SegFlagsNone = 0, diff --git a/src/interp/binary-reader-interp.cc b/src/interp/binary-reader-interp.cc index 3f270abf..5312e78b 100644 --- a/src/interp/binary-reader-interp.cc +++ b/src/interp/binary-reader-interp.cc @@ -1130,11 +1130,6 @@ wabt::Result BinaryReaderInterp::OnElemSegmentElemExprCount(Index index, if (segment_flags_ & SegPassive) { elem_segment_info_ = nullptr; } else { - // An active segment still is present in the segment index space, but - // cannot be used with `table.init` (it's as if it has already been - // dropped). - elem_segment_->dropped = true; - assert(segment_table_index_ != kInvalidIndex); Table* table = GetTableByModuleIndex(segment_table_index_); module_->active_elem_segments_.emplace_back(table, table_offset_); @@ -1146,7 +1141,11 @@ wabt::Result BinaryReaderInterp::OnElemSegmentElemExprCount(Index index, wabt::Result BinaryReaderInterp::OnElemSegmentElemExpr_RefNull( Index segment_index) { assert(segment_flags_ & SegUseElemExprs); - elem_segment_->elems.push_back({RefType::Null, kInvalidIndex}); + if (segment_flags_ & SegPassive) { + elem_segment_->elems.push_back({RefType::Null, kInvalidIndex}); + } else { + elem_segment_info_->src.push_back({RefType::Null, kInvalidIndex}); + } return wabt::Result::Ok; } @@ -1207,11 +1206,6 @@ wabt::Result BinaryReaderInterp::OnDataSegmentData(Index index, return wabt::Result::Error; } - // An active segment still is present in the segment index space, but - // cannot be used with `memory.init` (it's as if it has already been - // dropped). - segment->dropped = true; - assert(module_->memory_index != kInvalidIndex); Memory* memory = env_->GetMemory(module_->memory_index); Address address = init_expr_value_.value.i32; diff --git a/src/interp/interp.cc b/src/interp/interp.cc index a3d621e7..61e9d98b 100644 --- a/src/interp/interp.cc +++ b/src/interp/interp.cc @@ -1018,7 +1018,11 @@ Result Thread::AtomicRmwCmpxchg(const uint8_t** pc) { return Push<ResultValueType>(static_cast<ExtendedType>(read)); } -bool ClampToBounds(uint32_t start, uint32_t* length, uint32_t max) { +// This function is used to clanp the bound for table.fill operations. This +// can be removed once the behaviour of table.fill is updated to match the +// new bulk meory semantics, which is to trap early on OOB. +// See: https://github.com/webassembly/bulk-memory-operations/issues/111 +static bool ClampToBounds(uint32_t start, uint32_t* length, uint32_t max) { if (start > max) { *length = 0; return false; @@ -1031,6 +1035,14 @@ bool ClampToBounds(uint32_t start, uint32_t* length, uint32_t max) { return true; } +static bool CheckBounds(uint32_t start, uint32_t length, uint32_t max) { + if (start > max) { + return false; + } + uint32_t avail = max - start; + return length <= avail; +} + Result Thread::MemoryInit(const uint8_t** pc) { Memory* memory = ReadMemory(pc); DataSegment* segment = ReadDataSegment(pc); @@ -1039,13 +1051,12 @@ Result Thread::MemoryInit(const uint8_t** pc) { uint32_t size = Pop<uint32_t>(); uint32_t src = Pop<uint32_t>(); uint32_t dst = Pop<uint32_t>(); + bool ok = CheckBounds(dst, size, memory_size); + ok &= CheckBounds(src, size, segment_size); + if (!ok) { + TRAP_MSG(MemoryAccessOutOfBounds, "memory.init out of bounds"); + } if (size > 0) { - TRAP_IF(segment->dropped, DataSegmentDropped); - bool ok = ClampToBounds(dst, &size, memory_size); - ok &= ClampToBounds(src, &size, segment_size); - if (!ok) { - TRAP_MSG(MemoryAccessOutOfBounds, "memory.init out of bounds"); - } memcpy(memory->data.data() + dst, segment->data.data() + src, size); } return ResultType::Ok; @@ -1053,8 +1064,7 @@ Result Thread::MemoryInit(const uint8_t** pc) { Result Thread::DataDrop(const uint8_t** pc) { DataSegment* segment = ReadDataSegment(pc); - TRAP_IF(segment->dropped, DataSegmentDropped); - segment->dropped = true; + segment->data.clear(); return ResultType::Ok; } @@ -1064,12 +1074,12 @@ Result Thread::MemoryCopy(const uint8_t** pc) { uint32_t size = Pop<uint32_t>(); uint32_t src = Pop<uint32_t>(); uint32_t dst = Pop<uint32_t>(); + bool ok = CheckBounds(dst, size, memory_size); + ok &= CheckBounds(src, size, memory_size); + if (!ok) { + TRAP_MSG(MemoryAccessOutOfBounds, "memory.copy out of bound"); + } if (size > 0) { - bool ok = ClampToBounds(dst, &size, memory_size); - ok &= ClampToBounds(src, &size, memory_size); - if (!ok) { - TRAP_MSG(MemoryAccessOutOfBounds, "memory.copy out of bound"); - } char* data = memory->data.data(); memmove(data + dst, data + src, size); } @@ -1082,11 +1092,10 @@ Result Thread::MemoryFill(const uint8_t** pc) { uint32_t size = Pop<uint32_t>(); uint8_t value = static_cast<uint8_t>(Pop<uint32_t>()); uint32_t dst = Pop<uint32_t>(); + if (!CheckBounds(dst, size, memory_size)) { + TRAP_MSG(MemoryAccessOutOfBounds, "memory.fill out of bounds"); + } if (size > 0) { - bool ok = ClampToBounds(dst, &size, memory_size); - if (!ok) { - TRAP_MSG(MemoryAccessOutOfBounds, "memory.fill out of bounds"); - } memset(memory->data.data() + dst, value, size); } return ResultType::Ok; @@ -1099,13 +1108,12 @@ Result Thread::TableInit(const uint8_t** pc) { uint32_t size = Pop<uint32_t>(); uint32_t src = Pop<uint32_t>(); uint32_t dst = Pop<uint32_t>(); + bool ok = CheckBounds(dst, size, table->size()); + ok &= CheckBounds(src, size, segment_size); + if (!ok) { + TRAP_MSG(TableAccessOutOfBounds, "table.init out of bounds"); + } if (size > 0) { - TRAP_IF(segment->dropped, ElemSegmentDropped); - bool ok = ClampToBounds(dst, &size, table->size()); - ok &= ClampToBounds(src, &size, segment_size); - if (!ok) { - TRAP_MSG(TableAccessOutOfBounds, "table.init out of bounds"); - } memcpy(table->entries.data() + dst, segment->elems.data() + src, size * sizeof(table->entries[0])); } @@ -1144,14 +1152,13 @@ Result Thread::TableFill(const uint8_t** pc) { for (uint32_t i = 0; i < size; i++) { table->entries[dst+i] = value; } - TRAP_IF(!ok, MemoryAccessOutOfBounds); + TRAP_IF(!ok, TableAccessOutOfBounds); return ResultType::Ok; } Result Thread::ElemDrop(const uint8_t** pc) { ElemSegment* segment = ReadElemSegment(pc); - TRAP_IF(segment->dropped, ElemSegmentDropped); - segment->dropped = true; + segment->elems.clear(); return ResultType::Ok; } @@ -1162,12 +1169,12 @@ Result Thread::TableCopy(const uint8_t** pc) { uint32_t size = Pop<uint32_t>(); uint32_t src = Pop<uint32_t>(); uint32_t dst = Pop<uint32_t>(); + bool ok = CheckBounds(dst, size, dst_table->size()); + ok &= CheckBounds(src, size, dst_table->size()); + if (!ok) { + TRAP_MSG(TableAccessOutOfBounds, "table.copy out of bounds"); + } if (size > 0) { - bool ok = ClampToBounds(dst, &size, dst_table->size()); - ok &= ClampToBounds(src, &size, dst_table->size()); - if (!ok) { - TRAP_MSG(TableAccessOutOfBounds, "table.copy out of bounds"); - } Ref* data_src = src_table->entries.data(); Ref* data_dst = dst_table->entries.data(); memmove(data_dst + dst, data_src + src, size * sizeof(Ref)); @@ -3755,40 +3762,36 @@ Result Executor::InitializeSegments(DefinedModule* module) { uint32_t table_size = info.table->size(); uint32_t segment_size = info.src.size(); uint32_t copy_size = segment_size; - bool ok = ClampToBounds(info.dst, ©_size, table_size); - - if (pass == Init && copy_size > 0) { - std::copy(info.src.begin(), info.src.begin() + copy_size, - info.table->entries.begin() + info.dst); - } - - if (!ok) { + if (!CheckBounds(info.dst, copy_size, table_size)) { TRAP_MSG(TableAccessOutOfBounds, "elem segment is out of bounds: [%u, %" PRIu64 ") >= max value %u", info.dst, static_cast<uint64_t>(info.dst) + segment_size, table_size); } + + if (pass == Init && copy_size > 0) { + std::copy(info.src.begin(), info.src.begin() + copy_size, + info.table->entries.begin() + info.dst); + } } for (const DataSegmentInfo& info : module->active_data_segments_) { uint32_t memory_size = info.memory->data.size(); uint32_t segment_size = info.data.size(); uint32_t copy_size = segment_size; - bool ok = ClampToBounds(info.dst, ©_size, memory_size); - - if (pass == Init && copy_size > 0) { - std::copy(info.data.begin(), info.data.begin() + copy_size, - info.memory->data.begin() + info.dst); - } - - if (!ok) { + if (!CheckBounds(info.dst, copy_size, memory_size)) { TRAP_MSG(MemoryAccessOutOfBounds, "data segment is out of bounds: [%u, %" PRIu64 ") >= max value %u", info.dst, static_cast<uint64_t>(info.dst) + segment_size, memory_size); } + + if (pass == Init && copy_size > 0) { + std::copy(info.data.begin(), info.data.begin() + copy_size, + info.memory->data.begin() + info.dst); + } } } diff --git a/src/interp/interp.h b/src/interp/interp.h index 7d01fb9a..e7bb1e25 100644 --- a/src/interp/interp.h +++ b/src/interp/interp.h @@ -66,10 +66,6 @@ namespace interp { V(TrapHostResultTypeMismatch, "host result type mismatch") \ /* we called an import function, but it didn't complete succesfully */ \ V(TrapHostTrapped, "host function trapped") \ - /* the data segment has been dropped. */ \ - V(TrapDataSegmentDropped, "data segment dropped") \ - /* the element segment has been dropped. */ \ - V(TrapElemSegmentDropped, "element segment dropped") \ /* table access is out of bounds */ \ V(TrapTableAccessOutOfBounds, "out of bounds table access") \ /* we attempted to call a function with the an argument list that doesn't \ @@ -150,14 +146,12 @@ struct DataSegment { DataSegment() = default; std::vector<char> data; - bool dropped = false; }; struct ElemSegment { ElemSegment() = default; std::vector<Ref> elems; - bool dropped = false; }; struct ElemSegmentInfo { @@ -208,7 +202,7 @@ union Value { }; struct TypedValue { - TypedValue() {} + TypedValue() = default; explicit TypedValue(Type type) : type(type) {} TypedValue(Type basetype, const Value& value) : type(basetype), value(value) { UpdateType(); @@ -780,8 +774,6 @@ std::string TypedValueToString(const TypedValue&); std::string ResultToString(Result); const char* ResultTypeToString(ResultType); -bool ClampToBounds(uint32_t start, uint32_t* length, uint32_t max); - void WriteTypedValue(Stream* stream, const TypedValue&); void WriteTypedValues(Stream* stream, const TypedValues&); void WriteResult(Stream* stream, const char* desc, Result); @@ -98,6 +98,8 @@ struct Const { Location loc; Type type; + + bool is_expected_nan = false; union { uint32_t u32; uint64_t u64; @@ -105,6 +107,7 @@ struct Const { uint64_t f64_bits; uintptr_t ref_bits; v128 vec128; + ExpectedNan expected; }; private: @@ -1047,8 +1050,6 @@ enum class CommandType { AssertUninstantiable, AssertReturn, AssertReturnFunc, - AssertReturnCanonicalNan, - AssertReturnArithmeticNan, AssertTrap, AssertExhaustion, @@ -1088,10 +1089,6 @@ class ActionCommandBase : public CommandMixin<TypeEnum> { }; typedef ActionCommandBase<CommandType::Action> ActionCommand; -typedef ActionCommandBase<CommandType::AssertReturnCanonicalNan> - AssertReturnCanonicalNanCommand; -typedef ActionCommandBase<CommandType::AssertReturnArithmeticNan> - AssertReturnArithmeticNanCommand; class RegisterCommand : public CommandMixin<CommandType::Register> { public: diff --git a/src/lexer-keywords.txt b/src/lexer-keywords.txt index 6d560e24..7933487a 100644 --- a/src/lexer-keywords.txt +++ b/src/lexer-keywords.txt @@ -19,8 +19,6 @@ anyref, Type::Anyref assert_exhaustion, TokenType::AssertExhaustion assert_invalid, TokenType::AssertInvalid assert_malformed, TokenType::AssertMalformed -assert_return_arithmetic_nan, TokenType::AssertReturnArithmeticNan -assert_return_canonical_nan, TokenType::AssertReturnCanonicalNan assert_return, TokenType::AssertReturn assert_return_func, TokenType::AssertReturnFunc assert_trap, TokenType::AssertTrap @@ -441,6 +439,8 @@ memory.size, TokenType::MemorySize, Opcode::MemorySize memory, TokenType::Memory module, TokenType::Module mut, TokenType::Mut +nan:arithmetic, TokenType::NanArithmetic +nan:canonical, TokenType::NanCanonical nop, TokenType::Nop, Opcode::Nop nullref, Type::Nullref offset, TokenType::Offset diff --git a/src/prebuilt/lexer-keywords.cc b/src/prebuilt/lexer-keywords.cc index d504e139..aa162a25 100644 --- a/src/prebuilt/lexer-keywords.cc +++ b/src/prebuilt/lexer-keywords.cc @@ -152,7 +152,7 @@ Perfect_Hash::InWordSet (const char *str, size_t len) { TOTAL_KEYWORDS = 507, MIN_WORD_LENGTH = 2, - MAX_WORD_LENGTH = 28, + MAX_WORD_LENGTH = 26, MIN_HASH_VALUE = 17, MAX_HASH_VALUE = 1733 }; @@ -161,128 +161,128 @@ Perfect_Hash::InWordSet (const char *str, size_t len) { {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 428 "src/lexer-keywords.txt" +#line 426 "src/lexer-keywords.txt" {"if", TokenType::If, Opcode::If}, {""}, {""}, {""}, -#line 128 "src/lexer-keywords.txt" +#line 126 "src/lexer-keywords.txt" {"f64", Type::F64}, -#line 443 "src/lexer-keywords.txt" +#line 441 "src/lexer-keywords.txt" {"mut", TokenType::Mut}, -#line 77 "src/lexer-keywords.txt" +#line 75 "src/lexer-keywords.txt" {"f32", Type::F32}, -#line 382 "src/lexer-keywords.txt" +#line 380 "src/lexer-keywords.txt" {"i64", Type::I64}, {""}, -#line 262 "src/lexer-keywords.txt" +#line 260 "src/lexer-keywords.txt" {"i32", Type::I32}, {""}, {""}, {""}, #line 470 "src/lexer-keywords.txt" {"then", TokenType::Then}, {""}, {""}, {""}, -#line 44 "src/lexer-keywords.txt" +#line 42 "src/lexer-keywords.txt" {"else", TokenType::Else, Opcode::Else}, -#line 43 "src/lexer-keywords.txt" +#line 41 "src/lexer-keywords.txt" {"elem", TokenType::Elem}, {""}, -#line 115 "src/lexer-keywords.txt" +#line 113 "src/lexer-keywords.txt" {"f64.lt", TokenType::Compare, Opcode::F64Lt}, -#line 65 "src/lexer-keywords.txt" +#line 63 "src/lexer-keywords.txt" {"f32.lt", TokenType::Compare, Opcode::F32Lt}, {""}, {""}, {""}, {""}, -#line 46 "src/lexer-keywords.txt" +#line 44 "src/lexer-keywords.txt" {"event", TokenType::Event}, {""}, #line 461 "src/lexer-keywords.txt" {"start", TokenType::Start}, {""}, {""}, {""}, -#line 113 "src/lexer-keywords.txt" +#line 111 "src/lexer-keywords.txt" {"f64.le", TokenType::Compare, Opcode::F64Le}, -#line 63 "src/lexer-keywords.txt" +#line 61 "src/lexer-keywords.txt" {"f32.le", TokenType::Compare, Opcode::F32Le}, -#line 150 "src/lexer-keywords.txt" +#line 148 "src/lexer-keywords.txt" {"funcref", Type::Funcref}, -#line 117 "src/lexer-keywords.txt" +#line 115 "src/lexer-keywords.txt" {"f64.min", TokenType::Binary, Opcode::F64Min}, -#line 67 "src/lexer-keywords.txt" +#line 65 "src/lexer-keywords.txt" {"f32.min", TokenType::Binary, Opcode::F32Min}, -#line 355 "src/lexer-keywords.txt" +#line 353 "src/lexer-keywords.txt" {"i64.lt_s", TokenType::Compare, Opcode::I64LtS}, -#line 236 "src/lexer-keywords.txt" +#line 234 "src/lexer-keywords.txt" {"i32.lt_s", TokenType::Compare, Opcode::I32LtS}, #line 469 "src/lexer-keywords.txt" {"table", TokenType::Table}, {""}, -#line 356 "src/lexer-keywords.txt" +#line 354 "src/lexer-keywords.txt" {"i64.lt_u", TokenType::Compare, Opcode::I64LtU}, -#line 237 "src/lexer-keywords.txt" +#line 235 "src/lexer-keywords.txt" {"i32.lt_u", TokenType::Compare, Opcode::I32LtU}, -#line 346 "src/lexer-keywords.txt" +#line 344 "src/lexer-keywords.txt" {"i64.le_s", TokenType::Compare, Opcode::I64LeS}, -#line 229 "src/lexer-keywords.txt" +#line 227 "src/lexer-keywords.txt" {"i32.le_s", TokenType::Compare, Opcode::I32LeS}, {""}, {""}, -#line 347 "src/lexer-keywords.txt" +#line 345 "src/lexer-keywords.txt" {"i64.le_u", TokenType::Compare, Opcode::I64LeU}, -#line 230 "src/lexer-keywords.txt" +#line 228 "src/lexer-keywords.txt" {"i32.le_u", TokenType::Compare, Opcode::I32LeU}, #line 446 "src/lexer-keywords.txt" {"offset", TokenType::Offset}, -#line 362 "src/lexer-keywords.txt" +#line 360 "src/lexer-keywords.txt" {"i64.rem_s", TokenType::Binary, Opcode::I64RemS}, -#line 243 "src/lexer-keywords.txt" +#line 241 "src/lexer-keywords.txt" {"i32.rem_s", TokenType::Binary, Opcode::I32RemS}, {""}, {""}, -#line 363 "src/lexer-keywords.txt" +#line 361 "src/lexer-keywords.txt" {"i64.rem_u", TokenType::Binary, Opcode::I64RemU}, -#line 244 "src/lexer-keywords.txt" +#line 242 "src/lexer-keywords.txt" {"i32.rem_u", TokenType::Binary, Opcode::I32RemU}, {""}, {""}, #line 445 "src/lexer-keywords.txt" {"nullref", Type::Nullref}, {""}, {""}, -#line 121 "src/lexer-keywords.txt" +#line 119 "src/lexer-keywords.txt" {"f64.ne", TokenType::Compare, Opcode::F64Ne}, -#line 71 "src/lexer-keywords.txt" +#line 69 "src/lexer-keywords.txt" {"f32.ne", TokenType::Compare, Opcode::F32Ne}, -#line 40 "src/lexer-keywords.txt" +#line 38 "src/lexer-keywords.txt" {"data", TokenType::Data}, -#line 358 "src/lexer-keywords.txt" +#line 356 "src/lexer-keywords.txt" {"i64.ne", TokenType::Compare, Opcode::I64Ne}, -#line 239 "src/lexer-keywords.txt" +#line 237 "src/lexer-keywords.txt" {"i32.ne", TokenType::Compare, Opcode::I32Ne}, {""}, {""}, -#line 99 "src/lexer-keywords.txt" +#line 97 "src/lexer-keywords.txt" {"f64.abs", TokenType::Unary, Opcode::F64Abs}, -#line 48 "src/lexer-keywords.txt" +#line 46 "src/lexer-keywords.txt" {"f32.abs", TokenType::Unary, Opcode::F32Abs}, -#line 126 "src/lexer-keywords.txt" +#line 124 "src/lexer-keywords.txt" {"f64.sub", TokenType::Binary, Opcode::F64Sub}, -#line 75 "src/lexer-keywords.txt" +#line 73 "src/lexer-keywords.txt" {"f32.sub", TokenType::Binary, Opcode::F32Sub}, {""}, -#line 373 "src/lexer-keywords.txt" +#line 371 "src/lexer-keywords.txt" {"i64.sub", TokenType::Binary, Opcode::I64Sub}, -#line 253 "src/lexer-keywords.txt" +#line 251 "src/lexer-keywords.txt" {"i32.sub", TokenType::Binary, Opcode::I32Sub}, {""}, {""}, -#line 442 "src/lexer-keywords.txt" +#line 440 "src/lexer-keywords.txt" {"module", TokenType::Module}, -#line 118 "src/lexer-keywords.txt" +#line 116 "src/lexer-keywords.txt" {"f64.mul", TokenType::Binary, Opcode::F64Mul}, -#line 68 "src/lexer-keywords.txt" +#line 66 "src/lexer-keywords.txt" {"f32.mul", TokenType::Binary, Opcode::F32Mul}, {""}, -#line 357 "src/lexer-keywords.txt" +#line 355 "src/lexer-keywords.txt" {"i64.mul", TokenType::Binary, Opcode::I64Mul}, -#line 238 "src/lexer-keywords.txt" +#line 236 "src/lexer-keywords.txt" {"i32.mul", TokenType::Binary, Opcode::I32Mul}, {""}, {""}, {""}, {""}, #line 459 "src/lexer-keywords.txt" {"select", TokenType::Select, Opcode::Select}, -#line 30 "src/lexer-keywords.txt" +#line 28 "src/lexer-keywords.txt" {"block", TokenType::Block, Opcode::Block}, {""}, -#line 34 "src/lexer-keywords.txt" +#line 32 "src/lexer-keywords.txt" {"br", TokenType::Br, Opcode::Br}, {""}, #line 454 "src/lexer-keywords.txt" @@ -294,149 +294,149 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {"return", TokenType::Return, Opcode::Return}, #line 465 "src/lexer-keywords.txt" {"table.init", TokenType::TableInit, Opcode::TableInit}, -#line 151 "src/lexer-keywords.txt" +#line 149 "src/lexer-keywords.txt" {"func", TokenType::Func}, -#line 45 "src/lexer-keywords.txt" +#line 43 "src/lexer-keywords.txt" {"end", TokenType::End, Opcode::End}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 333 "src/lexer-keywords.txt" +#line 331 "src/lexer-keywords.txt" {"i64.div_s", TokenType::Binary, Opcode::I64DivS}, -#line 219 "src/lexer-keywords.txt" +#line 217 "src/lexer-keywords.txt" {"i32.div_s", TokenType::Binary, Opcode::I32DivS}, {""}, {""}, -#line 334 "src/lexer-keywords.txt" +#line 332 "src/lexer-keywords.txt" {"i64.div_u", TokenType::Binary, Opcode::I64DivU}, -#line 220 "src/lexer-keywords.txt" +#line 218 "src/lexer-keywords.txt" {"i32.div_u", TokenType::Binary, Opcode::I32DivU}, -#line 430 "src/lexer-keywords.txt" +#line 428 "src/lexer-keywords.txt" {"invoke", TokenType::Invoke}, -#line 364 "src/lexer-keywords.txt" +#line 362 "src/lexer-keywords.txt" {"i64.rotl", TokenType::Binary, Opcode::I64Rotl}, -#line 245 "src/lexer-keywords.txt" +#line 243 "src/lexer-keywords.txt" {"i32.rotl", TokenType::Binary, Opcode::I32Rotl}, -#line 102 "src/lexer-keywords.txt" +#line 100 "src/lexer-keywords.txt" {"f64.const", TokenType::Const, Opcode::F64Const}, -#line 51 "src/lexer-keywords.txt" +#line 49 "src/lexer-keywords.txt" {"f32.const", TokenType::Const, Opcode::F32Const}, {""}, -#line 331 "src/lexer-keywords.txt" +#line 329 "src/lexer-keywords.txt" {"i64.const", TokenType::Const, Opcode::I64Const}, -#line 217 "src/lexer-keywords.txt" +#line 215 "src/lexer-keywords.txt" {"i32.const", TokenType::Const, Opcode::I32Const}, #line 460 "src/lexer-keywords.txt" {"shared", TokenType::Shared}, {""}, {""}, -#line 149 "src/lexer-keywords.txt" +#line 147 "src/lexer-keywords.txt" {"f64x2", TokenType::F64X2}, {""}, {""}, -#line 395 "src/lexer-keywords.txt" +#line 393 "src/lexer-keywords.txt" {"i64x2", TokenType::I64X2}, {""}, {""}, {""}, {""}, -#line 33 "src/lexer-keywords.txt" +#line 31 "src/lexer-keywords.txt" {"br_table", TokenType::BrTable, Opcode::BrTable}, {""}, -#line 101 "src/lexer-keywords.txt" +#line 99 "src/lexer-keywords.txt" {"f64.ceil", TokenType::Unary, Opcode::F64Ceil}, -#line 50 "src/lexer-keywords.txt" +#line 48 "src/lexer-keywords.txt" {"f32.ceil", TokenType::Unary, Opcode::F32Ceil}, {""}, {""}, #line 452 "src/lexer-keywords.txt" {"ref.host", TokenType::RefHost}, #line 468 "src/lexer-keywords.txt" {"table.fill", TokenType::TableFill, Opcode::TableFill}, -#line 292 "src/lexer-keywords.txt" +#line 290 "src/lexer-keywords.txt" {"i64.and", TokenType::Binary, Opcode::I64And}, -#line 187 "src/lexer-keywords.txt" +#line 185 "src/lexer-keywords.txt" {"i32.and", TokenType::Binary, Opcode::I32And}, {""}, -#line 36 "src/lexer-keywords.txt" +#line 34 "src/lexer-keywords.txt" {"call", TokenType::Call, Opcode::Call}, {""}, -#line 108 "src/lexer-keywords.txt" +#line 106 "src/lexer-keywords.txt" {"f64.div", TokenType::Binary, Opcode::F64Div}, -#line 58 "src/lexer-keywords.txt" +#line 56 "src/lexer-keywords.txt" {"f32.div", TokenType::Binary, Opcode::F32Div}, {""}, {""}, {""}, {""}, -#line 434 "src/lexer-keywords.txt" +#line 432 "src/lexer-keywords.txt" {"local", TokenType::Local}, -#line 27 "src/lexer-keywords.txt" +#line 25 "src/lexer-keywords.txt" {"assert_unlinkable", TokenType::AssertUnlinkable}, {""}, -#line 125 "src/lexer-keywords.txt" +#line 123 "src/lexer-keywords.txt" {"f64.store", TokenType::Store, Opcode::F64Store}, -#line 74 "src/lexer-keywords.txt" +#line 72 "src/lexer-keywords.txt" {"f32.store", TokenType::Store, Opcode::F32Store}, {""}, -#line 372 "src/lexer-keywords.txt" +#line 370 "src/lexer-keywords.txt" {"i64.store", TokenType::Store, Opcode::I64Store}, -#line 252 "src/lexer-keywords.txt" +#line 250 "src/lexer-keywords.txt" {"i32.store", TokenType::Store, Opcode::I32Store}, {""}, {""}, -#line 370 "src/lexer-keywords.txt" +#line 368 "src/lexer-keywords.txt" {"i64.store32", TokenType::Store, Opcode::I64Store32}, {""}, {""}, {""}, {""}, -#line 114 "src/lexer-keywords.txt" +#line 112 "src/lexer-keywords.txt" {"f64.load", TokenType::Load, Opcode::F64Load}, -#line 64 "src/lexer-keywords.txt" +#line 62 "src/lexer-keywords.txt" {"f32.load", TokenType::Load, Opcode::F32Load}, #line 455 "src/lexer-keywords.txt" {"rethrow", TokenType::Rethrow, Opcode::Rethrow}, -#line 354 "src/lexer-keywords.txt" +#line 352 "src/lexer-keywords.txt" {"i64.load", TokenType::Load, Opcode::I64Load}, -#line 235 "src/lexer-keywords.txt" +#line 233 "src/lexer-keywords.txt" {"i32.load", TokenType::Load, Opcode::I32Load}, {""}, {""}, {""}, {""}, {""}, -#line 119 "src/lexer-keywords.txt" +#line 117 "src/lexer-keywords.txt" {"f64.nearest", TokenType::Unary, Opcode::F64Nearest}, -#line 69 "src/lexer-keywords.txt" +#line 67 "src/lexer-keywords.txt" {"f32.nearest", TokenType::Unary, Opcode::F32Nearest}, {""}, -#line 100 "src/lexer-keywords.txt" +#line 98 "src/lexer-keywords.txt" {"f64.add", TokenType::Binary, Opcode::F64Add}, -#line 49 "src/lexer-keywords.txt" +#line 47 "src/lexer-keywords.txt" {"f32.add", TokenType::Binary, Opcode::F32Add}, {""}, -#line 291 "src/lexer-keywords.txt" +#line 289 "src/lexer-keywords.txt" {"i64.add", TokenType::Binary, Opcode::I64Add}, -#line 186 "src/lexer-keywords.txt" +#line 184 "src/lexer-keywords.txt" {"i32.add", TokenType::Binary, Opcode::I32Add}, -#line 144 "src/lexer-keywords.txt" +#line 142 "src/lexer-keywords.txt" {"f64x2.ne", TokenType::Compare, Opcode::F64X2Ne}, -#line 141 "src/lexer-keywords.txt" +#line 139 "src/lexer-keywords.txt" {"f64x2.min", TokenType::Binary, Opcode::F64X2Min}, {""}, -#line 432 "src/lexer-keywords.txt" +#line 430 "src/lexer-keywords.txt" {"local.set", TokenType::LocalSet, Opcode::LocalSet}, {""}, {""}, {""}, -#line 329 "src/lexer-keywords.txt" +#line 327 "src/lexer-keywords.txt" {"i64.atomic.wait", TokenType::AtomicWait, Opcode::I64AtomicWait}, -#line 215 "src/lexer-keywords.txt" +#line 213 "src/lexer-keywords.txt" {"i32.atomic.wait", TokenType::AtomicWait, Opcode::I32AtomicWait}, #line 450 "src/lexer-keywords.txt" {"ref.is_null", TokenType::RefIsNull, Opcode::RefIsNull}, -#line 139 "src/lexer-keywords.txt" +#line 137 "src/lexer-keywords.txt" {"f64x2.lt", TokenType::Compare, Opcode::F64X2Lt}, {""}, {""}, {""}, {""}, -#line 433 "src/lexer-keywords.txt" +#line 431 "src/lexer-keywords.txt" {"local.tee", TokenType::LocalTee, Opcode::LocalTee}, {""}, {""}, {""}, -#line 328 "src/lexer-keywords.txt" +#line 326 "src/lexer-keywords.txt" {"i64.atomic.store", TokenType::AtomicStore, Opcode::I64AtomicStore}, -#line 214 "src/lexer-keywords.txt" +#line 212 "src/lexer-keywords.txt" {"i32.atomic.store", TokenType::AtomicStore, Opcode::I32AtomicStore}, {""}, -#line 138 "src/lexer-keywords.txt" +#line 136 "src/lexer-keywords.txt" {"f64x2.le", TokenType::Compare, Opcode::F64X2Le}, {""}, {""}, #line 451 "src/lexer-keywords.txt" {"ref.null", TokenType::RefNull, Opcode::RefNull}, -#line 365 "src/lexer-keywords.txt" +#line 363 "src/lexer-keywords.txt" {"i64.rotr", TokenType::Binary, Opcode::I64Rotr}, -#line 246 "src/lexer-keywords.txt" +#line 244 "src/lexer-keywords.txt" {"i32.rotr", TokenType::Binary, Opcode::I32Rotr}, -#line 129 "src/lexer-keywords.txt" +#line 127 "src/lexer-keywords.txt" {"f64x2.abs", TokenType::Unary, Opcode::F64X2Abs}, -#line 326 "src/lexer-keywords.txt" +#line 324 "src/lexer-keywords.txt" {"i64.atomic.store32", TokenType::AtomicStore, Opcode::I64AtomicStore32}, #line 467 "src/lexer-keywords.txt" {"table.size", TokenType::TableSize, Opcode::TableSize}, @@ -444,193 +444,194 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 20 "src/lexer-keywords.txt" {"assert_invalid", TokenType::AssertInvalid}, {""}, {""}, {""}, -#line 148 "src/lexer-keywords.txt" +#line 146 "src/lexer-keywords.txt" {"f64x2.sub", TokenType::Binary, Opcode::F64X2Sub}, {""}, #line 524 "src/lexer-keywords.txt" {"set_local", TokenType::LocalSet, Opcode::LocalSet}, -#line 394 "src/lexer-keywords.txt" +#line 392 "src/lexer-keywords.txt" {"i64x2.sub", TokenType::Binary, Opcode::I64X2Sub}, {""}, {""}, {""}, -#line 142 "src/lexer-keywords.txt" +#line 140 "src/lexer-keywords.txt" {"f64x2.mul", TokenType::Binary, Opcode::F64X2Mul}, #line 525 "src/lexer-keywords.txt" {"tee_local", TokenType::LocalTee, Opcode::LocalTee}, {""}, {""}, -#line 24 "src/lexer-keywords.txt" +#line 22 "src/lexer-keywords.txt" {"assert_return", TokenType::AssertReturn}, {""}, {""}, #line 473 "src/lexer-keywords.txt" {"type", TokenType::Type}, {""}, {""}, {""}, -#line 57 "src/lexer-keywords.txt" +#line 55 "src/lexer-keywords.txt" {"f32.demote_f64", TokenType::Convert, Opcode::F32DemoteF64}, #line 479 "src/lexer-keywords.txt" {"v128.not", TokenType::Unary, Opcode::V128Not}, {""}, {""}, {""}, {""}, {""}, -#line 429 "src/lexer-keywords.txt" +#line 427 "src/lexer-keywords.txt" {"import", TokenType::Import}, {""}, {""}, -#line 47 "src/lexer-keywords.txt" +#line 45 "src/lexer-keywords.txt" {"export", TokenType::Export}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 350 "src/lexer-keywords.txt" +#line 348 "src/lexer-keywords.txt" {"i64.load32_s", TokenType::Load, Opcode::I64Load32S}, {""}, {""}, {""}, -#line 351 "src/lexer-keywords.txt" +#line 349 "src/lexer-keywords.txt" {"i64.load32_u", TokenType::Load, Opcode::I64Load32U}, {""}, {""}, {""}, -#line 296 "src/lexer-keywords.txt" +#line 294 "src/lexer-keywords.txt" {"i64.atomic.load", TokenType::AtomicLoad, Opcode::I64AtomicLoad}, -#line 190 "src/lexer-keywords.txt" +#line 188 "src/lexer-keywords.txt" {"i32.atomic.load", TokenType::AtomicLoad, Opcode::I32AtomicLoad}, {""}, {""}, {""}, {""}, {""}, {""}, #line 457 "src/lexer-keywords.txt" {"return_call", TokenType::ReturnCall, Opcode::ReturnCall}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 435 "src/lexer-keywords.txt" +#line 433 "src/lexer-keywords.txt" {"loop", TokenType::Loop, Opcode::Loop}, {""}, -#line 152 "src/lexer-keywords.txt" +#line 150 "src/lexer-keywords.txt" {"get", TokenType::Get}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, #line 21 "src/lexer-keywords.txt" {"assert_malformed", TokenType::AssertMalformed}, -#line 127 "src/lexer-keywords.txt" +#line 125 "src/lexer-keywords.txt" {"f64.trunc", TokenType::Unary, Opcode::F64Trunc}, -#line 76 "src/lexer-keywords.txt" +#line 74 "src/lexer-keywords.txt" {"f32.trunc", TokenType::Unary, Opcode::F32Trunc}, {""}, {""}, {""}, -#line 41 "src/lexer-keywords.txt" +#line 39 "src/lexer-keywords.txt" {"drop", TokenType::Drop, Opcode::Drop}, {""}, {""}, {""}, -#line 332 "src/lexer-keywords.txt" +#line 330 "src/lexer-keywords.txt" {"i64.ctz", TokenType::Unary, Opcode::I64Ctz}, -#line 218 "src/lexer-keywords.txt" +#line 216 "src/lexer-keywords.txt" {"i32.ctz", TokenType::Unary, Opcode::I32Ctz}, - {""}, {""}, + {""}, +#line 443 "src/lexer-keywords.txt" + {"nan:canonical", TokenType::NanCanonical}, #line 447 "src/lexer-keywords.txt" {"param", TokenType::Param}, #line 475 "src/lexer-keywords.txt" {"v128.and", TokenType::Binary, Opcode::V128And}, {""}, -#line 31 "src/lexer-keywords.txt" +#line 29 "src/lexer-keywords.txt" {"br_if", TokenType::BrIf, Opcode::BrIf}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 130 "src/lexer-keywords.txt" +#line 128 "src/lexer-keywords.txt" {"f64x2.add", TokenType::Binary, Opcode::F64X2Add}, #line 481 "src/lexer-keywords.txt" {"v128.store", TokenType::Store, Opcode::V128Store}, -#line 35 "src/lexer-keywords.txt" +#line 33 "src/lexer-keywords.txt" {"call_indirect", TokenType::CallIndirect, Opcode::CallIndirect}, -#line 383 "src/lexer-keywords.txt" +#line 381 "src/lexer-keywords.txt" {"i64x2.add", TokenType::Binary, Opcode::I64X2Add}, {""}, -#line 315 "src/lexer-keywords.txt" +#line 313 "src/lexer-keywords.txt" {"i64.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8SubU}, -#line 202 "src/lexer-keywords.txt" +#line 200 "src/lexer-keywords.txt" {"i32.atomic.rmw8.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8SubU}, {""}, -#line 330 "src/lexer-keywords.txt" +#line 328 "src/lexer-keywords.txt" {"i64.clz", TokenType::Unary, Opcode::I64Clz}, -#line 216 "src/lexer-keywords.txt" +#line 214 "src/lexer-keywords.txt" {"i32.clz", TokenType::Unary, Opcode::I32Clz}, {""}, -#line 133 "src/lexer-keywords.txt" +#line 131 "src/lexer-keywords.txt" {"f64x2.div", TokenType::Binary, Opcode::F64X2Div}, -#line 103 "src/lexer-keywords.txt" +#line 101 "src/lexer-keywords.txt" {"f64.convert_i32_s", TokenType::Convert, Opcode::F64ConvertI32S}, -#line 52 "src/lexer-keywords.txt" +#line 50 "src/lexer-keywords.txt" {"f32.convert_i32_s", TokenType::Convert, Opcode::F32ConvertI32S}, {""}, #line 477 "src/lexer-keywords.txt" {"v128.const", TokenType::Const, Opcode::V128Const}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 105 "src/lexer-keywords.txt" +#line 103 "src/lexer-keywords.txt" {"f64.convert_i64_s", TokenType::Convert, Opcode::F64ConvertI64S}, -#line 54 "src/lexer-keywords.txt" +#line 52 "src/lexer-keywords.txt" {"f32.convert_i64_s", TokenType::Convert, Opcode::F32ConvertI64S}, -#line 23 "src/lexer-keywords.txt" - {"assert_return_canonical_nan", TokenType::AssertReturnCanonicalNan}, -#line 374 "src/lexer-keywords.txt" + {""}, +#line 372 "src/lexer-keywords.txt" {"i64.trunc_f32_s", TokenType::Convert, Opcode::I64TruncF32S}, -#line 254 "src/lexer-keywords.txt" +#line 252 "src/lexer-keywords.txt" {"i32.trunc_f32_s", TokenType::Convert, Opcode::I32TruncF32S}, -#line 375 "src/lexer-keywords.txt" +#line 373 "src/lexer-keywords.txt" {"i64.trunc_f32_u", TokenType::Convert, Opcode::I64TruncF32U}, -#line 255 "src/lexer-keywords.txt" +#line 253 "src/lexer-keywords.txt" {"i32.trunc_f32_u", TokenType::Convert, Opcode::I32TruncF32U}, -#line 384 "src/lexer-keywords.txt" +#line 382 "src/lexer-keywords.txt" {"i64x2.all_true", TokenType::Unary, Opcode::I64X2AllTrue}, #line 492 "src/lexer-keywords.txt" {"f32.demote/f64", TokenType::Convert, Opcode::F32DemoteF64}, {""}, {""}, {""}, {""}, -#line 321 "src/lexer-keywords.txt" +#line 319 "src/lexer-keywords.txt" {"i64.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I64AtomicRmwOr}, -#line 208 "src/lexer-keywords.txt" +#line 206 "src/lexer-keywords.txt" {"i32.atomic.rmw.or", TokenType::AtomicRmw, Opcode::I32AtomicRmwOr}, -#line 322 "src/lexer-keywords.txt" +#line 320 "src/lexer-keywords.txt" {"i64.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I64AtomicRmwSub}, -#line 209 "src/lexer-keywords.txt" +#line 207 "src/lexer-keywords.txt" {"i32.atomic.rmw.sub", TokenType::AtomicRmw, Opcode::I32AtomicRmwSub}, -#line 376 "src/lexer-keywords.txt" +#line 374 "src/lexer-keywords.txt" {"i64.trunc_f64_s", TokenType::Convert, Opcode::I64TruncF64S}, -#line 256 "src/lexer-keywords.txt" +#line 254 "src/lexer-keywords.txt" {"i32.trunc_f64_s", TokenType::Convert, Opcode::I32TruncF64S}, -#line 377 "src/lexer-keywords.txt" +#line 375 "src/lexer-keywords.txt" {"i64.trunc_f64_u", TokenType::Convert, Opcode::I64TruncF64U}, -#line 257 "src/lexer-keywords.txt" +#line 255 "src/lexer-keywords.txt" {"i32.trunc_f64_u", TokenType::Convert, Opcode::I32TruncF64U}, #line 478 "src/lexer-keywords.txt" {"v128.load", TokenType::Load, Opcode::V128Load}, -#line 312 "src/lexer-keywords.txt" +#line 310 "src/lexer-keywords.txt" {"i64.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AndU}, -#line 199 "src/lexer-keywords.txt" +#line 197 "src/lexer-keywords.txt" {"i32.atomic.rmw8.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AndU}, #line 463 "src/lexer-keywords.txt" {"table.get", TokenType::TableGet, Opcode::TableGet}, #line 480 "src/lexer-keywords.txt" {"v128.or", TokenType::Binary, Opcode::V128Or}, -#line 318 "src/lexer-keywords.txt" +#line 316 "src/lexer-keywords.txt" {"i64.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I64AtomicRmwAdd}, -#line 205 "src/lexer-keywords.txt" +#line 203 "src/lexer-keywords.txt" {"i32.atomic.rmw.add", TokenType::AtomicRmw, Opcode::I32AtomicRmwAdd}, -#line 348 "src/lexer-keywords.txt" +#line 346 "src/lexer-keywords.txt" {"i64.load16_s", TokenType::Load, Opcode::I64Load16S}, -#line 231 "src/lexer-keywords.txt" +#line 229 "src/lexer-keywords.txt" {"i32.load16_s", TokenType::Load, Opcode::I32Load16S}, {""}, {""}, -#line 349 "src/lexer-keywords.txt" +#line 347 "src/lexer-keywords.txt" {"i64.load16_u", TokenType::Load, Opcode::I64Load16U}, -#line 232 "src/lexer-keywords.txt" +#line 230 "src/lexer-keywords.txt" {"i32.load16_u", TokenType::Load, Opcode::I32Load16U}, {""}, {""}, {""}, {""}, #line 476 "src/lexer-keywords.txt" {"v128.bitselect", TokenType::Ternary, Opcode::V128BitSelect}, {""}, -#line 359 "src/lexer-keywords.txt" +#line 357 "src/lexer-keywords.txt" {"i64.or", TokenType::Binary, Opcode::I64Or}, -#line 240 "src/lexer-keywords.txt" +#line 238 "src/lexer-keywords.txt" {"i32.or", TokenType::Binary, Opcode::I32Or}, -#line 104 "src/lexer-keywords.txt" +#line 102 "src/lexer-keywords.txt" {"f64.convert_i32_u", TokenType::Convert, Opcode::F64ConvertI32U}, -#line 53 "src/lexer-keywords.txt" +#line 51 "src/lexer-keywords.txt" {"f32.convert_i32_u", TokenType::Convert, Opcode::F32ConvertI32U}, {""}, -#line 98 "src/lexer-keywords.txt" +#line 96 "src/lexer-keywords.txt" {"f32x4", TokenType::F32X4}, {""}, {""}, -#line 287 "src/lexer-keywords.txt" +#line 285 "src/lexer-keywords.txt" {"i32x4", TokenType::I32X4}, -#line 155 "src/lexer-keywords.txt" +#line 153 "src/lexer-keywords.txt" {"global", TokenType::Global}, -#line 319 "src/lexer-keywords.txt" +#line 317 "src/lexer-keywords.txt" {"i64.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I64AtomicRmwAnd}, -#line 206 "src/lexer-keywords.txt" +#line 204 "src/lexer-keywords.txt" {"i32.atomic.rmw.and", TokenType::AtomicRmw, Opcode::I32AtomicRmwAnd}, -#line 308 "src/lexer-keywords.txt" +#line 306 "src/lexer-keywords.txt" {"i64.atomic.rmw32.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32SubU}, {""}, #line 18 "src/lexer-keywords.txt" @@ -638,90 +639,90 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 456 "src/lexer-keywords.txt" {"return_call_indirect", TokenType::ReturnCallIndirect, Opcode::ReturnCallIndirect}, {""}, -#line 106 "src/lexer-keywords.txt" +#line 104 "src/lexer-keywords.txt" {"f64.convert_i64_u", TokenType::Convert, Opcode::F64ConvertI64U}, -#line 55 "src/lexer-keywords.txt" +#line 53 "src/lexer-keywords.txt" {"f32.convert_i64_u", TokenType::Convert, Opcode::F32ConvertI64U}, {""}, {""}, -#line 369 "src/lexer-keywords.txt" +#line 367 "src/lexer-keywords.txt" {"i64.store16", TokenType::Store, Opcode::I64Store16}, -#line 250 "src/lexer-keywords.txt" +#line 248 "src/lexer-keywords.txt" {"i32.store16", TokenType::Store, Opcode::I32Store16}, {""}, -#line 311 "src/lexer-keywords.txt" +#line 309 "src/lexer-keywords.txt" {"i64.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8AddU}, -#line 198 "src/lexer-keywords.txt" +#line 196 "src/lexer-keywords.txt" {"i32.atomic.rmw8.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8AddU}, -#line 305 "src/lexer-keywords.txt" +#line 303 "src/lexer-keywords.txt" {"i64.atomic.rmw32.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AndU}, {""}, {""}, {""}, {""}, {""}, -#line 112 "src/lexer-keywords.txt" +#line 110 "src/lexer-keywords.txt" {"f64.gt", TokenType::Compare, Opcode::F64Gt}, -#line 62 "src/lexer-keywords.txt" +#line 60 "src/lexer-keywords.txt" {"f32.gt", TokenType::Compare, Opcode::F32Gt}, {""}, {""}, {""}, {""}, {""}, -#line 154 "src/lexer-keywords.txt" +#line 152 "src/lexer-keywords.txt" {"global.set", TokenType::GlobalSet, Opcode::GlobalSet}, {""}, {""}, {""}, -#line 146 "src/lexer-keywords.txt" +#line 144 "src/lexer-keywords.txt" {"f64x2.splat", TokenType::Unary, Opcode::F64X2Splat}, -#line 111 "src/lexer-keywords.txt" +#line 109 "src/lexer-keywords.txt" {"f64.ge", TokenType::Compare, Opcode::F64Ge}, -#line 61 "src/lexer-keywords.txt" +#line 59 "src/lexer-keywords.txt" {"f32.ge", TokenType::Compare, Opcode::F32Ge}, -#line 393 "src/lexer-keywords.txt" +#line 391 "src/lexer-keywords.txt" {"i64x2.splat", TokenType::Unary, Opcode::I64X2Splat}, {""}, {""}, -#line 344 "src/lexer-keywords.txt" +#line 342 "src/lexer-keywords.txt" {"i64.gt_s", TokenType::Compare, Opcode::I64GtS}, -#line 227 "src/lexer-keywords.txt" +#line 225 "src/lexer-keywords.txt" {"i32.gt_s", TokenType::Compare, Opcode::I32GtS}, {""}, {""}, -#line 345 "src/lexer-keywords.txt" +#line 343 "src/lexer-keywords.txt" {"i64.gt_u", TokenType::Compare, Opcode::I64GtU}, -#line 228 "src/lexer-keywords.txt" +#line 226 "src/lexer-keywords.txt" {"i32.gt_u", TokenType::Compare, Opcode::I32GtU}, -#line 342 "src/lexer-keywords.txt" +#line 340 "src/lexer-keywords.txt" {"i64.ge_s", TokenType::Compare, Opcode::I64GeS}, -#line 225 "src/lexer-keywords.txt" +#line 223 "src/lexer-keywords.txt" {"i32.ge_s", TokenType::Compare, Opcode::I32GeS}, {""}, {""}, -#line 343 "src/lexer-keywords.txt" +#line 341 "src/lexer-keywords.txt" {"i64.ge_u", TokenType::Compare, Opcode::I64GeU}, -#line 226 "src/lexer-keywords.txt" +#line 224 "src/lexer-keywords.txt" {"i32.ge_u", TokenType::Compare, Opcode::I32GeU}, -#line 137 "src/lexer-keywords.txt" +#line 135 "src/lexer-keywords.txt" {"f64x2.gt", TokenType::Compare, Opcode::F64X2Gt}, -#line 439 "src/lexer-keywords.txt" +#line 437 "src/lexer-keywords.txt" {"memory.init", TokenType::MemoryInit, Opcode::MemoryInit}, {""}, #line 444 "src/lexer-keywords.txt" {"nop", TokenType::Nop, Opcode::Nop}, {""}, -#line 93 "src/lexer-keywords.txt" +#line 91 "src/lexer-keywords.txt" {"f32x4.ne", TokenType::Compare, Opcode::F32X4Ne}, -#line 90 "src/lexer-keywords.txt" +#line 88 "src/lexer-keywords.txt" {"f32x4.min", TokenType::Binary, Opcode::F32X4Min}, -#line 304 "src/lexer-keywords.txt" +#line 302 "src/lexer-keywords.txt" {"i64.atomic.rmw32.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32AddU}, -#line 280 "src/lexer-keywords.txt" +#line 278 "src/lexer-keywords.txt" {"i32x4.ne", TokenType::Compare, Opcode::I32X4Ne}, {""}, {""}, -#line 440 "src/lexer-keywords.txt" +#line 438 "src/lexer-keywords.txt" {"memory.size", TokenType::MemorySize, Opcode::MemorySize}, -#line 136 "src/lexer-keywords.txt" +#line 134 "src/lexer-keywords.txt" {"f64x2.ge", TokenType::Compare, Opcode::F64X2Ge}, -#line 325 "src/lexer-keywords.txt" +#line 323 "src/lexer-keywords.txt" {"i64.atomic.store16", TokenType::AtomicStore, Opcode::I64AtomicStore16}, -#line 212 "src/lexer-keywords.txt" +#line 210 "src/lexer-keywords.txt" {"i32.atomic.store16", TokenType::AtomicStore, Opcode::I32AtomicStore16}, -#line 88 "src/lexer-keywords.txt" +#line 86 "src/lexer-keywords.txt" {"f32x4.lt", TokenType::Compare, Opcode::F32X4Lt}, {""}, -#line 431 "src/lexer-keywords.txt" +#line 429 "src/lexer-keywords.txt" {"local.get", TokenType::LocalGet, Opcode::LocalGet}, {""}, {""}, -#line 25 "src/lexer-keywords.txt" +#line 23 "src/lexer-keywords.txt" {"assert_return_func", TokenType::AssertReturnFunc}, #line 515 "src/lexer-keywords.txt" {"i64.trunc_s/f32", TokenType::Convert, Opcode::I64TruncF32S}, @@ -731,24 +732,24 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {"i64.trunc_u/f32", TokenType::Convert, Opcode::I64TruncF32U}, #line 507 "src/lexer-keywords.txt" {"i32.trunc_u/f32", TokenType::Convert, Opcode::I32TruncF32U}, -#line 294 "src/lexer-keywords.txt" +#line 292 "src/lexer-keywords.txt" {"i64.atomic.load32_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad32U}, -#line 276 "src/lexer-keywords.txt" +#line 274 "src/lexer-keywords.txt" {"i32x4.lt_s", TokenType::Compare, Opcode::I32X4LtS}, -#line 87 "src/lexer-keywords.txt" +#line 85 "src/lexer-keywords.txt" {"f32x4.le", TokenType::Compare, Opcode::F32X4Le}, -#line 277 "src/lexer-keywords.txt" +#line 275 "src/lexer-keywords.txt" {"i32x4.lt_u", TokenType::Compare, Opcode::I32X4LtU}, -#line 366 "src/lexer-keywords.txt" +#line 364 "src/lexer-keywords.txt" {"i64.shl", TokenType::Binary, Opcode::I64Shl}, -#line 247 "src/lexer-keywords.txt" +#line 245 "src/lexer-keywords.txt" {"i32.shl", TokenType::Binary, Opcode::I32Shl}, {""}, -#line 273 "src/lexer-keywords.txt" +#line 271 "src/lexer-keywords.txt" {"i32x4.le_s", TokenType::Compare, Opcode::I32X4LeS}, -#line 78 "src/lexer-keywords.txt" +#line 76 "src/lexer-keywords.txt" {"f32x4.abs", TokenType::Unary, Opcode::F32X4Abs}, -#line 274 "src/lexer-keywords.txt" +#line 272 "src/lexer-keywords.txt" {"i32x4.le_u", TokenType::Compare, Opcode::I32X4LeU}, #line 516 "src/lexer-keywords.txt" {"i64.trunc_s/f64", TokenType::Convert, Opcode::I64TruncF64S}, @@ -762,58 +763,58 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 464 "src/lexer-keywords.txt" {"table.grow", TokenType::TableGrow, Opcode::TableGrow}, {""}, -#line 97 "src/lexer-keywords.txt" +#line 95 "src/lexer-keywords.txt" {"f32x4.sub", TokenType::Binary, Opcode::F32X4Sub}, {""}, -#line 306 "src/lexer-keywords.txt" +#line 304 "src/lexer-keywords.txt" {"i64.atomic.rmw32.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw32CmpxchgU}, -#line 286 "src/lexer-keywords.txt" +#line 284 "src/lexer-keywords.txt" {"i32x4.sub", TokenType::Binary, Opcode::I32X4Sub}, #line 482 "src/lexer-keywords.txt" {"v128", Type::V128}, -#line 437 "src/lexer-keywords.txt" +#line 435 "src/lexer-keywords.txt" {"memory.fill", TokenType::MemoryFill, Opcode::MemoryFill}, {""}, -#line 91 "src/lexer-keywords.txt" +#line 89 "src/lexer-keywords.txt" {"f32x4.mul", TokenType::Binary, Opcode::F32X4Mul}, -#line 307 "src/lexer-keywords.txt" +#line 305 "src/lexer-keywords.txt" {"i64.atomic.rmw32.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32OrU}, #line 448 "src/lexer-keywords.txt" {"quote", TokenType::Quote}, -#line 278 "src/lexer-keywords.txt" +#line 276 "src/lexer-keywords.txt" {"i32x4.mul", TokenType::Binary, Opcode::I32X4Mul}, #line 501 "src/lexer-keywords.txt" {"get_local", TokenType::LocalGet, Opcode::LocalGet}, -#line 378 "src/lexer-keywords.txt" +#line 376 "src/lexer-keywords.txt" {"i64.trunc_sat_f32_s", TokenType::Convert, Opcode::I64TruncSatF32S}, -#line 258 "src/lexer-keywords.txt" +#line 256 "src/lexer-keywords.txt" {"i32.trunc_sat_f32_s", TokenType::Convert, Opcode::I32TruncSatF32S}, {""}, -#line 37 "src/lexer-keywords.txt" +#line 35 "src/lexer-keywords.txt" {"catch", TokenType::Catch, Opcode::Catch}, -#line 379 "src/lexer-keywords.txt" +#line 377 "src/lexer-keywords.txt" {"i64.trunc_sat_f32_u", TokenType::Convert, Opcode::I64TruncSatF32U}, -#line 259 "src/lexer-keywords.txt" +#line 257 "src/lexer-keywords.txt" {"i32.trunc_sat_f32_u", TokenType::Convert, Opcode::I32TruncSatF32U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 367 "src/lexer-keywords.txt" +#line 365 "src/lexer-keywords.txt" {"i64.shr_s", TokenType::Binary, Opcode::I64ShrS}, -#line 248 "src/lexer-keywords.txt" +#line 246 "src/lexer-keywords.txt" {"i32.shr_s", TokenType::Binary, Opcode::I32ShrS}, {""}, {""}, -#line 368 "src/lexer-keywords.txt" +#line 366 "src/lexer-keywords.txt" {"i64.shr_u", TokenType::Binary, Opcode::I64ShrU}, -#line 249 "src/lexer-keywords.txt" +#line 247 "src/lexer-keywords.txt" {"i32.shr_u", TokenType::Binary, Opcode::I32ShrU}, {""}, {""}, {""}, -#line 301 "src/lexer-keywords.txt" +#line 299 "src/lexer-keywords.txt" {"i64.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16SubU}, -#line 195 "src/lexer-keywords.txt" +#line 193 "src/lexer-keywords.txt" {"i32.atomic.rmw16.sub_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16SubU}, {""}, {""}, {""}, -#line 32 "src/lexer-keywords.txt" +#line 30 "src/lexer-keywords.txt" {"br_on_exn", TokenType::BrOnExn, Opcode::BrOnExn}, -#line 387 "src/lexer-keywords.txt" +#line 385 "src/lexer-keywords.txt" {"i64x2.load_splat", TokenType::Load, Opcode::I64X2LoadSplat}, {""}, #line 471 "src/lexer-keywords.txt" @@ -821,22 +822,22 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 453 "src/lexer-keywords.txt" {"register", TokenType::Register}, {""}, {""}, {""}, {""}, -#line 298 "src/lexer-keywords.txt" +#line 296 "src/lexer-keywords.txt" {"i64.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AndU}, -#line 192 "src/lexer-keywords.txt" +#line 190 "src/lexer-keywords.txt" {"i32.atomic.rmw16.and_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AndU}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 110 "src/lexer-keywords.txt" +#line 108 "src/lexer-keywords.txt" {"f64.floor", TokenType::Unary, Opcode::F64Floor}, -#line 60 "src/lexer-keywords.txt" +#line 58 "src/lexer-keywords.txt" {"f32.floor", TokenType::Unary, Opcode::F32Floor}, {""}, {""}, {""}, {""}, {""}, {""}, #line 523 "src/lexer-keywords.txt" {"set_global", TokenType::GlobalSet, Opcode::GlobalSet}, {""}, -#line 124 "src/lexer-keywords.txt" +#line 122 "src/lexer-keywords.txt" {"f64.sqrt", TokenType::Unary, Opcode::F64Sqrt}, -#line 73 "src/lexer-keywords.txt" +#line 71 "src/lexer-keywords.txt" {"f32.sqrt", TokenType::Unary, Opcode::F32Sqrt}, {""}, {""}, #line 494 "src/lexer-keywords.txt" @@ -851,99 +852,99 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 449 "src/lexer-keywords.txt" {"ref.func", TokenType::RefFunc, Opcode::RefFunc}, {""}, {""}, {""}, -#line 398 "src/lexer-keywords.txt" +#line 396 "src/lexer-keywords.txt" {"i64.xor", TokenType::Binary, Opcode::I64Xor}, -#line 290 "src/lexer-keywords.txt" +#line 288 "src/lexer-keywords.txt" {"i32.xor", TokenType::Binary, Opcode::I32Xor}, -#line 352 "src/lexer-keywords.txt" +#line 350 "src/lexer-keywords.txt" {"i64.load8_s", TokenType::Load, Opcode::I64Load8S}, -#line 233 "src/lexer-keywords.txt" +#line 231 "src/lexer-keywords.txt" {"i32.load8_s", TokenType::Load, Opcode::I32Load8S}, -#line 313 "src/lexer-keywords.txt" +#line 311 "src/lexer-keywords.txt" {"i64.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw8CmpxchgU}, -#line 200 "src/lexer-keywords.txt" +#line 198 "src/lexer-keywords.txt" {"i32.atomic.rmw8.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw8CmpxchgU}, -#line 353 "src/lexer-keywords.txt" +#line 351 "src/lexer-keywords.txt" {"i64.load8_u", TokenType::Load, Opcode::I64Load8U}, -#line 234 "src/lexer-keywords.txt" +#line 232 "src/lexer-keywords.txt" {"i32.load8_u", TokenType::Load, Opcode::I32Load8U}, -#line 26 "src/lexer-keywords.txt" +#line 24 "src/lexer-keywords.txt" {"assert_trap", TokenType::AssertTrap}, -#line 297 "src/lexer-keywords.txt" +#line 295 "src/lexer-keywords.txt" {"i64.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16AddU}, -#line 191 "src/lexer-keywords.txt" +#line 189 "src/lexer-keywords.txt" {"i32.atomic.rmw16.add_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16AddU}, {""}, {""}, {""}, -#line 371 "src/lexer-keywords.txt" +#line 369 "src/lexer-keywords.txt" {"i64.store8", TokenType::Store, Opcode::I64Store8}, -#line 251 "src/lexer-keywords.txt" +#line 249 "src/lexer-keywords.txt" {"i32.store8", TokenType::Store, Opcode::I32Store8}, {""}, {""}, {""}, -#line 293 "src/lexer-keywords.txt" +#line 291 "src/lexer-keywords.txt" {"i64.atomic.load16_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad16U}, -#line 188 "src/lexer-keywords.txt" +#line 186 "src/lexer-keywords.txt" {"i32.atomic.load16_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad16U}, -#line 79 "src/lexer-keywords.txt" +#line 77 "src/lexer-keywords.txt" {"f32x4.add", TokenType::Binary, Opcode::F32X4Add}, {""}, {""}, -#line 264 "src/lexer-keywords.txt" +#line 262 "src/lexer-keywords.txt" {"i32x4.add", TokenType::Binary, Opcode::I32X4Add}, {""}, -#line 314 "src/lexer-keywords.txt" +#line 312 "src/lexer-keywords.txt" {"i64.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8OrU}, -#line 201 "src/lexer-keywords.txt" +#line 199 "src/lexer-keywords.txt" {"i32.atomic.rmw8.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8OrU}, {""}, {""}, {""}, {""}, -#line 82 "src/lexer-keywords.txt" +#line 80 "src/lexer-keywords.txt" {"f32x4.div", TokenType::Binary, Opcode::F32X4Div}, {""}, {""}, {""}, {""}, {""}, {""}, #line 19 "src/lexer-keywords.txt" {"assert_exhaustion", TokenType::AssertExhaustion}, {""}, -#line 418 "src/lexer-keywords.txt" +#line 416 "src/lexer-keywords.txt" {"i8x16.ne", TokenType::Compare, Opcode::I8X16Ne}, {""}, {""}, -#line 72 "src/lexer-keywords.txt" +#line 70 "src/lexer-keywords.txt" {"f32.reinterpret_i32", TokenType::Convert, Opcode::F32ReinterpretI32}, {""}, -#line 299 "src/lexer-keywords.txt" +#line 297 "src/lexer-keywords.txt" {"i64.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmw16CmpxchgU}, -#line 193 "src/lexer-keywords.txt" +#line 191 "src/lexer-keywords.txt" {"i32.atomic.rmw16.cmpxchg_u", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmw16CmpxchgU}, {""}, -#line 338 "src/lexer-keywords.txt" +#line 336 "src/lexer-keywords.txt" {"i64.extend32_s", TokenType::Unary, Opcode::I64Extend32S}, -#line 120 "src/lexer-keywords.txt" +#line 118 "src/lexer-keywords.txt" {"f64.neg", TokenType::Unary, Opcode::F64Neg}, -#line 70 "src/lexer-keywords.txt" +#line 68 "src/lexer-keywords.txt" {"f32.neg", TokenType::Unary, Opcode::F32Neg}, -#line 300 "src/lexer-keywords.txt" +#line 298 "src/lexer-keywords.txt" {"i64.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16OrU}, -#line 194 "src/lexer-keywords.txt" +#line 192 "src/lexer-keywords.txt" {"i32.atomic.rmw16.or_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16OrU}, {""}, -#line 265 "src/lexer-keywords.txt" +#line 263 "src/lexer-keywords.txt" {"i32x4.all_true", TokenType::Unary, Opcode::I32X4AllTrue}, -#line 123 "src/lexer-keywords.txt" +#line 121 "src/lexer-keywords.txt" {"f64.reinterpret_i64", TokenType::Convert, Opcode::F64ReinterpretI64}, -#line 390 "src/lexer-keywords.txt" +#line 388 "src/lexer-keywords.txt" {"i64x2.shl", TokenType::Binary, Opcode::I64X2Shl}, {""}, -#line 414 "src/lexer-keywords.txt" +#line 412 "src/lexer-keywords.txt" {"i8x16.lt_s", TokenType::Compare, Opcode::I8X16LtS}, -#line 340 "src/lexer-keywords.txt" +#line 338 "src/lexer-keywords.txt" {"i64.extend_i32_s", TokenType::Convert, Opcode::I64ExtendI32S}, -#line 415 "src/lexer-keywords.txt" +#line 413 "src/lexer-keywords.txt" {"i8x16.lt_u", TokenType::Compare, Opcode::I8X16LtU}, {""}, {""}, -#line 341 "src/lexer-keywords.txt" +#line 339 "src/lexer-keywords.txt" {"i64.extend_i32_u", TokenType::Convert, Opcode::I64ExtendI32U}, -#line 411 "src/lexer-keywords.txt" +#line 409 "src/lexer-keywords.txt" {"i8x16.le_s", TokenType::Compare, Opcode::I8X16LeS}, {""}, -#line 412 "src/lexer-keywords.txt" +#line 410 "src/lexer-keywords.txt" {"i8x16.le_u", TokenType::Compare, Opcode::I8X16LeU}, -#line 176 "src/lexer-keywords.txt" +#line 174 "src/lexer-keywords.txt" {"i16x8.ne", TokenType::Compare, Opcode::I16X8Ne}, #line 512 "src/lexer-keywords.txt" {"i64.extend_s/i32", TokenType::Convert, Opcode::I64ExtendI32S}, @@ -954,157 +955,157 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 487 "src/lexer-keywords.txt" {"anyfunc", Type::Funcref}, {""}, {""}, {""}, -#line 426 "src/lexer-keywords.txt" +#line 424 "src/lexer-keywords.txt" {"i8x16.sub", TokenType::Binary, Opcode::I8X16Sub}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 416 "src/lexer-keywords.txt" +#line 414 "src/lexer-keywords.txt" {"i8x16.mul", TokenType::Binary, Opcode::I8X16Mul}, -#line 172 "src/lexer-keywords.txt" +#line 170 "src/lexer-keywords.txt" {"i16x8.lt_s", TokenType::Compare, Opcode::I16X8LtS}, {""}, -#line 173 "src/lexer-keywords.txt" +#line 171 "src/lexer-keywords.txt" {"i16x8.lt_u", TokenType::Compare, Opcode::I16X8LtU}, -#line 391 "src/lexer-keywords.txt" +#line 389 "src/lexer-keywords.txt" {"i64x2.shr_s", TokenType::Binary, Opcode::I64X2ShrS}, {""}, {""}, -#line 169 "src/lexer-keywords.txt" +#line 167 "src/lexer-keywords.txt" {"i16x8.le_s", TokenType::Compare, Opcode::I16X8LeS}, -#line 392 "src/lexer-keywords.txt" +#line 390 "src/lexer-keywords.txt" {"i64x2.shr_u", TokenType::Binary, Opcode::I64X2ShrU}, -#line 170 "src/lexer-keywords.txt" +#line 168 "src/lexer-keywords.txt" {"i16x8.le_u", TokenType::Compare, Opcode::I16X8LeU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 184 "src/lexer-keywords.txt" +#line 182 "src/lexer-keywords.txt" {"i16x8.sub", TokenType::Binary, Opcode::I16X8Sub}, -#line 427 "src/lexer-keywords.txt" +#line 425 "src/lexer-keywords.txt" {"i8x16", TokenType::I8X16}, {""}, -#line 385 "src/lexer-keywords.txt" +#line 383 "src/lexer-keywords.txt" {"i64x2.any_true", TokenType::Unary, Opcode::I64X2AnyTrue}, #line 474 "src/lexer-keywords.txt" {"unreachable", TokenType::Unreachable, Opcode::Unreachable}, -#line 295 "src/lexer-keywords.txt" +#line 293 "src/lexer-keywords.txt" {"i64.atomic.load8_u", TokenType::AtomicLoad, Opcode::I64AtomicLoad8U}, -#line 189 "src/lexer-keywords.txt" +#line 187 "src/lexer-keywords.txt" {"i32.atomic.load8_u", TokenType::AtomicLoad, Opcode::I32AtomicLoad8U}, -#line 174 "src/lexer-keywords.txt" +#line 172 "src/lexer-keywords.txt" {"i16x8.mul", TokenType::Binary, Opcode::I16X8Mul}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 145 "src/lexer-keywords.txt" +#line 143 "src/lexer-keywords.txt" {"f64x2.replace_lane", TokenType::SimdLaneOp, Opcode::F64X2ReplaceLane}, {""}, {""}, -#line 389 "src/lexer-keywords.txt" +#line 387 "src/lexer-keywords.txt" {"i64x2.replace_lane", TokenType::SimdLaneOp, Opcode::I64X2ReplaceLane}, {""}, {""}, {""}, {""}, -#line 147 "src/lexer-keywords.txt" +#line 145 "src/lexer-keywords.txt" {"f64x2.sqrt", TokenType::Unary, Opcode::F64X2Sqrt}, -#line 95 "src/lexer-keywords.txt" +#line 93 "src/lexer-keywords.txt" {"f32x4.splat", TokenType::Unary, Opcode::F32X4Splat}, {""}, {""}, -#line 285 "src/lexer-keywords.txt" +#line 283 "src/lexer-keywords.txt" {"i32x4.splat", TokenType::Unary, Opcode::I32X4Splat}, {""}, -#line 153 "src/lexer-keywords.txt" +#line 151 "src/lexer-keywords.txt" {"global.get", TokenType::GlobalGet, Opcode::GlobalGet}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 336 "src/lexer-keywords.txt" +#line 334 "src/lexer-keywords.txt" {"i64.eqz", TokenType::Convert, Opcode::I64Eqz}, -#line 222 "src/lexer-keywords.txt" +#line 220 "src/lexer-keywords.txt" {"i32.eqz", TokenType::Convert, Opcode::I32Eqz}, {""}, {""}, {""}, {""}, -#line 86 "src/lexer-keywords.txt" +#line 84 "src/lexer-keywords.txt" {"f32x4.gt", TokenType::Compare, Opcode::F32X4Gt}, {""}, {""}, {""}, {""}, -#line 424 "src/lexer-keywords.txt" +#line 422 "src/lexer-keywords.txt" {"i8x16.sub_saturate_s", TokenType::Binary, Opcode::I8X16SubSaturateS}, {""}, -#line 425 "src/lexer-keywords.txt" +#line 423 "src/lexer-keywords.txt" {"i8x16.sub_saturate_u", TokenType::Binary, Opcode::I8X16SubSaturateU}, {""}, {""}, {""}, -#line 271 "src/lexer-keywords.txt" +#line 269 "src/lexer-keywords.txt" {"i32x4.gt_s", TokenType::Compare, Opcode::I32X4GtS}, -#line 85 "src/lexer-keywords.txt" +#line 83 "src/lexer-keywords.txt" {"f32x4.ge", TokenType::Compare, Opcode::F32X4Ge}, -#line 272 "src/lexer-keywords.txt" +#line 270 "src/lexer-keywords.txt" {"i32x4.gt_u", TokenType::Compare, Opcode::I32X4GtU}, #line 493 "src/lexer-keywords.txt" {"f32.reinterpret/i32", TokenType::Convert, Opcode::F32ReinterpretI32}, {""}, {""}, -#line 269 "src/lexer-keywords.txt" +#line 267 "src/lexer-keywords.txt" {"i32x4.ge_s", TokenType::Compare, Opcode::I32X4GeS}, {""}, -#line 270 "src/lexer-keywords.txt" +#line 268 "src/lexer-keywords.txt" {"i32x4.ge_u", TokenType::Compare, Opcode::I32X4GeU}, {""}, {""}, {""}, #line 472 "src/lexer-keywords.txt" {"try", TokenType::Try, Opcode::Try}, -#line 143 "src/lexer-keywords.txt" +#line 141 "src/lexer-keywords.txt" {"f64x2.neg", TokenType::Unary, Opcode::F64X2Neg}, {""}, #line 499 "src/lexer-keywords.txt" {"f64.reinterpret/i64", TokenType::Convert, Opcode::F64ReinterpretI64}, -#line 388 "src/lexer-keywords.txt" +#line 386 "src/lexer-keywords.txt" {"i64x2.neg", TokenType::Unary, Opcode::I64X2Neg}, {""}, {""}, {""}, -#line 401 "src/lexer-keywords.txt" +#line 399 "src/lexer-keywords.txt" {"i8x16.add", TokenType::Binary, Opcode::I8X16Add}, -#line 182 "src/lexer-keywords.txt" +#line 180 "src/lexer-keywords.txt" {"i16x8.sub_saturate_s", TokenType::Binary, Opcode::I16X8SubSaturateS}, {""}, -#line 183 "src/lexer-keywords.txt" +#line 181 "src/lexer-keywords.txt" {"i16x8.sub_saturate_u", TokenType::Binary, Opcode::I16X8SubSaturateU}, - {""}, {""}, {""}, {""}, {""}, -#line 441 "src/lexer-keywords.txt" + {""}, {""}, {""}, +#line 442 "src/lexer-keywords.txt" + {"nan:arithmetic", TokenType::NanArithmetic}, + {""}, +#line 439 "src/lexer-keywords.txt" {"memory", TokenType::Memory}, {""}, -#line 42 "src/lexer-keywords.txt" +#line 40 "src/lexer-keywords.txt" {"elem.drop", TokenType::ElemDrop, Opcode::ElemDrop}, - {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 22 "src/lexer-keywords.txt" - {"assert_return_arithmetic_nan", TokenType::AssertReturnArithmeticNan}, - {""}, -#line 122 "src/lexer-keywords.txt" + {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, +#line 120 "src/lexer-keywords.txt" {"f64.promote_f32", TokenType::Convert, Opcode::F64PromoteF32}, {""}, {""}, -#line 317 "src/lexer-keywords.txt" +#line 315 "src/lexer-keywords.txt" {"i64.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XorU}, -#line 204 "src/lexer-keywords.txt" +#line 202 "src/lexer-keywords.txt" {"i32.atomic.rmw8.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XorU}, {""}, -#line 159 "src/lexer-keywords.txt" +#line 157 "src/lexer-keywords.txt" {"i16x8.add", TokenType::Binary, Opcode::I16X8Add}, {""}, {""}, -#line 29 "src/lexer-keywords.txt" +#line 27 "src/lexer-keywords.txt" {"binary", TokenType::Bin}, -#line 402 "src/lexer-keywords.txt" +#line 400 "src/lexer-keywords.txt" {"i8x16.all_true", TokenType::Unary, Opcode::I8X16AllTrue}, {""}, {""}, {""}, {""}, {""}, -#line 380 "src/lexer-keywords.txt" +#line 378 "src/lexer-keywords.txt" {"i64.trunc_sat_f64_s", TokenType::Convert, Opcode::I64TruncSatF64S}, -#line 260 "src/lexer-keywords.txt" +#line 258 "src/lexer-keywords.txt" {"i32.trunc_sat_f64_s", TokenType::Convert, Opcode::I32TruncSatF64S}, {""}, {""}, -#line 381 "src/lexer-keywords.txt" +#line 379 "src/lexer-keywords.txt" {"i64.trunc_sat_f64_u", TokenType::Convert, Opcode::I64TruncSatF64U}, -#line 261 "src/lexer-keywords.txt" +#line 259 "src/lexer-keywords.txt" {"i32.trunc_sat_f64_u", TokenType::Convert, Opcode::I32TruncSatF64U}, -#line 39 "src/lexer-keywords.txt" +#line 37 "src/lexer-keywords.txt" {"data.drop", TokenType::DataDrop, Opcode::DataDrop}, {""}, {""}, {""}, {""}, {""}, #line 462 "src/lexer-keywords.txt" {"table.copy", TokenType::TableCopy, Opcode::TableCopy}, {""}, -#line 275 "src/lexer-keywords.txt" +#line 273 "src/lexer-keywords.txt" {"i32x4.load_splat", TokenType::Load, Opcode::I32X4LoadSplat}, {""}, -#line 399 "src/lexer-keywords.txt" +#line 397 "src/lexer-keywords.txt" {"i8x16.add_saturate_s", TokenType::Binary, Opcode::I8X16AddSaturateS}, {""}, -#line 400 "src/lexer-keywords.txt" +#line 398 "src/lexer-keywords.txt" {"i8x16.add_saturate_u", TokenType::Binary, Opcode::I8X16AddSaturateU}, {""}, {""}, -#line 160 "src/lexer-keywords.txt" +#line 158 "src/lexer-keywords.txt" {"i16x8.all_true", TokenType::Unary, Opcode::I16X8AllTrue}, #line 483 "src/lexer-keywords.txt" {"v128.xor", TokenType::Binary, Opcode::V128Xor}, @@ -1118,14 +1119,14 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 509 "src/lexer-keywords.txt" {"i32.trunc_u:sat/f32", TokenType::Convert, Opcode::I32TruncSatF32U}, {""}, {""}, {""}, {""}, -#line 135 "src/lexer-keywords.txt" +#line 133 "src/lexer-keywords.txt" {"f64x2.extract_lane", TokenType::SimdLaneOp, Opcode::F64X2ExtractLane}, {""}, -#line 396 "src/lexer-keywords.txt" +#line 394 "src/lexer-keywords.txt" {"i64x2.trunc_sat_f64x2_s", TokenType::Unary, Opcode::I64X2TruncSatF64X2S}, -#line 386 "src/lexer-keywords.txt" +#line 384 "src/lexer-keywords.txt" {"i64x2.extract_lane", TokenType::SimdLaneOp, Opcode::I64X2ExtractLane}, -#line 397 "src/lexer-keywords.txt" +#line 395 "src/lexer-keywords.txt" {"i64x2.trunc_sat_f64x2_u", TokenType::Unary, Opcode::I64X2TruncSatF64X2U}, #line 518 "src/lexer-keywords.txt" {"i64.trunc_s:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64S}, @@ -1135,21 +1136,21 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {"i64.trunc_u:sat/f64", TokenType::Convert, Opcode::I64TruncSatF64U}, #line 510 "src/lexer-keywords.txt" {"i32.trunc_u:sat/f64", TokenType::Convert, Opcode::I32TruncSatF64U}, -#line 157 "src/lexer-keywords.txt" +#line 155 "src/lexer-keywords.txt" {"i16x8.add_saturate_s", TokenType::Binary, Opcode::I16X8AddSaturateS}, {""}, -#line 158 "src/lexer-keywords.txt" +#line 156 "src/lexer-keywords.txt" {"i16x8.add_saturate_u", TokenType::Binary, Opcode::I16X8AddSaturateU}, {""}, #line 500 "src/lexer-keywords.txt" {"get_global", TokenType::GlobalGet, Opcode::GlobalGet}, {""}, -#line 438 "src/lexer-keywords.txt" +#line 436 "src/lexer-keywords.txt" {"memory.grow", TokenType::MemoryGrow, Opcode::MemoryGrow}, {""}, {""}, {""}, -#line 360 "src/lexer-keywords.txt" +#line 358 "src/lexer-keywords.txt" {"i64.popcnt", TokenType::Unary, Opcode::I64Popcnt}, -#line 241 "src/lexer-keywords.txt" +#line 239 "src/lexer-keywords.txt" {"i32.popcnt", TokenType::Unary, Opcode::I32Popcnt}, {""}, {""}, #line 495 "src/lexer-keywords.txt" @@ -1164,125 +1165,125 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 484 "src/lexer-keywords.txt" {"v8x16.swizzle", TokenType::Binary, Opcode::V8X16Swizzle}, {""}, {""}, -#line 310 "src/lexer-keywords.txt" +#line 308 "src/lexer-keywords.txt" {"i64.atomic.rmw32.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XorU}, {""}, {""}, -#line 423 "src/lexer-keywords.txt" +#line 421 "src/lexer-keywords.txt" {"i8x16.splat", TokenType::Unary, Opcode::I8X16Splat}, {""}, {""}, {""}, -#line 337 "src/lexer-keywords.txt" +#line 335 "src/lexer-keywords.txt" {"i64.extend16_s", TokenType::Unary, Opcode::I64Extend16S}, -#line 223 "src/lexer-keywords.txt" +#line 221 "src/lexer-keywords.txt" {"i32.extend16_s", TokenType::Unary, Opcode::I32Extend16S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 242 "src/lexer-keywords.txt" +#line 240 "src/lexer-keywords.txt" {"i32.reinterpret_f32", TokenType::Convert, Opcode::I32ReinterpretF32}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 409 "src/lexer-keywords.txt" +#line 407 "src/lexer-keywords.txt" {"i8x16.gt_s", TokenType::Compare, Opcode::I8X16GtS}, -#line 181 "src/lexer-keywords.txt" +#line 179 "src/lexer-keywords.txt" {"i16x8.splat", TokenType::Unary, Opcode::I16X8Splat}, -#line 410 "src/lexer-keywords.txt" +#line 408 "src/lexer-keywords.txt" {"i8x16.gt_u", TokenType::Compare, Opcode::I8X16GtU}, -#line 361 "src/lexer-keywords.txt" +#line 359 "src/lexer-keywords.txt" {"i64.reinterpret_f64", TokenType::Convert, Opcode::I64ReinterpretF64}, #line 498 "src/lexer-keywords.txt" {"f64.promote/f32", TokenType::Convert, Opcode::F64PromoteF32}, {""}, -#line 407 "src/lexer-keywords.txt" +#line 405 "src/lexer-keywords.txt" {"i8x16.ge_s", TokenType::Compare, Opcode::I8X16GeS}, {""}, -#line 408 "src/lexer-keywords.txt" +#line 406 "src/lexer-keywords.txt" {"i8x16.ge_u", TokenType::Compare, Opcode::I8X16GeU}, {""}, {""}, {""}, {""}, -#line 282 "src/lexer-keywords.txt" +#line 280 "src/lexer-keywords.txt" {"i32x4.shl", TokenType::Binary, Opcode::I32X4Shl}, -#line 116 "src/lexer-keywords.txt" +#line 114 "src/lexer-keywords.txt" {"f64.max", TokenType::Binary, Opcode::F64Max}, -#line 66 "src/lexer-keywords.txt" +#line 64 "src/lexer-keywords.txt" {"f32.max", TokenType::Binary, Opcode::F32Max}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 167 "src/lexer-keywords.txt" +#line 165 "src/lexer-keywords.txt" {"i16x8.gt_s", TokenType::Compare, Opcode::I16X8GtS}, {""}, -#line 168 "src/lexer-keywords.txt" +#line 166 "src/lexer-keywords.txt" {"i16x8.gt_u", TokenType::Compare, Opcode::I16X8GtU}, {""}, {""}, -#line 309 "src/lexer-keywords.txt" +#line 307 "src/lexer-keywords.txt" {"i64.atomic.rmw32.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw32XchgU}, -#line 165 "src/lexer-keywords.txt" +#line 163 "src/lexer-keywords.txt" {"i16x8.ge_s", TokenType::Compare, Opcode::I16X8GeS}, {""}, -#line 166 "src/lexer-keywords.txt" +#line 164 "src/lexer-keywords.txt" {"i16x8.ge_u", TokenType::Compare, Opcode::I16X8GeU}, -#line 263 "src/lexer-keywords.txt" +#line 261 "src/lexer-keywords.txt" {"i32.wrap_i64", TokenType::Convert, Opcode::I32WrapI64}, -#line 109 "src/lexer-keywords.txt" +#line 107 "src/lexer-keywords.txt" {"f64.eq", TokenType::Compare, Opcode::F64Eq}, -#line 59 "src/lexer-keywords.txt" +#line 57 "src/lexer-keywords.txt" {"f32.eq", TokenType::Compare, Opcode::F32Eq}, {""}, -#line 335 "src/lexer-keywords.txt" +#line 333 "src/lexer-keywords.txt" {"i64.eq", TokenType::Compare, Opcode::I64Eq}, -#line 221 "src/lexer-keywords.txt" +#line 219 "src/lexer-keywords.txt" {"i32.eq", TokenType::Compare, Opcode::I32Eq}, {""}, {""}, {""}, -#line 283 "src/lexer-keywords.txt" +#line 281 "src/lexer-keywords.txt" {"i32x4.shr_s", TokenType::Binary, Opcode::I32X4ShrS}, {""}, {""}, {""}, -#line 284 "src/lexer-keywords.txt" +#line 282 "src/lexer-keywords.txt" {"i32x4.shr_u", TokenType::Binary, Opcode::I32X4ShrU}, -#line 339 "src/lexer-keywords.txt" +#line 337 "src/lexer-keywords.txt" {"i64.extend8_s", TokenType::Unary, Opcode::I64Extend8S}, -#line 224 "src/lexer-keywords.txt" +#line 222 "src/lexer-keywords.txt" {"i32.extend8_s", TokenType::Unary, Opcode::I32Extend8S}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 266 "src/lexer-keywords.txt" +#line 264 "src/lexer-keywords.txt" {"i32x4.any_true", TokenType::Unary, Opcode::I32X4AnyTrue}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 413 "src/lexer-keywords.txt" +#line 411 "src/lexer-keywords.txt" {"i8x16.load_splat", TokenType::Load, Opcode::I8X16LoadSplat}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 94 "src/lexer-keywords.txt" +#line 92 "src/lexer-keywords.txt" {"f32x4.replace_lane", TokenType::SimdLaneOp, Opcode::F32X4ReplaceLane}, {""}, {""}, -#line 281 "src/lexer-keywords.txt" +#line 279 "src/lexer-keywords.txt" {"i32x4.replace_lane", TokenType::SimdLaneOp, Opcode::I32X4ReplaceLane}, {""}, {""}, {""}, {""}, -#line 96 "src/lexer-keywords.txt" +#line 94 "src/lexer-keywords.txt" {"f32x4.sqrt", TokenType::Unary, Opcode::F32X4Sqrt}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 303 "src/lexer-keywords.txt" +#line 301 "src/lexer-keywords.txt" {"i64.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XorU}, -#line 197 "src/lexer-keywords.txt" +#line 195 "src/lexer-keywords.txt" {"i32.atomic.rmw16.xor_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XorU}, -#line 171 "src/lexer-keywords.txt" +#line 169 "src/lexer-keywords.txt" {"i16x8.load_splat", TokenType::Load, Opcode::I16X8LoadSplat}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, #line 502 "src/lexer-keywords.txt" {"i32.reinterpret/f32", TokenType::Convert, Opcode::I32ReinterpretF32}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 107 "src/lexer-keywords.txt" +#line 105 "src/lexer-keywords.txt" {"f64.copysign", TokenType::Binary, Opcode::F64Copysign}, -#line 56 "src/lexer-keywords.txt" +#line 54 "src/lexer-keywords.txt" {"f32.copysign", TokenType::Binary, Opcode::F32Copysign}, {""}, #line 514 "src/lexer-keywords.txt" {"i64.reinterpret/f64", TokenType::Convert, Opcode::I64ReinterpretF64}, {""}, {""}, {""}, {""}, -#line 185 "src/lexer-keywords.txt" +#line 183 "src/lexer-keywords.txt" {"i16x8", TokenType::I16X8}, {""}, -#line 92 "src/lexer-keywords.txt" +#line 90 "src/lexer-keywords.txt" {"f32x4.neg", TokenType::Unary, Opcode::F32X4Neg}, -#line 28 "src/lexer-keywords.txt" +#line 26 "src/lexer-keywords.txt" {"atomic.notify", TokenType::AtomicNotify, Opcode::AtomicNotify}, {""}, -#line 279 "src/lexer-keywords.txt" +#line 277 "src/lexer-keywords.txt" {"i32x4.neg", TokenType::Unary, Opcode::I32X4Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1290,87 +1291,87 @@ Perfect_Hash::InWordSet (const char *str, size_t len) #line 511 "src/lexer-keywords.txt" {"i32.wrap/i64", TokenType::Convert, Opcode::I32WrapI64}, {""}, -#line 302 "src/lexer-keywords.txt" +#line 300 "src/lexer-keywords.txt" {"i64.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw16XchgU}, -#line 196 "src/lexer-keywords.txt" +#line 194 "src/lexer-keywords.txt" {"i32.atomic.rmw16.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw16XchgU}, {""}, {""}, {""}, {""}, {""}, -#line 140 "src/lexer-keywords.txt" +#line 138 "src/lexer-keywords.txt" {"f64x2.max", TokenType::Binary, Opcode::F64X2Max}, {""}, {""}, {""}, {""}, -#line 420 "src/lexer-keywords.txt" +#line 418 "src/lexer-keywords.txt" {"i8x16.shl", TokenType::Binary, Opcode::I8X16Shl}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 324 "src/lexer-keywords.txt" +#line 322 "src/lexer-keywords.txt" {"i64.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I64AtomicRmwXor}, -#line 211 "src/lexer-keywords.txt" +#line 209 "src/lexer-keywords.txt" {"i32.atomic.rmw.xor", TokenType::AtomicRmw, Opcode::I32AtomicRmwXor}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 38 "src/lexer-keywords.txt" +#line 36 "src/lexer-keywords.txt" {"current_memory", TokenType::MemorySize, Opcode::MemorySize}, -#line 327 "src/lexer-keywords.txt" +#line 325 "src/lexer-keywords.txt" {"i64.atomic.store8", TokenType::AtomicStore, Opcode::I64AtomicStore8}, -#line 213 "src/lexer-keywords.txt" +#line 211 "src/lexer-keywords.txt" {"i32.atomic.store8", TokenType::AtomicStore, Opcode::I32AtomicStore8}, {""}, {""}, -#line 134 "src/lexer-keywords.txt" +#line 132 "src/lexer-keywords.txt" {"f64x2.eq", TokenType::Compare, Opcode::F64X2Eq}, -#line 288 "src/lexer-keywords.txt" +#line 286 "src/lexer-keywords.txt" {"i32x4.trunc_sat_f32x4_s", TokenType::Unary, Opcode::I32X4TruncSatF32X4S}, -#line 178 "src/lexer-keywords.txt" +#line 176 "src/lexer-keywords.txt" {"i16x8.shl", TokenType::Binary, Opcode::I16X8Shl}, -#line 289 "src/lexer-keywords.txt" +#line 287 "src/lexer-keywords.txt" {"i32x4.trunc_sat_f32x4_u", TokenType::Unary, Opcode::I32X4TruncSatF32X4U}, {""}, {""}, {""}, -#line 421 "src/lexer-keywords.txt" +#line 419 "src/lexer-keywords.txt" {"i8x16.shr_s", TokenType::Binary, Opcode::I8X16ShrS}, {""}, {""}, {""}, -#line 422 "src/lexer-keywords.txt" +#line 420 "src/lexer-keywords.txt" {"i8x16.shr_u", TokenType::Binary, Opcode::I8X16ShrU}, {""}, -#line 84 "src/lexer-keywords.txt" +#line 82 "src/lexer-keywords.txt" {"f32x4.extract_lane", TokenType::SimdLaneOp, Opcode::F32X4ExtractLane}, {""}, {""}, -#line 268 "src/lexer-keywords.txt" +#line 266 "src/lexer-keywords.txt" {"i32x4.extract_lane", TokenType::SimdLaneOp, Opcode::I32X4ExtractLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 403 "src/lexer-keywords.txt" +#line 401 "src/lexer-keywords.txt" {"i8x16.any_true", TokenType::Unary, Opcode::I8X16AnyTrue}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 179 "src/lexer-keywords.txt" +#line 177 "src/lexer-keywords.txt" {"i16x8.shr_s", TokenType::Binary, Opcode::I16X8ShrS}, {""}, {""}, {""}, -#line 180 "src/lexer-keywords.txt" +#line 178 "src/lexer-keywords.txt" {"i16x8.shr_u", TokenType::Binary, Opcode::I16X8ShrU}, #line 485 "src/lexer-keywords.txt" {"v8x16.shuffle", TokenType::SimdShuffleOp, Opcode::V8X16Shuffle}, {""}, {""}, {""}, -#line 419 "src/lexer-keywords.txt" +#line 417 "src/lexer-keywords.txt" {"i8x16.replace_lane", TokenType::SimdLaneOp, Opcode::I8X16ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 161 "src/lexer-keywords.txt" +#line 159 "src/lexer-keywords.txt" {"i16x8.any_true", TokenType::Unary, Opcode::I16X8AnyTrue}, {""}, {""}, -#line 156 "src/lexer-keywords.txt" +#line 154 "src/lexer-keywords.txt" {"grow_memory", TokenType::MemoryGrow, Opcode::MemoryGrow}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 177 "src/lexer-keywords.txt" +#line 175 "src/lexer-keywords.txt" {"i16x8.replace_lane", TokenType::SimdLaneOp, Opcode::I16X8ReplaceLane}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 316 "src/lexer-keywords.txt" +#line 314 "src/lexer-keywords.txt" {"i64.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I64AtomicRmw8XchgU}, -#line 203 "src/lexer-keywords.txt" +#line 201 "src/lexer-keywords.txt" {"i32.atomic.rmw8.xchg_u", TokenType::AtomicRmw, Opcode::I32AtomicRmw8XchgU}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 417 "src/lexer-keywords.txt" +#line 415 "src/lexer-keywords.txt" {"i8x16.neg", TokenType::Unary, Opcode::I8X16Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 175 "src/lexer-keywords.txt" +#line 173 "src/lexer-keywords.txt" {"i16x8.neg", TokenType::Unary, Opcode::I16X8Neg}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1378,53 +1379,53 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 405 "src/lexer-keywords.txt" +#line 403 "src/lexer-keywords.txt" {"i8x16.extract_lane_s", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneS}, {""}, -#line 406 "src/lexer-keywords.txt" +#line 404 "src/lexer-keywords.txt" {"i8x16.extract_lane_u", TokenType::SimdLaneOp, Opcode::I8X16ExtractLaneU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 163 "src/lexer-keywords.txt" +#line 161 "src/lexer-keywords.txt" {"i16x8.extract_lane_s", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneS}, {""}, -#line 164 "src/lexer-keywords.txt" +#line 162 "src/lexer-keywords.txt" {"i16x8.extract_lane_u", TokenType::SimdLaneOp, Opcode::I16X8ExtractLaneU}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 320 "src/lexer-keywords.txt" +#line 318 "src/lexer-keywords.txt" {"i64.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I64AtomicRmwCmpxchg}, -#line 207 "src/lexer-keywords.txt" +#line 205 "src/lexer-keywords.txt" {"i32.atomic.rmw.cmpxchg", TokenType::AtomicRmwCmpxchg, Opcode::I32AtomicRmwCmpxchg}, {""}, -#line 436 "src/lexer-keywords.txt" +#line 434 "src/lexer-keywords.txt" {"memory.copy", TokenType::MemoryCopy, Opcode::MemoryCopy}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 89 "src/lexer-keywords.txt" +#line 87 "src/lexer-keywords.txt" {"f32x4.max", TokenType::Binary, Opcode::F32X4Max}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 83 "src/lexer-keywords.txt" +#line 81 "src/lexer-keywords.txt" {"f32x4.eq", TokenType::Compare, Opcode::F32X4Eq}, {""}, {""}, -#line 267 "src/lexer-keywords.txt" +#line 265 "src/lexer-keywords.txt" {"i32x4.eq", TokenType::Compare, Opcode::I32X4Eq}, {""}, {""}, -#line 80 "src/lexer-keywords.txt" +#line 78 "src/lexer-keywords.txt" {"f32x4.convert_i32x4_s", TokenType::Unary, Opcode::F32X4ConvertI32X4S}, {""}, -#line 81 "src/lexer-keywords.txt" +#line 79 "src/lexer-keywords.txt" {"f32x4.convert_i32x4_u", TokenType::Unary, Opcode::F32X4ConvertI32X4U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 131 "src/lexer-keywords.txt" +#line 129 "src/lexer-keywords.txt" {"f64x2.convert_i64x2_s", TokenType::Unary, Opcode::F64X2ConvertI64X2S}, {""}, -#line 132 "src/lexer-keywords.txt" +#line 130 "src/lexer-keywords.txt" {"f64x2.convert_i64x2_u", TokenType::Unary, Opcode::F64X2ConvertI64X2U}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1441,12 +1442,12 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 404 "src/lexer-keywords.txt" +#line 402 "src/lexer-keywords.txt" {"i8x16.eq", TokenType::Compare, Opcode::I8X16Eq}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 162 "src/lexer-keywords.txt" +#line 160 "src/lexer-keywords.txt" {"i16x8.eq", TokenType::Compare, Opcode::I16X8Eq}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, @@ -1468,9 +1469,9 @@ Perfect_Hash::InWordSet (const char *str, size_t len) {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, -#line 323 "src/lexer-keywords.txt" +#line 321 "src/lexer-keywords.txt" {"i64.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I64AtomicRmwXchg}, -#line 210 "src/lexer-keywords.txt" +#line 208 "src/lexer-keywords.txt" {"i32.atomic.rmw.xchg", TokenType::AtomicRmw, Opcode::I32AtomicRmwXchg} }; diff --git a/src/resolve-names.cc b/src/resolve-names.cc index 0e81cad1..6210c1bf 100644 --- a/src/resolve-names.cc +++ b/src/resolve-names.cc @@ -515,8 +515,6 @@ void NameResolver::VisitCommand(Command* command) { case CommandType::Action: case CommandType::AssertReturn: case CommandType::AssertReturnFunc: - case CommandType::AssertReturnCanonicalNan: - case CommandType::AssertReturnArithmeticNan: case CommandType::AssertTrap: case CommandType::AssertExhaustion: case CommandType::Register: diff --git a/src/token.def b/src/token.def index 87c4749c..54f68564 100644 --- a/src/token.def +++ b/src/token.def @@ -25,8 +25,6 @@ WABT_TOKEN(AssertInvalid, "assert_invalid") WABT_TOKEN(AssertMalformed, "assert_malformed") WABT_TOKEN(AssertReturn, "assert_return") WABT_TOKEN(AssertReturnFunc, "assert_return_func") -WABT_TOKEN(AssertReturnArithmeticNan, "assert_return_arithmetic_nan") -WABT_TOKEN(AssertReturnCanonicalNan, "assert_return_canonical_nan") WABT_TOKEN(AssertTrap, "assert_trap") WABT_TOKEN(AssertUnlinkable, "assert_unlinkable") WABT_TOKEN(Bin, "bin") @@ -45,6 +43,8 @@ WABT_TOKEN(Lpar, "(") WABT_TOKEN(Memory, "memory") WABT_TOKEN(Module, "module") WABT_TOKEN(Mut, "mut") +WABT_TOKEN(NanArithmetic, "nan:arithmetic") +WABT_TOKEN(NanCanonical, "nan:canonical") WABT_TOKEN(Offset, "offset") WABT_TOKEN(Param, "param") WABT_TOKEN(Quote, "quote") diff --git a/src/tools/spectest-interp.cc b/src/tools/spectest-interp.cc index 57f9e855..f335e572 100644 --- a/src/tools/spectest-interp.cc +++ b/src/tools/spectest-interp.cc @@ -150,10 +150,6 @@ class ActionCommandBase : public CommandMixin<TypeEnum> { }; typedef ActionCommandBase<CommandType::Action> ActionCommand; -typedef ActionCommandBase<CommandType::AssertReturnCanonicalNan> - AssertReturnCanonicalNanCommand; -typedef ActionCommandBase<CommandType::AssertReturnArithmeticNan> - AssertReturnArithmeticNanCommand; class RegisterCommand : public CommandMixin<CommandType::Register> { public: @@ -161,10 +157,16 @@ class RegisterCommand : public CommandMixin<CommandType::Register> { std::string name; }; +struct ExpectedValue { + bool is_expected_nan; + TypedValue value; + ExpectedNan expectedNan; +}; + class AssertReturnCommand : public CommandMixin<CommandType::AssertReturn> { public: Action action; - TypedValues expected; + std::vector<ExpectedValue> expected; }; class AssertReturnFuncCommand @@ -226,7 +228,12 @@ class JSONParser { wabt::Result ParseTypeObject(Type* out_type); wabt::Result ParseTypeVector(TypeVector* out_types); wabt::Result ParseConst(TypedValue* out_value); + wabt::Result ParseConstValue(TypedValue* out_value, + string_view type_str, + string_view value_str); wabt::Result ParseConstVector(TypedValues* out_values); + wabt::Result ParseExpectedValue(ExpectedValue* out_value); + wabt::Result ParseExpectedValues(std::vector<ExpectedValue>* out_values); wabt::Result ParseAction(Action* out_action); wabt::Result ParseActionResult(); wabt::Result ParseModuleType(ModuleType* out_type); @@ -496,9 +503,14 @@ wabt::Result JSONParser::ParseConst(TypedValue* out_value) { PARSE_KEY_STRING_VALUE("value", &value_str); EXPECT("}"); + return ParseConstValue(out_value, type_str, value_str); +} + +wabt::Result JSONParser::ParseConstValue(TypedValue* out_value, + string_view type_str, + string_view value_str) { const char* value_start = value_str.data(); const char* value_end = value_str.data() + value_str.size(); - if (type_str == "i32") { uint32_t value; if (Failed((ParseInt32(value_start, value_end, &value, @@ -564,13 +576,56 @@ wabt::Result JSONParser::ParseConst(TypedValue* out_value) { out_value->type = Type::Funcref; out_value->value.ref = {RefType::Func, value}; } else { - PrintError("unknown concrete type: \"%s\"", type_str.c_str()); + PrintError("unknown concrete type: \"%s\"", type_str.to_string().c_str()); return wabt::Result::Error; } return wabt::Result::Ok; } +wabt::Result JSONParser::ParseExpectedValue(ExpectedValue* out_value) { + std::string type_str; + std::string value_str; + EXPECT("{"); + PARSE_KEY_STRING_VALUE("type", &type_str); + EXPECT(","); + PARSE_KEY_STRING_VALUE("value", &value_str); + EXPECT("}"); + + if (type_str == "f32" || type_str == "f64") { + if (value_str == "nan:canonical") { + out_value->value.type = type_str == "f32" ? Type::F32 : Type::F64; + out_value->is_expected_nan = true; + out_value->expectedNan = ExpectedNan::Canonical; + return wabt::Result::Ok; + } else if (value_str == "nan:arithmetic") { + out_value->value.type = type_str == "f32" ? Type::F32 : Type::F64; + out_value->is_expected_nan = true; + out_value->expectedNan = ExpectedNan::Arithmetic; + return wabt::Result::Ok; + } + } + + out_value->is_expected_nan = false; + return ParseConstValue(&out_value->value, type_str, value_str); +} + +wabt::Result JSONParser::ParseExpectedValues(std::vector<ExpectedValue>* out_values) { + out_values->clear(); + EXPECT("["); + bool first = true; + while (!Match("]")) { + if (!first) { + EXPECT(","); + } + ExpectedValue value; + CHECK_RESULT(ParseExpectedValue(&value)); + out_values->push_back(value); + first = false; + } + return wabt::Result::Ok; +} + wabt::Result JSONParser::ParseConstVector(TypedValues* out_values) { out_values->clear(); EXPECT("["); @@ -759,7 +814,7 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) { CHECK_RESULT(ParseAction(&command->action)); EXPECT(","); EXPECT_KEY("expected"); - CHECK_RESULT(ParseConstVector(&command->expected)); + CHECK_RESULT(ParseExpectedValues(&command->expected)); *out_command = std::move(command); } else if (Match("\"assert_return_func\"")) { auto command = MakeUnique<AssertReturnFuncCommand>(); @@ -768,24 +823,6 @@ wabt::Result JSONParser::ParseCommand(CommandPtr* out_command) { EXPECT(","); CHECK_RESULT(ParseAction(&command->action)); *out_command = std::move(command); - } else if (Match("\"assert_return_canonical_nan\"")) { - auto command = MakeUnique<AssertReturnCanonicalNanCommand>(); - EXPECT(","); - CHECK_RESULT(ParseLine(&command->line)); - EXPECT(","); - CHECK_RESULT(ParseAction(&command->action)); - EXPECT(","); - CHECK_RESULT(ParseActionResult()); - *out_command = std::move(command); - } else if (Match("\"assert_return_arithmetic_nan\"")) { - auto command = MakeUnique<AssertReturnArithmeticNanCommand>(); - EXPECT(","); - CHECK_RESULT(ParseLine(&command->line)); - EXPECT(","); - CHECK_RESULT(ParseAction(&command->action)); - EXPECT(","); - CHECK_RESULT(ParseActionResult()); - *out_command = std::move(command); } else if (Match("\"assert_trap\"")) { auto command = MakeUnique<AssertTrapCommand>(); EXPECT(","); @@ -862,8 +899,6 @@ class CommandRunner { const AssertUninstantiableCommand*); wabt::Result OnAssertReturnCommand(const AssertReturnCommand*); wabt::Result OnAssertReturnFuncCommand(const AssertReturnFuncCommand*); - template <typename NanCommand> - wabt::Result OnAssertReturnNanCommand(const NanCommand*); wabt::Result OnAssertTrapCommand(const AssertTrapCommand*); wabt::Result OnAssertExhaustionCommand(const AssertExhaustionCommand*); @@ -974,16 +1009,6 @@ wabt::Result CommandRunner::Run(const Script& script) { OnAssertReturnFuncCommand(cast<AssertReturnFuncCommand>(command.get()))); break; - case CommandType::AssertReturnCanonicalNan: - TallyCommand(OnAssertReturnNanCommand( - cast<AssertReturnCanonicalNanCommand>(command.get()))); - break; - - case CommandType::AssertReturnArithmeticNan: - TallyCommand(OnAssertReturnNanCommand( - cast<AssertReturnArithmeticNanCommand>(command.get()))); - break; - case CommandType::AssertTrap: TallyCommand( OnAssertTrapCommand(cast<AssertTrapCommand>(command.get()))); @@ -1364,73 +1389,43 @@ wabt::Result CommandRunner::OnAssertReturnCommand( wabt::Result result = wabt::Result::Ok; for (size_t i = 0; i < exec_result.values.size(); ++i) { - const TypedValue& expected_tv = command->expected[i]; - const TypedValue& actual_tv = exec_result.values[i]; - if (!TypedValuesAreEqual(expected_tv, actual_tv)) { - PrintError(command->line, - "mismatch in result %" PRIzd - " of assert_return: expected %s, got %s", - i, TypedValueToString(expected_tv).c_str(), - TypedValueToString(actual_tv).c_str()); - result = wabt::Result::Error; - } - } - - return result; -} - -template <typename NanCommand> -wabt::Result CommandRunner::OnAssertReturnNanCommand( - const NanCommand* command) { - ExecResult exec_result = - RunAction(command->line, &command->action, RunVerbosity::Quiet); - - if (!exec_result.ok()) { - PrintError(command->line, "unexpected trap: %s", - ResultToString(exec_result.result).c_str()); - return wabt::Result::Error; - } - - if (exec_result.values.size() != 1) { - PrintError(command->line, "expected one result, got %" PRIzd, - exec_result.values.size()); - return wabt::Result::Error; - } - - const bool is_canonical = - command->type == CommandType::AssertReturnCanonicalNan; - - const TypedValue& actual = exec_result.values[0]; - switch (actual.type) { - case Type::F32: { - bool is_nan = is_canonical ? IsCanonicalNan(actual.value.f32_bits) - : IsArithmeticNan(actual.value.f32_bits); + const ExpectedValue& expected = command->expected[i]; + const TypedValue& actual = exec_result.values[i]; + if (expected.is_expected_nan) { + bool is_nan; + if (expected.expectedNan == ExpectedNan::Arithmetic) { + if (expected.value.type == Type::F64) { + is_nan = IsArithmeticNan(actual.value.f64_bits); + } else { + is_nan = IsArithmeticNan(actual.value.f32_bits); + } + } else if (expected.expectedNan == ExpectedNan::Canonical) { + if (expected.value.type == Type::F64) { + is_nan = IsCanonicalNan(actual.value.f64_bits); + } else { + is_nan = IsCanonicalNan(actual.value.f32_bits); + } + } else { + WABT_UNREACHABLE; + } if (!is_nan) { PrintError(command->line, "expected result to be nan, got %s", TypedValueToString(actual).c_str()); - return wabt::Result::Error; + result = wabt::Result::Error; } - break; - } - - case Type::F64: { - bool is_nan = is_canonical ? IsCanonicalNan(actual.value.f64_bits) - : IsArithmeticNan(actual.value.f64_bits); - if (!is_nan) { - PrintError(command->line, "expected result to be nan, got %s", + } else { + if (!TypedValuesAreEqual(expected.value, actual)) { + PrintError(command->line, + "mismatch in result %" PRIzd + " of assert_return: expected %s, got %s", + i, TypedValueToString(expected.value).c_str(), TypedValueToString(actual).c_str()); - return wabt::Result::Error; + result = wabt::Result::Error; } - break; } - - default: - PrintError(command->line, "expected result type to be f32 or f64, got %s", - GetTypeName(actual.type)); - return wabt::Result::Error; } - return wabt::Result::Ok; + return result; } wabt::Result CommandRunner::OnAssertTrapCommand( diff --git a/src/validator.cc b/src/validator.cc index c9b083dd..8a71af05 100644 --- a/src/validator.cc +++ b/src/validator.cc @@ -166,9 +166,6 @@ class Validator : public ExprVisitor::Delegate { const TypeVector& actual, const TypeVector& expected, const char* desc); - void CheckAssertReturnNanType(const Location* loc, - Type actual, - const char* desc); void CheckExprList(const Location* loc, const ExprList& exprs); bool CheckHasMemory(const Location* loc, Opcode opcode); bool CheckHasTable(const Location* loc, Opcode opcode, Index index = 0); @@ -203,7 +200,6 @@ class Validator : public ExprVisitor::Delegate { const TypeVector* CheckInvoke(const InvokeAction* action); Result CheckGet(const GetAction* action, Type* out_type); ActionResult CheckAction(const Action* action); - void CheckAssertReturnNanCommand(const Action* action); void CheckCommand(const Command* command); void CheckEvent(const Location* loc, const Event* Event); @@ -462,17 +458,6 @@ void Validator::CheckResultTypes(const Location* loc, } } -void Validator::CheckAssertReturnNanType(const Location* loc, - Type actual, - const char* desc) { - // When using assert_return_nan, the result can be either a f32 or f64 type - // so we special case it here. - if (actual != Type::F32 && actual != Type::F64) { - PrintError(loc, "type mismatch at %s. got %s, expected f32 or f64", desc, - GetTypeName(actual)); - } -} - void Validator::CheckExprList(const Location* loc, const ExprList& exprs) { ExprVisitor visitor(this); // TODO(binji): Add const-visitors. @@ -1478,29 +1463,6 @@ Validator::ActionResult Validator::CheckAction(const Action* action) { return result; } -void Validator::CheckAssertReturnNanCommand(const Action* action) { - ActionResult result = CheckAction(action); - - // A valid result type will either be f32 or f64; convert a Types result into - // a Type result, so it is easier to check below. Type::Any is used to - // specify a type that should not be checked (because an earlier error - // occurred). - if (result.kind == ActionResult::Kind::Types) { - if (result.types->size() == 1) { - result.kind = ActionResult::Kind::Type; - result.type = (*result.types)[0]; - } else { - PrintError(&action->loc, "expected 1 result, got %" PRIzd, - result.types->size()); - result.type = Type::Any; - } - } - - if (result.kind == ActionResult::Kind::Type && result.type != Type::Any) { - CheckAssertReturnNanType(&action->loc, result.type, "action"); - } -} - void Validator::CheckCommand(const Command* command) { switch (command->type) { case CommandType::Module: @@ -1553,16 +1515,6 @@ void Validator::CheckCommand(const Command* command) { break; } - case CommandType::AssertReturnCanonicalNan: - CheckAssertReturnNanCommand( - cast<AssertReturnCanonicalNanCommand>(command)->action.get()); - break; - - case CommandType::AssertReturnArithmeticNan: - CheckAssertReturnNanCommand( - cast<AssertReturnArithmeticNanCommand>(command)->action.get()); - break; - case CommandType::AssertTrap: // ignore result type. CheckAction(cast<AssertTrapCommand>(command)->action.get()); diff --git a/src/wast-parser.cc b/src/wast-parser.cc index 00c95c81..79126431 100644 --- a/src/wast-parser.cc +++ b/src/wast-parser.cc @@ -223,8 +223,6 @@ bool IsCommand(TokenTypePair pair) { case TokenType::AssertMalformed: case TokenType::AssertReturn: case TokenType::AssertReturnFunc: - case TokenType::AssertReturnArithmeticNan: - case TokenType::AssertReturnCanonicalNan: case TokenType::AssertTrap: case TokenType::AssertUnlinkable: case TokenType::Get: @@ -1654,7 +1652,7 @@ Result WastParser::ParsePlainInstr(std::unique_ptr<Expr>* out_expr) { case TokenType::Const: { Const const_; - CHECK_RESULT(ParseConst(&const_)); + CHECK_RESULT(ParseConst(&const_, ConstType::Normal)); out_expr->reset(new ConstExpr(const_, loc)); break; } @@ -2004,7 +2002,24 @@ Result WastParser::ParseSimdV128Const(Const* const_, TokenType token_type) { return Result::Ok; } -Result WastParser::ParseConst(Const* const_) { +Result WastParser::ParseExpectedNan(ExpectedNan* expected) { + WABT_TRACE(ParseExpectedNan); + TokenType token_type = Peek(); + switch (token_type) { + case TokenType::NanArithmetic: + *expected = ExpectedNan::Arithmetic; + break; + case TokenType::NanCanonical: + *expected = ExpectedNan::Canonical; + break; + default: + return Result::Error; + } + Consume(); + return Result::Ok; +} + +Result WastParser::ParseConst(Const* const_, ConstType type) { WABT_TRACE(ParseConst); Token token = Consume(); Opcode opcode = token.opcode(); @@ -2027,6 +2042,9 @@ Result WastParser::ParseConst(Const* const_) { end = sv.end(); break; } + case TokenType::NanArithmetic: + case TokenType::NanCanonical: + break; default: return ErrorExpected({"a numeric literal"}, "123, -45, 6.7e8"); } @@ -2048,11 +2066,21 @@ Result WastParser::ParseConst(Const* const_) { case Opcode::F32Const: const_->type = Type::F32; + if (type == ConstType::Expectation && + ParseExpectedNan(&const_->expected) == Result::Ok) { + const_->is_expected_nan = true; + break; + } result = ParseFloat(literal.type, s, end, &const_->f32_bits); break; case Opcode::F64Const: const_->type = Type::F64; + if (type == ConstType::Expectation && + ParseExpectedNan(&const_->expected) == Result::Ok) { + const_->is_expected_nan = true; + break; + } result = ParseDouble(literal.type, s, end, &const_->f64_bits); break; @@ -2127,7 +2155,7 @@ Result WastParser::ParseHostRef(Const* const_) { return Result::Ok; } -Result WastParser::ParseConstList(ConstVector* consts) { +Result WastParser::ParseConstList(ConstVector* consts, ConstType type) { WABT_TRACE(ParseConstList); while (PeekMatchLpar(TokenType::Const) || PeekMatchLpar(TokenType::RefNull) || PeekMatchLpar(TokenType::RefHost)) { @@ -2135,7 +2163,7 @@ Result WastParser::ParseConstList(ConstVector* consts) { Const const_; switch (Peek()) { case TokenType::Const: - CHECK_RESULT(ParseConst(&const_)); + CHECK_RESULT(ParseConst(&const_, type)); break; case TokenType::RefNull: { auto token = Consume(); @@ -2435,12 +2463,6 @@ Result WastParser::ParseCommand(Script* script, CommandPtr* out_command) { case TokenType::AssertReturnFunc: return ParseAssertReturnFuncCommand(out_command); - case TokenType::AssertReturnArithmeticNan: - return ParseAssertReturnArithmeticNanCommand(out_command); - - case TokenType::AssertReturnCanonicalNan: - return ParseAssertReturnCanonicalNanCommand(out_command); - case TokenType::AssertTrap: return ParseAssertTrapCommand(out_command); @@ -2487,7 +2509,7 @@ Result WastParser::ParseAssertReturnCommand(CommandPtr* out_command) { EXPECT(AssertReturn); auto command = MakeUnique<AssertReturnCommand>(); CHECK_RESULT(ParseAction(&command->action)); - CHECK_RESULT(ParseConstList(&command->expected)); + CHECK_RESULT(ParseConstList(&command->expected, ConstType::Expectation)); EXPECT(Rpar); *out_command = std::move(command); return Result::Ok; @@ -2504,20 +2526,6 @@ Result WastParser::ParseAssertReturnFuncCommand(CommandPtr* out_command) { return Result::Ok; } -Result WastParser::ParseAssertReturnArithmeticNanCommand( - CommandPtr* out_command) { - WABT_TRACE(ParseAssertReturnArithmeticNanCommand); - return ParseAssertActionCommand<AssertReturnArithmeticNanCommand>( - TokenType::AssertReturnArithmeticNan, out_command); -} - -Result WastParser::ParseAssertReturnCanonicalNanCommand( - CommandPtr* out_command) { - WABT_TRACE(ParseAssertReturnCanonicalNanCommand); - return ParseAssertActionCommand<AssertReturnCanonicalNanCommand>( - TokenType::AssertReturnCanonicalNan, out_command); -} - Result WastParser::ParseAssertTrapCommand(CommandPtr* out_command) { WABT_TRACE(ParseAssertTrapCommand); EXPECT(Lpar); @@ -2635,7 +2643,7 @@ Result WastParser::ParseAction(ActionPtr* out_action) { auto action = MakeUnique<InvokeAction>(loc); ParseVarOpt(&action->module_var, Var(last_module_index_, loc)); CHECK_RESULT(ParseQuotedText(&action->name)); - CHECK_RESULT(ParseConstList(&action->args)); + CHECK_RESULT(ParseConstList(&action->args, ConstType::Normal)); *out_action = std::move(action); break; } diff --git a/src/wast-parser.h b/src/wast-parser.h index 712861e6..864643d6 100644 --- a/src/wast-parser.h +++ b/src/wast-parser.h @@ -48,6 +48,11 @@ class WastParser { std::unique_ptr<Script> ReleaseScript(); private: + enum class ConstType { + Normal, + Expectation, + }; + void ErrorUnlessOpcodeEnabled(const Token&); // Print an error message listing the expected tokens, as well as an example @@ -163,9 +168,10 @@ class WastParser { Result ParseTerminatingInstrList(ExprList*); Result ParseInstr(ExprList*); Result ParsePlainInstr(std::unique_ptr<Expr>*); - Result ParseConst(Const*); + Result ParseConst(Const*, ConstType type); Result ParseHostRef(Const*); - Result ParseConstList(ConstVector*); + Result ParseExpectedNan(ExpectedNan* expected); + Result ParseConstList(ConstVector*, ConstType type); Result ParseBlockInstr(std::unique_ptr<Expr>*); Result ParseLabelOpt(std::string*); Result ParseEndLabelOpt(const std::string&); @@ -187,8 +193,6 @@ class WastParser { Result ParseAssertMalformedCommand(CommandPtr*); Result ParseAssertReturnCommand(CommandPtr*); Result ParseAssertReturnFuncCommand(CommandPtr*); - Result ParseAssertReturnArithmeticNanCommand(CommandPtr*); - Result ParseAssertReturnCanonicalNanCommand(CommandPtr*); Result ParseAssertTrapCommand(CommandPtr*); Result ParseAssertUnlinkableCommand(CommandPtr*); Result ParseActionCommand(CommandPtr*); |