1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +00:00

LibWasm: Implement module validation

This commit is contained in:
Ali Mohammad Pur 2021-11-01 01:36:35 +03:30 committed by Andreas Kling
parent 30736c39b9
commit 7d1142e2c8
9 changed files with 3113 additions and 2 deletions

View file

@ -373,6 +373,7 @@ public:
auto is_mutable() const { return m_mutable; }
auto& value() const { return m_value; }
GlobalType type() const { return { m_value.type(), is_mutable() }; }
void set_value(Value value)
{
VERIFY(is_mutable());
@ -489,6 +490,8 @@ class AbstractMachine {
public:
explicit AbstractMachine() = default;
// Validate a module; permanently sets the module's validity status.
ErrorOr<void, ValidationError> validate(Module&);
// Load and instantiate a module, and link it into this interpreter.
InstantiationResult instantiate(Module const&, Vector<ExternValue>);
Result invoke(FunctionAddress, Vector<Value>);