1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 20:28:11 +00:00

LibWasm: Make the instantiation process produce an OwnPtr

Managing the instantiated modules becomes a pain if they're on the
stack, since an instantiated module will eventually reference itself.
To make using this simpler, just avoid copying the instance.
This commit is contained in:
Ali Mohammad Pur 2021-05-11 04:44:59 +04:30 committed by Linus Groh
parent efb106069b
commit 3283c8a495
5 changed files with 15 additions and 20 deletions

View file

@ -91,7 +91,7 @@ int main(int argc, char* argv[])
};
if (print) {
// Now, let's dump the functions!
for (auto& address : module_instance.functions()) {
for (auto& address : module_instance->functions()) {
print_func(address);
}
}
@ -99,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 : 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;