diff options
45 files changed, 223 insertions, 279 deletions
diff --git a/src/binary-reader-ir.cc b/src/binary-reader-ir.cc index b1c341b0..f1e3d32b 100644 --- a/src/binary-reader-ir.cc +++ b/src/binary-reader-ir.cc @@ -270,6 +270,7 @@ class BinaryReaderIR : public BinaryReaderNop { Result TopLabel(LabelNode** label); Result TopLabelExpr(LabelNode** label, Expr** expr); Result AppendExpr(std::unique_ptr<Expr> expr); + void SetFuncDeclaration(FuncDeclaration* decl, Var var); void SetBlockDeclaration(BlockDeclaration* decl, Type sig_type); std::string GetUniqueName(BindingHash* bindings, @@ -349,13 +350,19 @@ Result BinaryReaderIR::AppendExpr(std::unique_ptr<Expr> expr) { return Result::Ok; } +void BinaryReaderIR::SetFuncDeclaration(FuncDeclaration* decl, Var var) { + decl->has_func_type = true; + decl->type_var = var; + if (auto* func_type = module_->GetFuncType(var)) { + decl->sig = func_type->sig; + } +} + void BinaryReaderIR::SetBlockDeclaration(BlockDeclaration* decl, Type sig_type) { if (sig_type.IsIndex()) { Index type_index = sig_type.GetIndex(); - decl->has_func_type = true; - decl->type_var = Var(type_index); - decl->sig = cast<FuncType>(module_->types[type_index])->sig; + SetFuncDeclaration(decl, Var(type_index)); } else { decl->has_func_type = false; decl->sig.param_types.clear(); @@ -422,9 +429,7 @@ Result BinaryReaderIR::OnImportFunc(Index import_index, auto import = MakeUnique<FuncImport>(); import->module_name = module_name.to_string(); import->field_name = field_name.to_string(); - import->func.decl.has_func_type = true; - import->func.decl.type_var = Var(sig_index, GetLocation()); - import->func.decl.sig = cast<FuncType>(module_->types[sig_index])->sig; + SetFuncDeclaration(&import->func.decl, Var(sig_index, GetLocation())); module_->AppendField( MakeUnique<ImportModuleField>(std::move(import), GetLocation())); return Result::Ok; @@ -483,9 +488,7 @@ Result BinaryReaderIR::OnImportEvent(Index import_index, auto import = MakeUnique<EventImport>(); import->module_name = module_name.to_string(); import->field_name = field_name.to_string(); - import->event.decl.has_func_type = true; - import->event.decl.type_var = Var(sig_index, GetLocation()); - import->event.decl.sig = cast<FuncType>(module_->types[sig_index])->sig; + SetFuncDeclaration(&import->event.decl, Var(sig_index, GetLocation())); module_->AppendField( MakeUnique<ImportModuleField>(std::move(import), GetLocation())); return Result::Ok; @@ -501,9 +504,7 @@ Result BinaryReaderIR::OnFunctionCount(Index count) { Result BinaryReaderIR::OnFunction(Index index, Index sig_index) { auto field = MakeUnique<FuncModuleField>(GetLocation()); Func& func = field->func; - func.decl.has_func_type = true; - func.decl.type_var = Var(sig_index, GetLocation()); - func.decl.sig = cast<FuncType>(module_->types[sig_index])->sig; + SetFuncDeclaration(&func.decl, Var(sig_index, GetLocation())); module_->AppendField(std::move(field)); return Result::Ok; } @@ -583,23 +584,6 @@ Result BinaryReaderIR::OnExport(Index index, auto field = MakeUnique<ExportModuleField>(GetLocation()); Export& export_ = field->export_; export_.name = name.to_string(); - switch (kind) { - case ExternalKind::Func: - assert(item_index < module_->funcs.size()); - break; - case ExternalKind::Table: - assert(item_index < module_->tables.size()); - break; - case ExternalKind::Memory: - assert(item_index < module_->memories.size()); - break; - case ExternalKind::Global: - assert(item_index < module_->globals.size()); - break; - case ExternalKind::Event: - assert(item_index < module_->events.size()); - break; - } export_.var = Var(item_index, GetLocation()); export_.kind = kind; module_->AppendField(std::move(field)); @@ -607,7 +591,6 @@ Result BinaryReaderIR::OnExport(Index index, } Result BinaryReaderIR::OnStartFunction(Index func_index) { - assert(func_index < module_->funcs.size()); Var start(func_index, GetLocation()); module_->AppendField(MakeUnique<StartModuleField>(start, GetLocation())); return Result::Ok; @@ -712,31 +695,25 @@ Result BinaryReaderIR::OnBrTableExpr(Index num_targets, } Result BinaryReaderIR::OnCallExpr(Index func_index) { - assert(func_index < module_->funcs.size()); return AppendExpr(MakeUnique<CallExpr>(Var(func_index))); } Result BinaryReaderIR::OnCallIndirectExpr(Index sig_index, Index table_index) { assert(sig_index < module_->types.size()); auto expr = MakeUnique<CallIndirectExpr>(); - expr->decl.has_func_type = true; - expr->decl.type_var = Var(sig_index, GetLocation()); - expr->decl.sig = cast<FuncType>(module_->types[sig_index])->sig; + SetFuncDeclaration(&expr->decl, Var(sig_index, GetLocation())); expr->table = Var(table_index); return AppendExpr(std::move(expr)); } Result BinaryReaderIR::OnReturnCallExpr(Index func_index) { - assert(func_index < module_->funcs.size()); return AppendExpr(MakeUnique<ReturnCallExpr>(Var(func_index))); } Result BinaryReaderIR::OnReturnCallIndirectExpr(Index sig_index, Index table_index) { assert(sig_index < module_->types.size()); auto expr = MakeUnique<ReturnCallIndirectExpr>(); - expr->decl.has_func_type = true; - expr->decl.type_var = Var(sig_index, GetLocation()); - expr->decl.sig = cast<FuncType>(module_->types[sig_index])->sig; + SetFuncDeclaration(&expr->decl, Var(sig_index, GetLocation())); expr->table = Var(table_index); return AppendExpr(std::move(expr)); } @@ -1257,9 +1234,7 @@ Result BinaryReaderIR::OnLocalName(Index func_index, Result BinaryReaderIR::OnEventType(Index index, Index sig_index) { auto field = MakeUnique<EventModuleField>(GetLocation()); Event& event = field->event; - event.decl.has_func_type = true; - event.decl.type_var = Var(sig_index, GetLocation()); - event.decl.sig = cast<FuncType>(module_->types[sig_index])->sig; + SetFuncDeclaration(&event.decl, Var(sig_index, GetLocation())); module_->AppendField(std::move(field)); return Result::Ok; } diff --git a/src/binary-reader.cc b/src/binary-reader.cc index 2a28a569..3eabc698 100644 --- a/src/binary-reader.cc +++ b/src/binary-reader.cc @@ -113,10 +113,6 @@ class BinaryReader { bool IsBlockType(Type); Index NumTotalFuncs(); - Index NumTotalTables(); - Index NumTotalMemories(); - Index NumTotalGlobals(); - Index NumTotalEvents(); Result ReadI32InitExpr(Index index) WABT_WARN_UNUSED; Result ReadInitExpr(Index index, bool require_i32 = false) WABT_WARN_UNUSED; @@ -158,20 +154,13 @@ class BinaryReader { BinarySection last_known_section_ = BinarySection::Invalid; bool did_read_names_section_ = false; bool reading_custom_section_ = false; - Index num_signatures_ = 0; - Index num_imports_ = 0; Index num_func_imports_ = 0; Index num_table_imports_ = 0; Index num_memory_imports_ = 0; Index num_global_imports_ = 0; Index num_event_imports_ = 0; Index num_function_signatures_ = 0; - Index num_tables_ = 0; - Index num_memories_ = 0; - Index num_globals_ = 0; - Index num_exports_ = 0; Index num_function_bodies_ = 0; - Index num_events_ = 0; Index data_count_ = kInvalidIndex; using ReadEndRestoreGuard = @@ -417,29 +406,13 @@ bool BinaryReader::IsBlockType(Type type) { return false; } - return type.GetIndex() < num_signatures_; + return true; } Index BinaryReader::NumTotalFuncs() { return num_func_imports_ + num_function_signatures_; } -Index BinaryReader::NumTotalTables() { - return num_table_imports_ + num_tables_; -} - -Index BinaryReader::NumTotalMemories() { - return num_memory_imports_ + num_memories_; -} - -Index BinaryReader::NumTotalGlobals() { - return num_global_imports_ + num_globals_; -} - -Index BinaryReader::NumTotalEvents() { - return num_event_imports_ + num_events_; -} - Result BinaryReader::ReadI32InitExpr(Index index) { return ReadInitExpr(index, true); } @@ -538,8 +511,6 @@ Result BinaryReader::ReadTable(Type* out_elem_type, Limits* out_elem_limits) { ERROR_IF(is_shared, "tables may not be shared"); if (has_max) { CHECK_RESULT(ReadU32Leb128(&max, "table max elem count")); - ERROR_UNLESS(initial <= max, - "table initial elem count must be <= max elem count"); } out_elem_limits->has_max = has_max; @@ -554,14 +525,10 @@ Result BinaryReader::ReadMemory(Limits* out_page_limits) { uint32_t max = 0; CHECK_RESULT(ReadU32Leb128(&flags, "memory flags")); CHECK_RESULT(ReadU32Leb128(&initial, "memory initial page count")); - ERROR_UNLESS(initial <= WABT_MAX_PAGES, "invalid memory initial size"); bool has_max = flags & WABT_BINARY_LIMITS_HAS_MAX_FLAG; bool is_shared = flags & WABT_BINARY_LIMITS_IS_SHARED_FLAG; - ERROR_IF(is_shared && !has_max, "shared memory must have a max size"); if (has_max) { CHECK_RESULT(ReadU32Leb128(&max, "memory max page count")); - ERROR_UNLESS(max <= WABT_MAX_PAGES, "invalid memory max size"); - ERROR_UNLESS(initial <= max, "memory initial size must be <= max size"); } out_page_limits->has_max = has_max; @@ -792,8 +759,6 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { case Opcode::Call: { Index func_index; CHECK_RESULT(ReadIndex(&func_index, "call function index")); - ERROR_UNLESS(func_index < NumTotalFuncs(), - "invalid call function index: %" PRIindex, func_index); CALLBACK(OnCallExpr, func_index); CALLBACK(OnOpcodeIndex, func_index); break; @@ -802,18 +767,13 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { case Opcode::CallIndirect: { Index sig_index; CHECK_RESULT(ReadIndex(&sig_index, "call_indirect signature index")); - ERROR_UNLESS(sig_index < num_signatures_, - "invalid call_indirect signature index"); Index table_index = 0; if (options_.features.reference_types_enabled()) { CHECK_RESULT(ReadIndex(&table_index, "call_indirect table index")); - ERROR_UNLESS(table_index < NumTotalTables(), - "invalid call_indirect table index"); } else { uint8_t reserved; CHECK_RESULT(ReadU8(&reserved, "call_indirect reserved")); - ERROR_UNLESS(reserved == 0, - "call_indirect reserved value must be 0"); + ERROR_UNLESS(reserved == 0, "call_indirect reserved value must be 0"); } CALLBACK(OnCallIndirectExpr, sig_index, table_index); CALLBACK(OnOpcodeUint32Uint32, sig_index, table_index); @@ -823,9 +783,6 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { case Opcode::ReturnCall: { Index func_index; CHECK_RESULT(ReadIndex(&func_index, "return_call")); - ERROR_UNLESS(func_index < NumTotalFuncs(), - "invalid return_call function index: %" PRIindex, - func_index); CALLBACK(OnReturnCallExpr, func_index); CALLBACK(OnOpcodeIndex, func_index); break; @@ -834,18 +791,15 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { case Opcode::ReturnCallIndirect: { Index sig_index; CHECK_RESULT(ReadIndex(&sig_index, "return_call_indirect")); - ERROR_UNLESS(sig_index < num_signatures_, - "invalid return_call_indirect signature index"); Index table_index = 0; if (options_.features.reference_types_enabled()) { - CHECK_RESULT(ReadIndex(&table_index, "return_call_indirect table index")); - ERROR_UNLESS(table_index < NumTotalTables(), - "invalid return_call_indirect table index"); + CHECK_RESULT( + ReadIndex(&table_index, "return_call_indirect table index")); } else { uint8_t reserved; CHECK_RESULT(ReadU8(&reserved, "return_call_indirect reserved")); ERROR_UNLESS(reserved == 0, - "return_call_indirect reserved value must be 0"); + "return_call_indirect reserved value must be 0"); } CALLBACK(OnReturnCallIndirectExpr, sig_index, table_index); CALLBACK(OnOpcodeUint32Uint32, sig_index, table_index); @@ -1449,9 +1403,6 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { CHECK_RESULT(ReadIndex(&segment, "elem segment index")); Index table_index; CHECK_RESULT(ReadIndex(&table_index, "reserved table index")); - if (!options_.features.reference_types_enabled()) { - ERROR_UNLESS(table_index == 0, "table.index index must be 0"); - } CALLBACK(OnTableInitExpr, segment, table_index); CALLBACK(OnOpcodeUint32Uint32, segment, table_index); break; @@ -1509,13 +1460,7 @@ Result BinaryReader::ReadFunctionBody(Offset end_offset) { Index table_dst; Index table_src; CHECK_RESULT(ReadIndex(&table_dst, "reserved table index")); - if (!options_.features.reference_types_enabled()) { - ERROR_UNLESS(table_dst == 0, "table.copy dst must be 0"); - } CHECK_RESULT(ReadIndex(&table_src, "table src")); - if (!options_.features.reference_types_enabled()) { - ERROR_UNLESS(table_src == 0, "table.copy src must be 0"); - } CALLBACK(OnTableCopyExpr, table_dst, table_src); CALLBACK(OnOpcodeUint32Uint32, table_dst, table_src); break; @@ -1897,17 +1842,16 @@ Result BinaryReader::ReadEventType(Index* out_sig_index) { CHECK_RESULT(ReadU32Leb128(&attribute, "event attribute")); ERROR_UNLESS(attribute == 0, "event attribute must be 0"); CHECK_RESULT(ReadIndex(out_sig_index, "event signature index")); - ERROR_UNLESS(*out_sig_index < num_signatures_, - "invalid event signature index"); return Result::Ok; } Result BinaryReader::ReadEventSection(Offset section_size) { CALLBACK(BeginEventSection, section_size); - CHECK_RESULT(ReadCount(&num_events_, "event count")); - CALLBACK(OnEventCount, num_events_); + Index num_events; + CHECK_RESULT(ReadCount(&num_events, "event count")); + CALLBACK(OnEventCount, num_events); - for (Index i = 0; i < num_events_; ++i) { + for (Index i = 0; i < num_events; ++i) { Index event_index = num_event_imports_ + i; Index sig_index; CHECK_RESULT(ReadEventType(&sig_index)); @@ -1945,10 +1889,11 @@ Result BinaryReader::ReadCustomSection(Offset section_size) { Result BinaryReader::ReadTypeSection(Offset section_size) { CALLBACK(BeginTypeSection, section_size); - CHECK_RESULT(ReadCount(&num_signatures_, "type count")); - CALLBACK(OnTypeCount, num_signatures_); + Index num_signatures; + CHECK_RESULT(ReadCount(&num_signatures, "type count")); + CALLBACK(OnTypeCount, num_signatures); - for (Index i = 0; i < num_signatures_; ++i) { + for (Index i = 0; i < num_signatures; ++i) { Type form; CHECK_RESULT(ReadType(&form, "type form")); @@ -1970,9 +1915,6 @@ Result BinaryReader::ReadTypeSection(Offset section_size) { Index num_results; CHECK_RESULT(ReadCount(&num_results, "function result count")); - ERROR_UNLESS( - num_results <= 1 || options_.features.multi_value_enabled(), - "result count must be 0 or 1"); result_types_.resize(num_results); @@ -2012,9 +1954,10 @@ Result BinaryReader::ReadTypeSection(Offset section_size) { Result BinaryReader::ReadImportSection(Offset section_size) { CALLBACK(BeginImportSection, section_size); - CHECK_RESULT(ReadCount(&num_imports_, "import count")); - CALLBACK(OnImportCount, num_imports_); - for (Index i = 0; i < num_imports_; ++i) { + Index num_imports; + CHECK_RESULT(ReadCount(&num_imports, "import count")); + CALLBACK(OnImportCount, num_imports); + for (Index i = 0; i < num_imports; ++i) { string_view module_name; CHECK_RESULT(ReadStr(&module_name, "import module name")); string_view field_name; @@ -2028,8 +1971,6 @@ Result BinaryReader::ReadImportSection(Offset section_size) { case ExternalKind::Func: { Index sig_index; CHECK_RESULT(ReadIndex(&sig_index, "import signature index")); - ERROR_UNLESS(sig_index < num_signatures_, - "invalid import signature index"); CALLBACK(OnImportFunc, i, module_name, field_name, num_func_imports_, sig_index); num_func_imports_++; @@ -2078,15 +2019,6 @@ Result BinaryReader::ReadImportSection(Offset section_size) { } } - ERROR_UNLESS(num_memory_imports_ <= 1, - "memory count (%" PRIindex ") must be 0 or 1", - num_memory_imports_); - if (!options_.features.reference_types_enabled()) { - ERROR_UNLESS(num_table_imports_ <= 1, - "table count (%" PRIindex ") must be 0 or 1", - num_table_imports_); - } - CALLBACK0(EndImportSection); return Result::Ok; } @@ -2100,8 +2032,6 @@ Result BinaryReader::ReadFunctionSection(Offset section_size) { Index func_index = num_func_imports_ + i; Index sig_index; CHECK_RESULT(ReadIndex(&sig_index, "function signature index")); - ERROR_UNLESS(sig_index < num_signatures_, - "invalid function signature index: %" PRIindex, sig_index); CALLBACK(OnFunction, func_index, sig_index); } CALLBACK0(EndFunctionSection); @@ -2110,14 +2040,10 @@ Result BinaryReader::ReadFunctionSection(Offset section_size) { Result BinaryReader::ReadTableSection(Offset section_size) { CALLBACK(BeginTableSection, section_size); - CHECK_RESULT(ReadCount(&num_tables_, "table count")); - if (!options_.features.reference_types_enabled()) { - ERROR_UNLESS(num_table_imports_ + num_tables_ <= 1, - "table count (%" PRIindex ") must be 0 or 1", - num_table_imports_ + num_tables_); - } - CALLBACK(OnTableCount, num_tables_); - for (Index i = 0; i < num_tables_; ++i) { + Index num_tables; + CHECK_RESULT(ReadCount(&num_tables, "table count")); + CALLBACK(OnTableCount, num_tables); + for (Index i = 0; i < num_tables; ++i) { Index table_index = num_table_imports_ + i; Type elem_type; Limits elem_limits; @@ -2130,12 +2056,10 @@ Result BinaryReader::ReadTableSection(Offset section_size) { Result BinaryReader::ReadMemorySection(Offset section_size) { CALLBACK(BeginMemorySection, section_size); - CHECK_RESULT(ReadCount(&num_memories_, "memory count")); - ERROR_UNLESS(num_memory_imports_ + num_memories_ <= 1, - "memory count (%" PRIindex ") must be 0 or 1", - num_memory_imports_ + num_memories_); - CALLBACK(OnMemoryCount, num_memories_); - for (Index i = 0; i < num_memories_; ++i) { + Index num_memories; + CHECK_RESULT(ReadCount(&num_memories, "memory count")); + CALLBACK(OnMemoryCount, num_memories); + for (Index i = 0; i < num_memories; ++i) { Index memory_index = num_memory_imports_ + i; Limits page_limits; CHECK_RESULT(ReadMemory(&page_limits)); @@ -2147,9 +2071,10 @@ Result BinaryReader::ReadMemorySection(Offset section_size) { Result BinaryReader::ReadGlobalSection(Offset section_size) { CALLBACK(BeginGlobalSection, section_size); - CHECK_RESULT(ReadCount(&num_globals_, "global count")); - CALLBACK(OnGlobalCount, num_globals_); - for (Index i = 0; i < num_globals_; ++i) { + Index num_globals; + CHECK_RESULT(ReadCount(&num_globals, "global count")); + CALLBACK(OnGlobalCount, num_globals); + for (Index i = 0; i < num_globals; ++i) { Index global_index = num_global_imports_ + i; Type global_type; bool mutable_; @@ -2166,9 +2091,10 @@ Result BinaryReader::ReadGlobalSection(Offset section_size) { Result BinaryReader::ReadExportSection(Offset section_size) { CALLBACK(BeginExportSection, section_size); - CHECK_RESULT(ReadCount(&num_exports_, "export count")); - CALLBACK(OnExportCount, num_exports_); - for (Index i = 0; i < num_exports_; ++i) { + Index num_exports; + CHECK_RESULT(ReadCount(&num_exports, "export count")); + CALLBACK(OnExportCount, num_exports); + for (Index i = 0; i < num_exports; ++i) { string_view name; CHECK_RESULT(ReadStr(&name, "export item name")); @@ -2177,29 +2103,9 @@ Result BinaryReader::ReadExportSection(Offset section_size) { Index item_index; CHECK_RESULT(ReadIndex(&item_index, "export item index")); - switch (kind) { - case ExternalKind::Func: - ERROR_UNLESS(item_index < NumTotalFuncs(), - "invalid export func index: %" PRIindex, item_index); - break; - case ExternalKind::Table: - ERROR_UNLESS(item_index < NumTotalTables(), - "invalid export table index: %" PRIindex, item_index); - break; - case ExternalKind::Memory: - ERROR_UNLESS(item_index < NumTotalMemories(), - "invalid export memory index: %" PRIindex, item_index); - break; - case ExternalKind::Global: - ERROR_UNLESS(item_index < NumTotalGlobals(), - "invalid export global index: %" PRIindex, item_index); - break; - case ExternalKind::Event: - ERROR_UNLESS(options_.features.exceptions_enabled(), - "invalid export event kind: exceptions not allowed"); - ERROR_UNLESS(item_index < NumTotalEvents(), - "invalid export event index: %" PRIindex, item_index); - break; + if (kind == ExternalKind::Event) { + ERROR_UNLESS(options_.features.exceptions_enabled(), + "invalid export event kind: exceptions not allowed"); } CALLBACK(OnExport, i, static_cast<ExternalKind>(kind), item_index, name); @@ -2212,8 +2118,6 @@ Result BinaryReader::ReadStartSection(Offset section_size) { CALLBACK(BeginStartSection, section_size); Index func_index; CHECK_RESULT(ReadIndex(&func_index, "start function index")); - ERROR_UNLESS(func_index < NumTotalFuncs(), - "invalid start function index: %" PRIindex, func_index); CALLBACK(OnStartFunction, func_index); CALLBACK0(EndStartSection); return Result::Ok; @@ -2224,8 +2128,6 @@ Result BinaryReader::ReadElemSection(Offset section_size) { Index num_elem_segments; CHECK_RESULT(ReadCount(&num_elem_segments, "elem segment count")); CALLBACK(OnElemSegmentCount, num_elem_segments); - ERROR_UNLESS(num_elem_segments == 0 || NumTotalTables() > 0, - "elem section without table section"); for (Index i = 0; i < num_elem_segments; ++i) { uint32_t flags; CHECK_RESULT(ReadU32Leb128(&flags, "elem segment flags")); @@ -2341,8 +2243,6 @@ Result BinaryReader::ReadDataSection(Offset section_size) { Index num_data_segments; CHECK_RESULT(ReadCount(&num_data_segments, "data segment count")); CALLBACK(OnDataSegmentCount, num_data_segments); - ERROR_UNLESS(num_data_segments == 0 || NumTotalMemories() > 0, - "data section without memory section"); // If the DataCount section is not present, then data_count_ will be invalid. ERROR_UNLESS(data_count_ == kInvalidIndex || data_count_ == num_data_segments, "data segment count does not equal count in DataCount section"); diff --git a/src/shared-validator.cc b/src/shared-validator.cc index 1d251e2e..5af98356 100644 --- a/src/shared-validator.cc +++ b/src/shared-validator.cc @@ -49,19 +49,20 @@ Result SharedValidator::OnFuncType(const Location& loc, const Type* param_types, Index result_count, const Type* result_types) { + Result result = Result::Ok; + if (!options_.features.multi_value_enabled() && result_count > 1) { + result |= + PrintError(loc, "multiple result values not currently supported."); + } types_.push_back(FuncType{ToTypeVector(param_count, param_types), ToTypeVector(result_count, result_types)}); - return Result::Ok; + return result; } Result SharedValidator::OnFunction(const Location& loc, Var sig_var) { Result result = Result::Ok; FuncType type; result |= CheckTypeIndex(sig_var, &type); - if (!options_.features.multi_value_enabled() && type.results.size() > 1) { - result |= - PrintError(loc, "multiple result values not currently supported."); - } funcs_.push_back(type); return result; } @@ -481,11 +482,8 @@ Result SharedValidator::CheckBlockSignature(const Location& loc, result |= PrintError(loc, "%s params not currently supported.", opcode.GetName()); } - if (func_type.results.size() > 1 && - !options_.features.multi_value_enabled()) { - result |= PrintError(loc, "multiple %s results not currently supported.", - opcode.GetName()); - } + // Multiple results without --enable-multi-value is checked above in + // OnType. *out_param_types = func_type.params; *out_result_types = func_type.results; diff --git a/test/binary/bad-export-func.txt b/test/binary/bad-export-func.txt index f1f40378..0ecae4e6 100644 --- a/test/binary/bad-export-func.txt +++ b/test/binary/bad-export-func.txt @@ -4,7 +4,8 @@ version section(TYPE) { count[1] function params[0] results[0] } section(FUNCTION) { count[1] sig[0] } section(EXPORT) { count[1] str("foo") func_kind func[1] } +section(CODE) { count[1] func { locals[0] } } (;; STDERR ;;; -000001b: error: invalid export func index: 1 -000001b: error: invalid export func index: 1 +out/test/binary/bad-export-func/bad-export-func.wasm:000001b: error: function variable out of range: 1 (max 1) +out/test/binary/bad-export-func/bad-export-func.wasm:000001b: error: function variable out of range: 1 (max 1) ;;; STDERR ;;) diff --git a/test/binary/bad-function-sig.txt b/test/binary/bad-function-sig.txt index dda1ce22..19f71b31 100644 --- a/test/binary/bad-function-sig.txt +++ b/test/binary/bad-function-sig.txt @@ -3,7 +3,8 @@ magic version section(TYPE) { count[1] function params[1] i32 results[1] i32 } section(FUNCTION) { count[1] type[1] } +section(CODE) { count[1] func { locals[0] } } (;; STDERR ;;; -0000014: error: invalid function signature index: 1 -0000014: error: invalid function signature index: 1 +out/test/binary/bad-function-sig/bad-function-sig.wasm:0000014: error: function type variable out of range: 1 (max 1) +out/test/binary/bad-function-sig/bad-function-sig.wasm:0000014: error: function type variable out of range: 1 (max 1) ;;; STDERR ;;) diff --git a/test/binary/bad-function-too-many-results.txt b/test/binary/bad-function-too-many-results.txt index 3886301d..bed2e6ca 100644 --- a/test/binary/bad-function-too-many-results.txt +++ b/test/binary/bad-function-too-many-results.txt @@ -3,6 +3,6 @@ magic version section(TYPE) { count[1] function params[0] results[2] i32 i32 } (;; STDERR ;;; -000000e: error: result count must be 0 or 1 -000000e: error: result count must be 0 or 1 +out/test/binary/bad-function-too-many-results/bad-function-too-many-results.wasm:0000010: error: multiple result values not currently supported. +out/test/binary/bad-function-too-many-results/bad-function-too-many-results.wasm:0000010: error: multiple result values not currently supported. ;;; STDERR ;;) diff --git a/test/binary/bad-import-sig.txt b/test/binary/bad-import-sig.txt index 6eb2b6cd..de799835 100644 --- a/test/binary/bad-import-sig.txt +++ b/test/binary/bad-import-sig.txt @@ -4,6 +4,6 @@ version section(TYPE) { count[1] function params[0] results[1] i32 } section(IMPORT) { count[1] str("module") str("func") func_kind type[1] } (;; STDERR ;;; -0000020: error: invalid import signature index -0000020: error: invalid import signature index +out/test/binary/bad-import-sig/bad-import-sig.wasm:0000020: error: function type variable out of range: 1 (max 1) +out/test/binary/bad-import-sig/bad-import-sig.wasm:0000020: error: function type variable out of range: 1 (max 1) ;;; STDERR ;;) diff --git a/test/binary/bad-memory-init-max-size.txt b/test/binary/bad-memory-init-max-size.txt index efd586f2..76561241 100644 --- a/test/binary/bad-memory-init-max-size.txt +++ b/test/binary/bad-memory-init-max-size.txt @@ -8,6 +8,6 @@ section(MEMORY) { max[1] } (;; STDERR ;;; -000000e: error: memory initial size must be <= max size -000000e: error: memory initial size must be <= max size +out/test/binary/bad-memory-init-max-size/bad-memory-init-max-size.wasm:000000e: error: max pages (1) must be >= initial pages (2) +out/test/binary/bad-memory-init-max-size/bad-memory-init-max-size.wasm:000000e: error: max pages (1) must be >= initial pages (2) ;;; STDERR ;;) diff --git a/test/binary/bad-memory-init-size.txt b/test/binary/bad-memory-init-size.txt index 458b4521..dfc79dcd 100644 --- a/test/binary/bad-memory-init-size.txt +++ b/test/binary/bad-memory-init-size.txt @@ -7,6 +7,6 @@ section(MEMORY) { initial[leb_u32(65537)] } (;; STDERR ;;; -000000f: error: invalid memory initial size -000000f: error: invalid memory initial size +out/test/binary/bad-memory-init-size/bad-memory-init-size.wasm:000000f: error: initial pages (65537) must be <= (65536) +out/test/binary/bad-memory-init-size/bad-memory-init-size.wasm:000000f: error: initial pages (65537) must be <= (65536) ;;; STDERR ;;) diff --git a/test/binary/bad-memory-max-size.txt b/test/binary/bad-memory-max-size.txt index 122c51b1..226f5f10 100644 --- a/test/binary/bad-memory-max-size.txt +++ b/test/binary/bad-memory-max-size.txt @@ -8,6 +8,6 @@ section(MEMORY) { max[leb_u32(65537)] } (;; STDERR ;;; -0000010: error: invalid memory max size -0000010: error: invalid memory max size +out/test/binary/bad-memory-max-size/bad-memory-max-size.wasm:0000010: error: max pages (65537) must be <= (65536) +out/test/binary/bad-memory-max-size/bad-memory-max-size.wasm:0000010: error: max pages (65537) must be <= (65536) ;;; STDERR ;;) diff --git a/test/binary/bad-segment-no-memory.txt b/test/binary/bad-segment-no-memory.txt index d4a8ee5b..74be7372 100644 --- a/test/binary/bad-segment-no-memory.txt +++ b/test/binary/bad-segment-no-memory.txt @@ -7,6 +7,6 @@ section(DATA) { data[str("hi")] } (;; STDERR ;;; -000000b: error: data section without memory section -000000b: error: data section without memory section +000000c: error: invalid data segment flags: 0x41 +000000c: error: invalid data segment flags: 0x41 ;;; STDERR ;;) diff --git a/test/binary/bad-start-func.txt b/test/binary/bad-start-func.txt index 30971b0d..cc00d2e1 100644 --- a/test/binary/bad-start-func.txt +++ b/test/binary/bad-start-func.txt @@ -4,7 +4,8 @@ version section(TYPE) { count[1] function params[0] results[0] } section(FUNCTION) { count[1] sig[0] } section(START) { func[1] } +section(CODE) { count[1] func { locals[0] } } (;; STDERR ;;; -0000015: error: invalid start function index: 1 -0000015: error: invalid start function index: 1 +out/test/binary/bad-start-func/bad-start-func.wasm:0000015: error: function variable out of range: 1 (max 1) +out/test/binary/bad-start-func/bad-start-func.wasm:0000015: error: function variable out of range: 1 (max 1) ;;; STDERR ;;) diff --git a/test/parse/expr/bad-block-sig-multi.txt b/test/parse/expr/bad-block-sig-multi.txt index 00e7698f..7abe50a3 100644 --- a/test/parse/expr/bad-block-sig-multi.txt +++ b/test/parse/expr/bad-block-sig-multi.txt @@ -15,7 +15,7 @@ drop end)) (;; STDERR ;;; -out/test/parse/expr/bad-block-sig-multi.txt:5:5: error: multiple block results not currently supported. +out/test/parse/expr/bad-block-sig-multi.txt:5:5: error: multiple result values not currently supported. block (result i32 i32) ^^^^^ out/test/parse/expr/bad-block-sig-multi.txt:14:5: error: block params not currently supported. diff --git a/test/parse/expr/bad-if-sig-multi.txt b/test/parse/expr/bad-if-sig-multi.txt index e987c504..44cb713d 100644 --- a/test/parse/expr/bad-if-sig-multi.txt +++ b/test/parse/expr/bad-if-sig-multi.txt @@ -22,7 +22,7 @@ drop end)) (;; STDERR ;;; -out/test/parse/expr/bad-if-sig-multi.txt:6:5: error: multiple if results not currently supported. +out/test/parse/expr/bad-if-sig-multi.txt:6:5: error: multiple result values not currently supported. if (result i32 i32) ^^ out/test/parse/expr/bad-if-sig-multi.txt:19:5: error: if params not currently supported. diff --git a/test/parse/expr/bad-loop-sig-multi.txt b/test/parse/expr/bad-loop-sig-multi.txt index 7763f3d0..1b85f018 100644 --- a/test/parse/expr/bad-loop-sig-multi.txt +++ b/test/parse/expr/bad-loop-sig-multi.txt @@ -15,7 +15,7 @@ drop end)) (;; STDERR ;;; -out/test/parse/expr/bad-loop-sig-multi.txt:5:5: error: multiple loop results not currently supported. +out/test/parse/expr/bad-loop-sig-multi.txt:5:5: error: multiple result values not currently supported. loop (result i32 i32) ^^^^ out/test/parse/expr/bad-loop-sig-multi.txt:14:5: error: loop params not currently supported. diff --git a/test/parse/expr/bad-try-sig-multi.txt b/test/parse/expr/bad-try-sig-multi.txt index b57af6b2..c626b615 100644 --- a/test/parse/expr/bad-try-sig-multi.txt +++ b/test/parse/expr/bad-try-sig-multi.txt @@ -22,7 +22,7 @@ end return)) (;; STDERR ;;; -out/test/parse/expr/bad-try-sig-multi.txt:6:5: error: multiple try results not currently supported. +out/test/parse/expr/bad-try-sig-multi.txt:6:5: error: multiple result values not currently supported. try (result i32 i32) ^^^ out/test/parse/expr/bad-try-sig-multi.txt:18:5: error: try params not currently supported. diff --git a/test/spec/bulk-memory-operations/binary.txt b/test/spec/bulk-memory-operations/binary.txt index 3b2eb85d..7a70ead3 100644 --- a/test/spec/bulk-memory-operations/binary.txt +++ b/test/spec/bulk-memory-operations/binary.txt @@ -129,9 +129,9 @@ out/test/spec/bulk-memory-operations/binary.wast:630: assert_malformed passed: out/test/spec/bulk-memory-operations/binary.wast:641: assert_malformed passed: 0000015: error: function signature count != function body count out/test/spec/bulk-memory-operations/binary.wast:664: assert_malformed passed: - 000000e: error: data section without memory section + 000000e: error: data segment count does not equal count in DataCount section out/test/spec/bulk-memory-operations/binary.wast:674: assert_malformed passed: - 000000e: error: data section without memory section + 000000e: error: data segment count does not equal count in DataCount section out/test/spec/bulk-memory-operations/binary.wast:684: assert_malformed passed: 0000024: error: memory.init requires data count section out/test/spec/bulk-memory-operations/binary.wast:706: assert_malformed passed: diff --git a/test/spec/bulk-memory-operations/data.txt b/test/spec/bulk-memory-operations/data.txt index 828b1ca1..0517b51c 100644 --- a/test/spec/bulk-memory-operations/data.txt +++ b/test/spec/bulk-memory-operations/data.txt @@ -3,7 +3,8 @@ ;;; ARGS*: --enable-bulk-memory (;; STDOUT ;;; out/test/spec/bulk-memory-operations/data.wast:293: assert_invalid passed: - 000000b: error: data section without memory section + 0000000: error: memory variable out of range: 0 (max 0) + 000000c: error: BeginDataSegment callback failed out/test/spec/bulk-memory-operations/data.wast:302: assert_invalid passed: 0000013: error: expected i32 init_expr out/test/spec/bulk-memory-operations/data.wast:310: assert_invalid passed: diff --git a/test/spec/bulk-memory-operations/elem.txt b/test/spec/bulk-memory-operations/elem.txt index b56ae0eb..419847d9 100644 --- a/test/spec/bulk-memory-operations/elem.txt +++ b/test/spec/bulk-memory-operations/elem.txt @@ -3,7 +3,8 @@ ;;; ARGS*: --enable-bulk-memory (;; STDOUT ;;; out/test/spec/bulk-memory-operations/elem.wast:300: assert_invalid passed: - 0000015: error: elem section without table section + 0000000: error: table variable out of range: 0 (max 0) + 0000016: error: BeginElemSegment callback failed out/test/spec/bulk-memory-operations/elem.wast:310: assert_invalid passed: 0000014: error: expected i32 init_expr out/test/spec/bulk-memory-operations/elem.wast:318: assert_invalid passed: diff --git a/test/spec/bulk-memory-operations/imports.txt b/test/spec/bulk-memory-operations/imports.txt index edb158ef..d5bdf58a 100644 --- a/test/spec/bulk-memory-operations/imports.txt +++ b/test/spec/bulk-memory-operations/imports.txt @@ -13,7 +13,8 @@ called host spectest.print_f64(f64:24.000000) => called host spectest.print_f64(f64:24.000000) => called host spectest.print_f64(f64:24.000000) => out/test/spec/bulk-memory-operations/imports.wast:91: assert_invalid passed: - 000001e: error: invalid import signature index + 0000000: error: function type variable out of range: 1 (max 1) + 000001e: error: OnImportFunc callback failed out/test/spec/bulk-memory-operations/imports.wast:107: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/bulk-memory-operations/imports.wast:111: assert_unlinkable passed: @@ -88,9 +89,11 @@ out/test/spec/bulk-memory-operations/imports.wast:310: assert_invalid passed: error: only one table allowed 0000017: error: OnImportTable callback failed out/test/spec/bulk-memory-operations/imports.wast:314: assert_invalid passed: - 0000014: error: table count (2) must be 0 or 1 + error: only one table allowed + 0000017: error: OnTable callback failed out/test/spec/bulk-memory-operations/imports.wast:318: assert_invalid passed: - 000000b: error: table count (2) must be 0 or 1 + error: only one table allowed + 0000011: error: OnTable callback failed out/test/spec/bulk-memory-operations/imports.wast:335: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/bulk-memory-operations/imports.wast:339: assert_unlinkable passed: @@ -117,9 +120,11 @@ out/test/spec/bulk-memory-operations/imports.wast:405: assert_invalid passed: error: only one memory block allowed 0000015: error: OnImportMemory callback failed out/test/spec/bulk-memory-operations/imports.wast:409: assert_invalid passed: - 0000013: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 0000015: error: OnMemory callback failed out/test/spec/bulk-memory-operations/imports.wast:413: assert_invalid passed: - 000000b: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 000000f: error: OnMemory callback failed out/test/spec/bulk-memory-operations/imports.wast:428: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/bulk-memory-operations/imports.wast:432: assert_unlinkable passed: diff --git a/test/spec/bulk-memory-operations/table_init.txt b/test/spec/bulk-memory-operations/table_init.txt index 61f8fdf7..9617a0a9 100644 --- a/test/spec/bulk-memory-operations/table_init.txt +++ b/test/spec/bulk-memory-operations/table_init.txt @@ -63,9 +63,12 @@ out/test/spec/bulk-memory-operations/table_init.wast:199: assert_invalid passed: 0000000: error: elem_segment variable out of range: 0 (max 0) 000002b: error: OnTableInitExpr callback failed out/test/spec/bulk-memory-operations/table_init.wast:205: assert_invalid passed: - 0000024: error: elem section without table section + 0000000: error: elem_segment variable out of range: 4 (max 1) + 0000035: error: OnElemDropExpr callback failed out/test/spec/bulk-memory-operations/table_init.wast:213: assert_invalid passed: - 0000024: error: elem section without table section + 0000000: error: table variable out of range: 0 (max 0) + 0000000: error: elem_segment variable out of range: 4 (max 1) + 000003c: error: OnTableInitExpr callback failed test() => out/test/spec/bulk-memory-operations/table_init.wast:265: assert_trap passed: out of bounds table access: table.init out of bounds test() => diff --git a/test/spec/call.txt b/test/spec/call.txt index 3b598e29..ee6fc882 100644 --- a/test/spec/call.txt +++ b/test/spec/call.txt @@ -51,8 +51,10 @@ out/test/spec/call.wast:444: assert_invalid passed: error: type mismatch in call, expected [i32, i32] but got [i32] 0000025: error: OnCallExpr callback failed out/test/spec/call.wast:457: assert_invalid passed: - 0000019: error: invalid call function index: 1 + 0000000: error: function variable out of range: 1 (max 1) + 0000019: error: OnCallExpr callback failed out/test/spec/call.wast:461: assert_invalid passed: - 000001d: error: invalid call function index: 1012321300 + 0000000: error: function variable out of range: 1012321300 (max 1) + 000001d: error: OnCallExpr callback failed 82/82 tests passed. ;;; STDOUT ;;) diff --git a/test/spec/call_indirect.txt b/test/spec/call_indirect.txt index 34ec7c0b..5859c2e5 100644 --- a/test/spec/call_indirect.txt +++ b/test/spec/call_indirect.txt @@ -137,9 +137,11 @@ out/test/spec/call_indirect.wast:902: assert_invalid passed: error: type mismatch in call_indirect, expected [i32, i32] but got [i32] 000003d: error: OnCallIndirectExpr callback failed out/test/spec/call_indirect.wast:922: assert_invalid passed: - 0000021: error: invalid call_indirect signature index + 0000000: error: function type variable out of range: 1 (max 1) + 0000022: error: OnCallIndirectExpr callback failed out/test/spec/call_indirect.wast:929: assert_invalid passed: - 0000025: error: invalid call_indirect signature index + 0000000: error: function type variable out of range: 1012321300 (max 1) + 0000026: error: OnCallIndirectExpr callback failed out/test/spec/call_indirect.wast:940: assert_invalid passed: 0000000: error: function variable out of range: 0 (max 0) 0000018: error: OnElemSegmentElemExpr_RefFunc callback failed diff --git a/test/spec/data.txt b/test/spec/data.txt index dc6abf60..d48f0999 100644 --- a/test/spec/data.txt +++ b/test/spec/data.txt @@ -30,7 +30,8 @@ out/test/spec/data.wast:266: assert_unlinkable passed: out/test/spec/data.wast:273: assert_unlinkable passed: error: out of bounds memory access: data segment is out of bounds: [4294967196, 4294967197) >= max value 65536 out/test/spec/data.wast:283: assert_invalid passed: - 000000b: error: data section without memory section + 0000000: error: memory variable out of range: 0 (max 0) + 000000c: error: BeginDataSegment callback failed out/test/spec/data.wast:292: assert_invalid passed: 0000013: error: expected i32 init_expr out/test/spec/data.wast:300: assert_invalid passed: diff --git a/test/spec/elem.txt b/test/spec/elem.txt index f332be43..273a1899 100644 --- a/test/spec/elem.txt +++ b/test/spec/elem.txt @@ -26,7 +26,8 @@ out/test/spec/elem.wast:229: assert_unlinkable passed: out/test/spec/elem.wast:237: assert_unlinkable passed: error: out of bounds table access: elem segment is out of bounds: [4294967286, 4294967287) >= max value 10 out/test/spec/elem.wast:248: assert_invalid passed: - 0000015: error: elem section without table section + 0000000: error: table variable out of range: 0 (max 0) + 0000016: error: BeginElemSegment callback failed out/test/spec/elem.wast:258: assert_invalid passed: 0000014: error: expected i32 init_expr out/test/spec/elem.wast:266: assert_invalid passed: diff --git a/test/spec/exports.txt b/test/spec/exports.txt index 3d105371..df3ded29 100644 --- a/test/spec/exports.txt +++ b/test/spec/exports.txt @@ -2,7 +2,8 @@ ;;; STDIN_FILE: third_party/testsuite/exports.wast (;; STDOUT ;;; out/test/spec/exports.wast:29: assert_invalid passed: - 0000019: error: invalid export func index: 1 + 0000000: error: function variable out of range: 1 (max 1) + 0000019: error: OnExport callback failed out/test/spec/exports.wast:33: assert_invalid passed: error: duplicate export "a" 000001d: error: OnExport callback failed @@ -19,7 +20,8 @@ out/test/spec/exports.wast:49: assert_invalid passed: error: duplicate export "a" 0000022: error: OnExport callback failed out/test/spec/exports.wast:78: assert_invalid passed: - 0000017: error: invalid export global index: 1 + 0000000: error: global variable out of range: 1 (max 1) + 0000017: error: OnExport callback failed out/test/spec/exports.wast:82: assert_invalid passed: error: duplicate export "a" 000001b: error: OnExport callback failed @@ -36,7 +38,8 @@ out/test/spec/exports.wast:98: assert_invalid passed: error: duplicate export "a" 0000020: error: OnExport callback failed out/test/spec/exports.wast:126: assert_invalid passed: - 0000015: error: invalid export table index: 1 + 0000000: error: table variable out of range: 1 (max 1) + 0000015: error: OnExport callback failed out/test/spec/exports.wast:130: assert_invalid passed: error: duplicate export "a" 0000019: error: OnExport callback failed @@ -50,7 +53,8 @@ out/test/spec/exports.wast:147: assert_invalid passed: error: duplicate export "a" 000001e: error: OnExport callback failed out/test/spec/exports.wast:175: assert_invalid passed: - 0000014: error: invalid export memory index: 1 + 0000000: error: memory variable out of range: 1 (max 1) + 0000014: error: OnExport callback failed out/test/spec/exports.wast:179: assert_invalid passed: error: duplicate export "a" 0000018: error: OnExport callback failed diff --git a/test/spec/func.txt b/test/spec/func.txt index 23c8e13e..1ae68de9 100644 --- a/test/spec/func.txt +++ b/test/spec/func.txt @@ -2,7 +2,8 @@ ;;; STDIN_FILE: third_party/testsuite/func.wast (;; STDOUT ;;; out/test/spec/func.wast:303: assert_invalid passed: - 000001a: error: invalid function signature index: 2 + 0000000: error: function type variable out of range: 2 (max 2) + 000001a: error: OnFunction callback failed out/test/spec/func.wast:387: assert_malformed passed: out/test/spec/func/func.4.wat:1:76: error: unexpected token "param", expected an instr. ... i32) (result i32)))(func (type $sig) (result i32) (param i32) (i32.const 0)) @@ -65,9 +66,11 @@ out/test/spec/func.wast:485: assert_invalid passed: error: type mismatch in f64.neg, expected [f64] but got [i64] 000001c: error: OnUnaryExpr callback failed out/test/spec/func.wast:493: assert_invalid passed: - 000000e: error: result count must be 0 or 1 + error: multiple result values not currently supported. + 0000010: error: OnFuncType callback failed out/test/spec/func.wast:497: assert_invalid passed: - 000000e: error: result count must be 0 or 1 + error: multiple result values not currently supported. + 0000010: error: OnFuncType callback failed out/test/spec/func.wast:506: assert_invalid passed: error: type mismatch in implicit return, expected [i32] but got [] 0000019: error: EndFunctionBody callback failed diff --git a/test/spec/func_ptrs.txt b/test/spec/func_ptrs.txt index 995067df..a49c5f9f 100644 --- a/test/spec/func_ptrs.txt +++ b/test/spec/func_ptrs.txt @@ -4,9 +4,11 @@ called host spectest.print_i32(i32:83) => four(i32:83) => out/test/spec/func_ptrs.wast:32: assert_invalid passed: - 000000b: error: elem section without table section + 0000000: error: table variable out of range: 0 (max 0) + 000000c: error: BeginElemSegment callback failed out/test/spec/func_ptrs.wast:33: assert_invalid passed: - 0000015: error: elem section without table section + 0000000: error: table variable out of range: 0 (max 0) + 0000016: error: BeginElemSegment callback failed out/test/spec/func_ptrs.wast:36: assert_invalid passed: 0000014: error: expected i32 init_expr out/test/spec/func_ptrs.wast:40: assert_invalid passed: @@ -14,9 +16,11 @@ out/test/spec/func_ptrs.wast:40: assert_invalid passed: out/test/spec/func_ptrs.wast:44: assert_invalid passed: 0000013: error: unexpected opcode in initializer expression: 0x1 out/test/spec/func_ptrs.wast:48: assert_invalid passed: - 000000c: error: invalid function signature index: 42 + 0000000: error: function type variable out of range: 42 (max 0) + 000000c: error: OnFunction callback failed out/test/spec/func_ptrs.wast:49: assert_invalid passed: - 0000020: error: invalid import signature index + 0000000: error: function type variable out of range: 43 (max 0) + 0000020: error: OnImportFunc callback failed out/test/spec/func_ptrs.wast:78: assert_trap passed: undefined table index out/test/spec/func_ptrs.wast:79: assert_trap passed: undefined table index out/test/spec/func_ptrs.wast:80: assert_trap passed: undefined table index diff --git a/test/spec/imports.txt b/test/spec/imports.txt index 7e444977..a03625fb 100644 --- a/test/spec/imports.txt +++ b/test/spec/imports.txt @@ -12,7 +12,8 @@ called host spectest.print_f64(f64:24.000000) => called host spectest.print_f64(f64:24.000000) => called host spectest.print_f64(f64:24.000000) => out/test/spec/imports.wast:91: assert_invalid passed: - 000001e: error: invalid import signature index + 0000000: error: function type variable out of range: 1 (max 1) + 000001e: error: OnImportFunc callback failed out/test/spec/imports.wast:107: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/imports.wast:111: assert_unlinkable passed: @@ -87,9 +88,11 @@ out/test/spec/imports.wast:310: assert_invalid passed: error: only one table allowed 0000017: error: OnImportTable callback failed out/test/spec/imports.wast:314: assert_invalid passed: - 0000014: error: table count (2) must be 0 or 1 + error: only one table allowed + 0000017: error: OnTable callback failed out/test/spec/imports.wast:318: assert_invalid passed: - 000000b: error: table count (2) must be 0 or 1 + error: only one table allowed + 0000011: error: OnTable callback failed out/test/spec/imports.wast:335: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/imports.wast:339: assert_unlinkable passed: @@ -116,9 +119,11 @@ out/test/spec/imports.wast:405: assert_invalid passed: error: only one memory block allowed 0000015: error: OnImportMemory callback failed out/test/spec/imports.wast:409: assert_invalid passed: - 0000013: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 0000015: error: OnMemory callback failed out/test/spec/imports.wast:413: assert_invalid passed: - 000000b: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 000000f: error: OnMemory callback failed out/test/spec/imports.wast:428: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/imports.wast:432: assert_unlinkable passed: diff --git a/test/spec/memory.txt b/test/spec/memory.txt index 0f32ef05..2c8e7cc9 100644 --- a/test/spec/memory.txt +++ b/test/spec/memory.txt @@ -2,15 +2,20 @@ ;;; STDIN_FILE: third_party/testsuite/memory.wast (;; STDOUT ;;; out/test/spec/memory.wast:8: assert_invalid passed: - 000000b: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 000000f: error: OnMemory callback failed out/test/spec/memory.wast:9: assert_invalid passed: - 0000021: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 0000023: error: OnMemory callback failed out/test/spec/memory.wast:18: assert_invalid passed: - 000000b: error: data section without memory section + 0000000: error: memory variable out of range: 0 (max 0) + 000000c: error: BeginDataSegment callback failed out/test/spec/memory.wast:19: assert_invalid passed: - 000000b: error: data section without memory section + 0000000: error: memory variable out of range: 0 (max 0) + 000000c: error: BeginDataSegment callback failed out/test/spec/memory.wast:20: assert_invalid passed: - 000000b: error: data section without memory section + 0000000: error: memory variable out of range: 0 (max 0) + 000000c: error: BeginDataSegment callback failed out/test/spec/memory.wast:23: assert_invalid passed: error: memory variable out of range: 0 (max 0) 000001c: error: OnLoadExpr callback failed @@ -30,18 +35,25 @@ out/test/spec/memory.wast:43: assert_invalid passed: error: memory variable out of range: 0 (max 0) 000001b: error: OnMemoryGrowExpr callback failed out/test/spec/memory.wast:49: assert_invalid passed: - 000000e: error: memory initial size must be <= max size + error: max pages (0) must be >= initial pages (1) + 000000e: error: OnMemory callback failed out/test/spec/memory.wast:53: assert_invalid passed: - 000000f: error: invalid memory initial size + error: initial pages (65537) must be <= (65536) + 000000f: error: OnMemory callback failed out/test/spec/memory.wast:57: assert_invalid passed: - 0000011: error: invalid memory initial size + error: initial pages (2147483648) must be <= (65536) + 0000011: error: OnMemory callback failed out/test/spec/memory.wast:61: assert_invalid passed: - 0000011: error: invalid memory initial size + error: initial pages (4294967295) must be <= (65536) + 0000011: error: OnMemory callback failed out/test/spec/memory.wast:65: assert_invalid passed: - 0000010: error: invalid memory max size + error: max pages (65537) must be <= (65536) + 0000010: error: OnMemory callback failed out/test/spec/memory.wast:69: assert_invalid passed: - 0000012: error: invalid memory max size + error: max pages (2147483648) must be <= (65536) + 0000012: error: OnMemory callback failed out/test/spec/memory.wast:73: assert_invalid passed: - 0000012: error: invalid memory max size + error: max pages (4294967295) must be <= (65536) + 0000012: error: OnMemory callback failed 63/63 tests passed. ;;; STDOUT ;;) diff --git a/test/spec/multi-value/binary.txt b/test/spec/multi-value/binary.txt index 72ec581c..414c17d2 100644 --- a/test/spec/multi-value/binary.txt +++ b/test/spec/multi-value/binary.txt @@ -134,7 +134,8 @@ out/test/spec/multi-value/binary.wast:741: assert_malformed passed: error: invalid depth: 11 (max 2) 0000024: error: OnBrTableExpr callback failed out/test/spec/multi-value/binary.wast:763: assert_malformed passed: - 0000025: error: expected valid block signature type + error: function type variable out of range: 11 (max 1) + 0000025: error: OnBlockExpr callback failed out/test/spec/multi-value/binary.wast:798: assert_malformed passed: 0000017: error: multiple Start sections 67/67 tests passed. diff --git a/test/spec/multi-value/call.txt b/test/spec/multi-value/call.txt index 5ba88725..3a174823 100644 --- a/test/spec/multi-value/call.txt +++ b/test/spec/multi-value/call.txt @@ -52,8 +52,10 @@ out/test/spec/multi-value/call.wast:499: assert_invalid passed: error: type mismatch in call, expected [i32, i32] but got [i32] 0000025: error: OnCallExpr callback failed out/test/spec/multi-value/call.wast:512: assert_invalid passed: - 0000019: error: invalid call function index: 1 + 0000000: error: function variable out of range: 1 (max 1) + 0000019: error: OnCallExpr callback failed out/test/spec/multi-value/call.wast:516: assert_invalid passed: - 000001d: error: invalid call function index: 1012321300 + 0000000: error: function variable out of range: 1012321300 (max 1) + 000001d: error: OnCallExpr callback failed 90/90 tests passed. ;;; STDOUT ;;) diff --git a/test/spec/multi-value/call_indirect.txt b/test/spec/multi-value/call_indirect.txt index 6b2fc14d..c06216e8 100644 --- a/test/spec/multi-value/call_indirect.txt +++ b/test/spec/multi-value/call_indirect.txt @@ -138,9 +138,11 @@ out/test/spec/multi-value/call_indirect.wast:931: assert_invalid passed: error: type mismatch in call_indirect, expected [i32, i32] but got [i32] 000003d: error: OnCallIndirectExpr callback failed out/test/spec/multi-value/call_indirect.wast:951: assert_invalid passed: - 0000021: error: invalid call_indirect signature index + 0000000: error: function type variable out of range: 1 (max 1) + 0000022: error: OnCallIndirectExpr callback failed out/test/spec/multi-value/call_indirect.wast:958: assert_invalid passed: - 0000025: error: invalid call_indirect signature index + 0000000: error: function type variable out of range: 1012321300 (max 1) + 0000026: error: OnCallIndirectExpr callback failed out/test/spec/multi-value/call_indirect.wast:969: assert_invalid passed: 0000000: error: function variable out of range: 0 (max 0) 0000018: error: OnElemSegmentElemExpr_RefFunc callback failed diff --git a/test/spec/multi-value/func.txt b/test/spec/multi-value/func.txt index daa10fa7..7eae22a9 100644 --- a/test/spec/multi-value/func.txt +++ b/test/spec/multi-value/func.txt @@ -3,7 +3,8 @@ ;;; ARGS*: --enable-multi-value (;; STDOUT ;;; out/test/spec/multi-value/func.wast:436: assert_invalid passed: - 000001a: error: invalid function signature index: 2 + 0000000: error: function type variable out of range: 2 (max 2) + 000001a: error: OnFunction callback failed out/test/spec/multi-value/func.wast:520: assert_malformed passed: out/test/spec/multi-value/func/func.4.wat:1:76: error: unexpected token "param", expected an instr. ... i32) (result i32)))(func (type $sig) (result i32) (param i32) (i32.const 0)) diff --git a/test/spec/reference-types/binary.txt b/test/spec/reference-types/binary.txt index 2e75a4c8..ecbf665d 100644 --- a/test/spec/reference-types/binary.txt +++ b/test/spec/reference-types/binary.txt @@ -173,9 +173,9 @@ out/test/spec/reference-types/binary.wast:937: assert_malformed passed: out/test/spec/reference-types/binary.wast:948: assert_malformed passed: 0000015: error: function signature count != function body count out/test/spec/reference-types/binary.wast:971: assert_malformed passed: - 000000e: error: data section without memory section + 000000e: error: data segment count does not equal count in DataCount section out/test/spec/reference-types/binary.wast:981: assert_malformed passed: - 000000e: error: data section without memory section + 000000e: error: data segment count does not equal count in DataCount section out/test/spec/reference-types/binary.wast:991: assert_malformed passed: 0000024: error: memory.init requires data count section out/test/spec/reference-types/binary.wast:1013: assert_malformed passed: diff --git a/test/spec/reference-types/data.txt b/test/spec/reference-types/data.txt index 721c1f9c..d3e3d4bc 100644 --- a/test/spec/reference-types/data.txt +++ b/test/spec/reference-types/data.txt @@ -3,7 +3,8 @@ ;;; ARGS*: --enable-reference-types (;; STDOUT ;;; out/test/spec/reference-types/data.wast:293: assert_invalid passed: - 000000b: error: data section without memory section + 0000000: error: memory variable out of range: 0 (max 0) + 000000c: error: BeginDataSegment callback failed out/test/spec/reference-types/data.wast:302: assert_invalid passed: 0000013: error: expected i32 init_expr out/test/spec/reference-types/data.wast:310: assert_invalid passed: diff --git a/test/spec/reference-types/elem.txt b/test/spec/reference-types/elem.txt index 531f5ee9..0ba0ec0e 100644 --- a/test/spec/reference-types/elem.txt +++ b/test/spec/reference-types/elem.txt @@ -5,7 +5,8 @@ out/test/spec/reference-types/elem.wast:320: assert_trap passed: out of bounds table access: table.init out of bounds out/test/spec/reference-types/elem.wast:330: assert_trap passed: out of bounds table access: table.init out of bounds out/test/spec/reference-types/elem.wast:335: assert_invalid passed: - 0000015: error: elem section without table section + 0000000: error: table variable out of range: 0 (max 0) + 0000016: error: BeginElemSegment callback failed out/test/spec/reference-types/elem.wast:345: assert_invalid passed: 0000014: error: expected i32 init_expr out/test/spec/reference-types/elem.wast:353: assert_invalid passed: diff --git a/test/spec/reference-types/exports.txt b/test/spec/reference-types/exports.txt index f6810f11..c1750d71 100644 --- a/test/spec/reference-types/exports.txt +++ b/test/spec/reference-types/exports.txt @@ -3,7 +3,8 @@ ;;; ARGS*: --enable-reference-types (;; STDOUT ;;; out/test/spec/reference-types/exports.wast:29: assert_invalid passed: - 0000019: error: invalid export func index: 1 + 0000000: error: function variable out of range: 1 (max 1) + 0000019: error: OnExport callback failed out/test/spec/reference-types/exports.wast:33: assert_invalid passed: error: duplicate export "a" 000001d: error: OnExport callback failed @@ -20,7 +21,8 @@ out/test/spec/reference-types/exports.wast:49: assert_invalid passed: error: duplicate export "a" 0000022: error: OnExport callback failed out/test/spec/reference-types/exports.wast:78: assert_invalid passed: - 0000017: error: invalid export global index: 1 + 0000000: error: global variable out of range: 1 (max 1) + 0000017: error: OnExport callback failed out/test/spec/reference-types/exports.wast:82: assert_invalid passed: error: duplicate export "a" 000001b: error: OnExport callback failed @@ -37,7 +39,8 @@ out/test/spec/reference-types/exports.wast:98: assert_invalid passed: error: duplicate export "a" 0000020: error: OnExport callback failed out/test/spec/reference-types/exports.wast:125: assert_invalid passed: - 0000015: error: invalid export table index: 1 + 0000000: error: table variable out of range: 1 (max 1) + 0000015: error: OnExport callback failed out/test/spec/reference-types/exports.wast:129: assert_invalid passed: error: duplicate export "a" 0000019: error: OnExport callback failed @@ -54,7 +57,8 @@ out/test/spec/reference-types/exports.wast:145: assert_invalid passed: error: duplicate export "a" 000001e: error: OnExport callback failed out/test/spec/reference-types/exports.wast:173: assert_invalid passed: - 0000014: error: invalid export memory index: 1 + 0000000: error: memory variable out of range: 1 (max 1) + 0000014: error: OnExport callback failed out/test/spec/reference-types/exports.wast:177: assert_invalid passed: error: duplicate export "a" 0000018: error: OnExport callback failed diff --git a/test/spec/reference-types/imports.txt b/test/spec/reference-types/imports.txt index 7756cbce..e26ea8fc 100644 --- a/test/spec/reference-types/imports.txt +++ b/test/spec/reference-types/imports.txt @@ -13,7 +13,8 @@ called host spectest.print_f64(f64:24.000000) => called host spectest.print_f64(f64:24.000000) => called host spectest.print_f64(f64:24.000000) => out/test/spec/reference-types/imports.wast:92: assert_invalid passed: - 000001e: error: invalid import signature index + 0000000: error: function type variable out of range: 1 (max 1) + 000001e: error: OnImportFunc callback failed out/test/spec/reference-types/imports.wast:108: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/reference-types/imports.wast:112: assert_unlinkable passed: @@ -114,9 +115,11 @@ out/test/spec/reference-types/imports.wast:417: assert_invalid passed: error: only one memory block allowed 0000015: error: OnImportMemory callback failed out/test/spec/reference-types/imports.wast:421: assert_invalid passed: - 0000013: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 0000015: error: OnMemory callback failed out/test/spec/reference-types/imports.wast:425: assert_invalid passed: - 000000b: error: memory count (2) must be 0 or 1 + error: only one memory block allowed + 000000f: error: OnMemory callback failed out/test/spec/reference-types/imports.wast:440: assert_unlinkable passed: error: invalid import "test.unknown" out/test/spec/reference-types/imports.wast:444: assert_unlinkable passed: diff --git a/test/spec/reference-types/select.txt b/test/spec/reference-types/select.txt index baeb089c..a7073f48 100644 --- a/test/spec/reference-types/select.txt +++ b/test/spec/reference-types/select.txt @@ -14,7 +14,8 @@ out/test/spec/reference-types/select.wast:373: assert_invalid passed: out/test/spec/reference-types/select.wast:377: assert_invalid passed: 000001d: error: invalid arity in select instrcution: 0 out/test/spec/reference-types/select.wast:381: assert_invalid passed: - 000000e: error: result count must be 0 or 1 + error: multiple result values not currently supported. + 0000010: error: OnFuncType callback failed out/test/spec/reference-types/select.wast:393: assert_invalid passed: error: type mismatch in select, expected [any, any, i32] but got [nullref, nullref, i32] 000001c: error: OnSelectExpr callback failed diff --git a/test/spec/reference-types/table_init.txt b/test/spec/reference-types/table_init.txt index 00bb678c..36b202d7 100644 --- a/test/spec/reference-types/table_init.txt +++ b/test/spec/reference-types/table_init.txt @@ -63,9 +63,12 @@ out/test/spec/reference-types/table_init.wast:199: assert_invalid passed: 0000000: error: elem_segment variable out of range: 0 (max 0) 000002b: error: OnTableInitExpr callback failed out/test/spec/reference-types/table_init.wast:205: assert_invalid passed: - 0000024: error: elem section without table section + 0000000: error: elem_segment variable out of range: 4 (max 1) + 0000035: error: OnElemDropExpr callback failed out/test/spec/reference-types/table_init.wast:213: assert_invalid passed: - 0000024: error: elem section without table section + 0000000: error: table variable out of range: 0 (max 0) + 0000000: error: elem_segment variable out of range: 4 (max 1) + 000003c: error: OnTableInitExpr callback failed test() => out/test/spec/reference-types/table_init.wast:265: assert_trap passed: out of bounds table access: table.init out of bounds test() => diff --git a/test/spec/reference-types/unreached-invalid.txt b/test/spec/reference-types/unreached-invalid.txt index 155ab6fb..a038ba74 100644 --- a/test/spec/reference-types/unreached-invalid.txt +++ b/test/spec/reference-types/unreached-invalid.txt @@ -9,7 +9,8 @@ out/test/spec/reference-types/unreached-invalid.wast:8: assert_invalid passed: 0000000: error: global variable out of range: 0 (max 0) 000001a: error: OnGlobalGetExpr callback failed out/test/spec/reference-types/unreached-invalid.wast:12: assert_invalid passed: - 000001a: error: invalid call function index: 1 + 0000000: error: function variable out of range: 1 (max 1) + 000001a: error: OnCallExpr callback failed out/test/spec/reference-types/unreached-invalid.wast:16: assert_invalid passed: error: invalid depth: 1 (max 0) 000001a: error: OnBrExpr callback failed diff --git a/test/spec/start.txt b/test/spec/start.txt index e215b9d1..9bc869ae 100644 --- a/test/spec/start.txt +++ b/test/spec/start.txt @@ -2,7 +2,8 @@ ;;; STDIN_FILE: third_party/testsuite/start.wast (;; STDOUT ;;; out/test/spec/start.wast:2: assert_invalid passed: - 0000015: error: invalid start function index: 1 + 0000000: error: function variable out of range: 1 (max 1) + 0000015: error: OnStartFunction callback failed out/test/spec/start.wast:7: assert_invalid passed: error: start function must not return anything 0000016: error: OnStartFunction callback failed diff --git a/test/spec/type.txt b/test/spec/type.txt index e69ec2a6..0dd53e13 100644 --- a/test/spec/type.txt +++ b/test/spec/type.txt @@ -11,8 +11,10 @@ out/test/spec/type.wast:48: assert_malformed passed: (type (func (result $x i32))) ^^ out/test/spec/type.wast:53: assert_invalid passed: - 000000e: error: result count must be 0 or 1 + error: multiple result values not currently supported. + 0000010: error: OnFuncType callback failed out/test/spec/type.wast:57: assert_invalid passed: - 000000e: error: result count must be 0 or 1 + error: multiple result values not currently supported. + 0000010: error: OnFuncType callback failed 4/4 tests passed. ;;; STDOUT ;;) diff --git a/test/spec/unreached-invalid.txt b/test/spec/unreached-invalid.txt index 6f93c9ab..77b45a10 100644 --- a/test/spec/unreached-invalid.txt +++ b/test/spec/unreached-invalid.txt @@ -8,7 +8,8 @@ out/test/spec/unreached-invalid.wast:8: assert_invalid passed: 0000000: error: global variable out of range: 0 (max 0) 000001a: error: OnGlobalGetExpr callback failed out/test/spec/unreached-invalid.wast:12: assert_invalid passed: - 000001a: error: invalid call function index: 1 + 0000000: error: function variable out of range: 1 (max 1) + 000001a: error: OnCallExpr callback failed out/test/spec/unreached-invalid.wast:16: assert_invalid passed: error: invalid depth: 1 (max 0) 000001a: error: OnBrExpr callback failed |