@@ -510,10 +510,9 @@ void branch(const Code& code, OperandStack& stack, const uint8_t*& pc, uint32_t
510510 stack.drop (stack_drop);
511511}
512512
513- inline bool invoke_function (const FuncType& func_type , uint32_t func_idx, Instance& instance,
513+ inline bool invoke_function (size_t num_args , uint32_t func_idx, Instance& instance,
514514 OperandStack& stack, ExecutionContext& ctx) noexcept
515515{
516- const auto num_args = func_type.inputs .size ();
517516 assert (stack.size () >= num_args);
518517 const auto call_args = stack.rend () - num_args;
519518
@@ -629,9 +628,10 @@ ExecutionResult execute(
629628 case Instr::call:
630629 {
631630 const auto called_func_idx = read<uint32_t >(pc);
632- const auto & called_func_type = instance.module ->get_function_type (called_func_idx);
631+ const auto called_func_num_args =
632+ instance.module ->get_function_type (called_func_idx).inputs .size ();
633633
634- if (!invoke_function (called_func_type , called_func_idx, instance, stack, ctx))
634+ if (!invoke_function (called_func_num_args , called_func_idx, instance, stack, ctx))
635635 goto trap;
636636 break ;
637637 }
@@ -657,8 +657,8 @@ ExecutionResult execute(
657657 if (expected_type != actual_type)
658658 goto trap;
659659
660- if (!invoke_function (
661- actual_type, called_func. func_idx , *called_func.instance , stack, ctx))
660+ if (!invoke_function (actual_type. inputs . size (), called_func. func_idx ,
661+ *called_func.instance , stack, ctx))
662662 goto trap;
663663 break ;
664664 }
0 commit comments