mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2026-05-07 19:10:30 +00: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:
parent
b5b3e37fac
commit
bfa51c2555
Notes:
github-actions[bot]
2026-02-06 10:35:53 +00:00
Author: https://github.com/mkanilsson
Commit: bfa51c2555
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7731
Reviewed-by: https://github.com/alimpfard
13 changed files with 249 additions and 53 deletions
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue