1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-11 18:20:43 +09:00

LibWasm: Decouple ModuleInstance from the AbstractMachine

This fixes a FIXME and will allow linking only select modules together,
instead of linking every instantiated module into a big mess of exported
entities :P
This commit is contained in:
Ali Mohammad Pur 2021-05-10 15:40:49 +04:30 committed by Linus Groh
parent 24b2a6c93a
commit efb106069b
Notes: sideshowbarker 2024-07-18 17:39:46 +09:00
4 changed files with 55 additions and 47 deletions

View file

@ -70,6 +70,7 @@ int main(int argc, char* argv[])
warnln("Module instantiation failed: {}", result.error().error);
return 1;
}
auto module_instance = result.release_value();
auto stream = Core::OutputFileStream::standard_output();
auto print_func = [&](const auto& address) {
@ -90,7 +91,7 @@ int main(int argc, char* argv[])
};
if (print) {
// Now, let's dump the functions!
for (auto& address : machine.module_instance().functions()) {
for (auto& address : module_instance.functions()) {
print_func(address);
}
}
@ -98,7 +99,7 @@ int main(int argc, char* argv[])
if (!exported_function_to_execute.is_empty()) {
Optional<Wasm::FunctionAddress> run_address;
Vector<Wasm::Value> values;
for (auto& entry : machine.module_instance().exports()) {
for (auto& entry : module_instance.exports()) {
if (entry.name() == exported_function_to_execute) {
if (auto addr = entry.value().get_pointer<Wasm::FunctionAddress>())
run_address = *addr;