Skip to content

Commit

Permalink
Optimize result push
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 25, 2020
1 parent 180d1a3 commit c2d6235
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 @@ -90,12 +90,11 @@ inline bool invoke_function(const FuncType& func_type, uint32_t func_idx, Instan
if (ret.trapped)
return false;

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 c2d6235

Please sign in to comment.