diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-05-07 09:59:18 +0430 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-05-21 00:15:23 +0100 |
commit | 541091500cdda95b47a7ca1861e52d55b7879ee9 (patch) | |
tree | bc937c60e4e1bb926c0262be032bdf76e9093ce1 /Userland/Libraries/LibWasm/AbstractMachine/Interpreter.h | |
parent | b3c13c3e8ae4e65310714283980dd42b2da30be8 (diff) | |
download | serenity-541091500cdda95b47a7ca1861e52d55b7879ee9.zip |
LibWasm: Trap instead of VERIFY()'ing
...unless something really is an assertion.
Diffstat (limited to 'Userland/Libraries/LibWasm/AbstractMachine/Interpreter.h')
-rw-r--r-- | Userland/Libraries/LibWasm/AbstractMachine/Interpreter.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.h b/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.h index cdfaa32fcf..e78f8f462d 100644 --- a/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.h +++ b/Userland/Libraries/LibWasm/AbstractMachine/Interpreter.h @@ -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 }; }; } |