Skip to content

Commit 71bcab2

Browse files
chfastaxic
authored andcommitted
Optimize call result push to the stack
1 parent 7b700be commit 71bcab2

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

Diff for: lib/fizzy/execute.cpp

+3-5
Original file line numberDiff line numberDiff line change
@@ -524,12 +524,10 @@ inline bool invoke_function(const FuncType& func_type, uint32_t func_idx, Instan
524524

525525
stack.drop(num_args);
526526

527-
const auto num_outputs = func_type.outputs.size();
528-
// NOTE: we can assume these two from validation
529-
assert(num_outputs <= 1);
530-
assert(ret.has_value == (num_outputs == 1));
527+
// NOTE: validation ensures there are at most 1 output values
528+
assert(func_type.outputs.size() == (ret.has_value ? 1 : 0));
531529
// Push back the result
532-
if (num_outputs != 0)
530+
if (ret.has_value)
533531
stack.push(ret.value);
534532

535533
return true;

0 commit comments

Comments
 (0)