1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +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

@ -219,7 +219,7 @@ public:
auto& code() const { return m_code; }
private:
const FunctionType& m_type;
FunctionType m_type;
const ModuleInstance& m_module;
const Module::Function& m_code;
};
@ -237,7 +237,7 @@ public:
private:
FlatPtr m_ptr { 0 };
const FunctionType& m_type;
FunctionType m_type;
};
using FunctionInstance = Variant<WasmFunction, HostFunction>;
@ -418,7 +418,7 @@ private:
Vector<EntryType> m_data;
};
using InstantiationResult = AK::Result<ModuleInstance, InstantiationError>;
using InstantiationResult = AK::Result<NonnullOwnPtr<ModuleInstance>, InstantiationError>;
class AbstractMachine {
public: