mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
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:
committed by
Ali Mohammad Pur
parent
b5b3e37fac
commit
bfa51c2555
Notes:
github-actions[bot]
2026-02-06 10:35:53 +00:00
Author: https://github.com/mkanilsson Commit: https://github.com/LadybirdBrowser/ladybird/commit/bfa51c2555a Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7731 Reviewed-by: https://github.com/alimpfard
@@ -2008,7 +2008,7 @@ HANDLE_INSTRUCTION(call_indirect)
|
||||
TRAP_IN_LOOP_IF_NOT(element.ref().template has<Reference::Func>());
|
||||
auto address = element.ref().template get<Reference::Func>().address;
|
||||
auto const& type_actual = configuration.store().get(address)->visit([](auto& f) -> decltype(auto) { return f.type(); });
|
||||
auto const& type_expected = configuration.frame().module().types()[args.type.value()];
|
||||
auto const& type_expected = configuration.frame().module().types()[args.type.value()].unsafe_function();
|
||||
TRAP_IN_LOOP_IF_NOT(type_actual.parameters().size() == type_expected.parameters().size());
|
||||
TRAP_IN_LOOP_IF_NOT(type_actual.results().size() == type_expected.results().size());
|
||||
TRAP_IN_LOOP_IF_NOT(type_actual.parameters() == type_expected.parameters());
|
||||
@@ -2035,7 +2035,7 @@ HANDLE_INSTRUCTION(return_call_indirect)
|
||||
TRAP_IN_LOOP_IF_NOT(element.ref().template has<Reference::Func>());
|
||||
auto address = element.ref().template get<Reference::Func>().address;
|
||||
auto const& type_actual = configuration.store().get(address)->visit([](auto& f) -> decltype(auto) { return f.type(); });
|
||||
auto const& type_expected = configuration.frame().module().types()[args.type.value()];
|
||||
auto const& type_expected = configuration.frame().module().types()[args.type.value()].unsafe_function();
|
||||
TRAP_IN_LOOP_IF_NOT(type_actual.parameters().size() == type_expected.parameters().size());
|
||||
TRAP_IN_LOOP_IF_NOT(type_actual.results().size() == type_expected.results().size());
|
||||
TRAP_IN_LOOP_IF_NOT(type_actual.parameters() == type_expected.parameters());
|
||||
|
||||
Reference in New Issue
Block a user