Skip to content

Commit

Permalink
Optimize result push
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Oct 13, 2020
1 parent 11a3ee4 commit f9d4dbf
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 @@ -495,12 +495,11 @@ inline bool invoke_function(const FuncType& func_type, const F& func, Instance&

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 f9d4dbf

Please sign in to comment.