Skip to content

Commit

Permalink
Drop call arguments _after_ the call
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Oct 5, 2020
1 parent f61a8f1 commit a2dd39b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/fizzy/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,13 +432,14 @@ bool invoke_function(const FuncType& func_type, const F& func, Instance& instanc
const auto num_args = func_type.inputs.size();
assert(stack.size() >= num_args);
span<const Value> call_args{stack.rend() - num_args, num_args};
stack.drop(num_args);

const auto ret = func(instance, call_args, depth + 1);
// Bubble up traps
if (ret.trapped)
return false;

stack.drop(num_args);

const auto num_outputs = func_type.outputs.size();
// NOTE: we can assume these two from validation
assert(num_outputs <= 1);
Expand Down

0 comments on commit a2dd39b

Please sign in to comment.