mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 17:18:11 +00:00
LibWasm: Give traps a reason and display it when needed
This makes debugging wasm code a bit easier, as we now know what fails instead of just "too bad, something went wrong".
This commit is contained in:
parent
62ca81fdcc
commit
b538e15548
10 changed files with 54 additions and 50 deletions
|
@ -68,10 +68,10 @@ Result Configuration::execute(Interpreter& interpreter)
|
|||
{
|
||||
interpreter.interpret(*this);
|
||||
if (interpreter.did_trap())
|
||||
return Trap {};
|
||||
return Trap { interpreter.trap_reason() };
|
||||
|
||||
if (stack().size() <= frame().arity() + 1)
|
||||
return Trap {};
|
||||
return Trap { "Not enough values to return from call" };
|
||||
|
||||
Vector<Value> results;
|
||||
results.ensure_capacity(frame().arity());
|
||||
|
@ -80,7 +80,7 @@ Result Configuration::execute(Interpreter& interpreter)
|
|||
auto label = stack().pop();
|
||||
// ASSERT: label == current frame
|
||||
if (!label.has<Label>())
|
||||
return Trap {};
|
||||
return Trap { "Invalid stack configuration" };
|
||||
return Result { move(results) };
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue