1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

LibWasm: Trap instead of VERIFY()'ing

...unless something really is an assertion.
This commit is contained in:
Ali Mohammad Pur 2021-05-07 09:59:18 +04:30 committed by Linus Groh
parent b3c13c3e8a
commit 541091500c
3 changed files with 144 additions and 81 deletions

View file

@ -12,6 +12,7 @@ namespace Wasm {
struct Interpreter {
void interpret(Configuration&);
bool did_trap() const { return m_do_trap; }
private:
void interpret(Configuration&, InstructionPointer&, const Instruction&);
@ -19,6 +20,14 @@ private:
ReadonlyBytes load_from_memory(Configuration&, const Instruction&, size_t);
void store_to_memory(Configuration&, const Instruction&, ReadonlyBytes data);
void call_address(Configuration&, FunctionAddress);
Vector<NonnullOwnPtr<Value>> pop_values(Configuration& configuration, size_t count);
bool trap_if_not(bool value)
{
if (!value)
m_do_trap = true;
return m_do_trap;
}
bool m_do_trap { false };
};
}