Skip to content

Commit

Permalink
Optimize result push
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast authored and axic committed Oct 5, 2020
1 parent 66158d4 commit e0d1d78
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/fizzy/execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,11 @@ inline bool invoke_function(const FuncType& func_type, uint32_t func_idx, Instan

stack.drop(num_args);

const auto num_outputs = func_type.outputs.size();
// NOTE: we can assume these two from validation
assert(num_outputs <= 1);
assert(ret.has_value == (num_outputs == 1));
assert(func_type.outputs.size() <= 1);
assert(ret.has_value == !func_type.outputs.empty());
// Push back the result
if (num_outputs != 0)
if (ret.has_value != 0)
stack.push(ret.value);

return true;
Expand Down

0 comments on commit e0d1d78

Please sign in to comment.