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:
parent
efb106069b
commit
3283c8a495
5 changed files with 15 additions and 20 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue