Skip to content

Commit 781931c

Browse files
committed
Pass arguments as const Value*
1 parent b269b5d commit 781931c

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/fizzy/execute.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ inline bool invoke_function(const FuncType& func_type, uint32_t func_idx, Instan
8181
OperandStack& stack, int depth) noexcept
8282
{
8383
const auto func = [func_idx](Instance& _instance, span<const Value> args, int _depth) noexcept {
84-
return execute(_instance, func_idx, args.begin(), _depth);
84+
return execute(_instance, func_idx, args.data(), _depth);
8585
};
8686
return invoke_function(func_type, func, instance, stack, depth);
8787
}

lib/fizzy/instantiate.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ std::unique_ptr<Instance> instantiate(Module module,
328328
for (const auto idx : instance->module.elementsec[i].init)
329329
{
330330
auto func = [idx, &instance_ref = *instance](fizzy::Instance&, span<const Value> args,
331-
int depth) { return execute(instance_ref, idx, args.begin(), depth); };
331+
int depth) { return execute(instance_ref, idx, args.data(), depth); };
332332

333333
*it_table++ =
334334
ExternalFunction{std::move(func), instance->module.get_function_type(idx)};
@@ -433,7 +433,7 @@ std::optional<ExternalFunction> find_exported_function(Instance& instance, std::
433433

434434
const auto idx = *opt_index;
435435
auto func = [idx, &instance](fizzy::Instance&, span<const Value> args, int depth) {
436-
return execute(instance, idx, args.begin(), depth);
436+
return execute(instance, idx, args.data(), depth);
437437
};
438438

439439
return ExternalFunction{std::move(func), instance.module.get_function_type(idx)};

test/unittests/execute_call_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ TEST(execute_call, imported_function_from_another_module)
338338
ASSERT_TRUE(func_idx.has_value());
339339

340340
auto sub = [&instance1, func_idx](Instance&, span<const Value> args, int) -> ExecutionResult {
341-
return fizzy::execute(*instance1, *func_idx, args.begin());
341+
return fizzy::execute(*instance1, *func_idx, args.data());
342342
};
343343

344344
auto instance2 = instantiate(module2, {{sub, module1.typesec[0]}});

0 commit comments

Comments
 (0)