@@ -454,29 +454,29 @@ inline bool invoke_function(const FuncType& func_type, uint32_t func_idx, Instan
454454 OperandStack& stack, int depth) noexcept
455455{
456456 const auto func = [func_idx](Instance& _instance, span<const Value> args, int _depth) noexcept {
457- return execute (_instance, func_idx, args, _depth);
457+ return execute (_instance, func_idx, args. data () , _depth);
458458 };
459459 return invoke_function (func_type, func, instance, stack, depth);
460460}
461461} // namespace
462462
463- ExecutionResult execute (
464- Instance& instance, FuncIdx func_idx, span<const Value> args, int depth) noexcept
463+ ExecutionResult execute (Instance& instance, FuncIdx func_idx, const Value* args, int depth) noexcept
465464{
466465 assert (depth >= 0 );
467466 if (depth > CallStackLimit)
468467 return Trap;
469468
470- assert (args. size () == instance.module .get_function_type (func_idx). inputs . size () );
469+ const auto & func_type = instance.module .get_function_type (func_idx);
471470
472471 assert (instance.module .imported_function_types .size () == instance.imported_functions .size ());
473472 if (func_idx < instance.imported_functions .size ())
474- return instance.imported_functions [func_idx].function (instance, args, depth);
473+ return instance.imported_functions [func_idx].function (
474+ instance, {args, func_type.inputs .size ()}, depth);
475475
476476 const auto & code = instance.module .get_code (func_idx);
477477 auto * const memory = instance.memory .get ();
478478
479- OperandStack stack (args. data () , func_type.inputs .size (), code.local_count ,
479+ OperandStack stack (args, func_type.inputs .size (), code.local_count ,
480480 static_cast <size_t >(code.max_stack_height ));
481481
482482 const Instr* pc = code.instructions .data ();
0 commit comments