mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
LibWasm: Make the main module's functions addressable by globals
This commit is contained in:
parent
9204a60397
commit
aafef1e92d
Notes:
sideshowbarker
2024-07-17 02:37:08 +09:00
Author: https://github.com/alimpfard Commit: https://github.com/SerenityOS/serenity/commit/aafef1e92d Pull-request: https://github.com/SerenityOS/serenity/pull/19881 Reviewed-by: https://github.com/Dexesttp
1 changed files with 7 additions and 6 deletions
|
@ -162,6 +162,13 @@ InstantiationResult AbstractMachine::instantiate(Module const& module, Vector<Ex
|
|||
auxiliary_instance.globals().append(*ptr);
|
||||
}
|
||||
|
||||
for (auto& func : module.functions()) {
|
||||
auto address = m_store.allocate(main_module_instance, func);
|
||||
VERIFY(address.has_value());
|
||||
auxiliary_instance.functions().append(*address);
|
||||
main_module_instance.functions().append(*address);
|
||||
}
|
||||
|
||||
BytecodeInterpreter interpreter(m_stack_info);
|
||||
|
||||
module.for_each_section_of_type<GlobalSection>([&](auto& global_section) {
|
||||
|
@ -399,12 +406,6 @@ Optional<InstantiationError> AbstractMachine::allocate_all_initial_phase(Module
|
|||
|
||||
// FIXME: What if this fails?
|
||||
|
||||
for (auto& func : module.functions()) {
|
||||
auto address = m_store.allocate(module_instance, func);
|
||||
VERIFY(address.has_value());
|
||||
module_instance.functions().append(*address);
|
||||
}
|
||||
|
||||
module.for_each_section_of_type<TableSection>([&](TableSection const& section) {
|
||||
for (auto& table : section.tables()) {
|
||||
auto table_address = m_store.allocate(table.type());
|
||||
|
|
Loading…
Reference in a new issue