LibWasm: Parse struct types and support multiple types in type section

This patch adds support for parsing structs in the type section.

It also removes the assumption that all types in the type section are
function types, adding appropriate validation.

Spec tests struct.3 and struct.4 have been disable as this would
require expanding `ValueType` to include more heap-types.
This commit is contained in:
Marcus Nilsson
2026-02-02 17:44:20 +01:00
committed by Ali Mohammad Pur
parent b5b3e37fac
commit bfa51c2555
Notes: github-actions[bot] 2026-02-06 10:35:53 +00:00
13 changed files with 249 additions and 53 deletions

View File

@@ -320,7 +320,7 @@ private:
class ModuleInstance {
public:
explicit ModuleInstance(
Vector<FunctionType> types, Vector<FunctionAddress> function_addresses, Vector<TableAddress> table_addresses, Vector<MemoryAddress> memory_addresses, Vector<GlobalAddress> global_addresses, Vector<DataAddress> data_addresses, Vector<TagAddress> tag_addresses, Vector<TagType> tag_types, Vector<ExportInstance> exports, size_t minimum_call_record_allocation_size)
Vector<TypeSection::Type> types, Vector<FunctionAddress> function_addresses, Vector<TableAddress> table_addresses, Vector<MemoryAddress> memory_addresses, Vector<GlobalAddress> global_addresses, Vector<DataAddress> data_addresses, Vector<TagAddress> tag_addresses, Vector<TagType> tag_types, Vector<ExportInstance> exports, size_t minimum_call_record_allocation_size)
: cached_minimum_call_record_allocation_size(minimum_call_record_allocation_size)
, m_types(move(types))
, m_tag_types(move(tag_types))
@@ -361,7 +361,7 @@ public:
size_t cached_minimum_call_record_allocation_size { 0 };
private:
Vector<FunctionType> m_types;
Vector<TypeSection::Type> m_types;
Vector<TagType> m_tag_types;
Vector<FunctionAddress> m_functions;
Vector<TableAddress> m_tables;