Skip to content

Commit 7526cf2

Browse files
committed
Move execute(Module, ...) to execute_helpers.hpp
1 parent 5dee837 commit 7526cf2

8 files changed

Lines changed: 21 additions & 8 deletions

File tree

lib/fizzy/execute.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,12 +1464,6 @@ execution_result execute(
14641464
return {trap, {stack.rbegin(), stack.rend()}};
14651465
}
14661466

1467-
execution_result execute(const Module& module, FuncIdx func_idx, std::vector<uint64_t> args)
1468-
{
1469-
auto instance = instantiate(module);
1470-
return execute(*instance, func_idx, std::move(args));
1471-
}
1472-
14731467
std::vector<ExternalFunction> resolve_imported_functions(
14741468
const Module& module, std::vector<ImportedFunction> imported_functions)
14751469
{

lib/fizzy/execute.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ std::unique_ptr<Instance> instantiate(Module module,
9797
execution_result execute(
9898
Instance& instance, FuncIdx func_idx, std::vector<uint64_t> args, int depth = 0);
9999

100-
// TODO: remove this helper
101-
execution_result execute(const Module& module, FuncIdx func_idx, std::vector<uint64_t> args);
102100

103101
// Function that should be used by instantiate as imports, identified by module and function name.
104102
struct ImportedFunction

test/unittests/execute_call_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "parser.hpp"
88
#include <gtest/gtest.h>
99
#include <test/utils/asserts.hpp>
10+
#include <test/utils/execute_helpers.hpp>
1011
#include <test/utils/hex.hpp>
1112

1213
using namespace fizzy;

test/unittests/execute_control_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "parser.hpp"
77
#include <gtest/gtest.h>
88
#include <test/utils/asserts.hpp>
9+
#include <test/utils/execute_helpers.hpp>
910
#include <test/utils/hex.hpp>
1011

1112
using namespace fizzy;

test/unittests/execute_numeric_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "parser.hpp"
77
#include <gtest/gtest.h>
88
#include <test/utils/asserts.hpp>
9+
#include <test/utils/execute_helpers.hpp>
910
#include <test/utils/hex.hpp>
1011

1112
using namespace fizzy;

test/unittests/execute_test.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include "parser.hpp"
88
#include <gtest/gtest.h>
99
#include <test/utils/asserts.hpp>
10+
#include <test/utils/execute_helpers.hpp>
1011
#include <test/utils/hex.hpp>
1112

1213
using namespace fizzy;

test/utils/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ target_sources(
1313
adler32.hpp
1414
asserts.cpp
1515
asserts.hpp
16+
execute_helpers.hpp
1617
fizzy_engine.cpp
1718
hex.cpp
1819
hex.hpp

test/utils/execute_helpers.hpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Fizzy: A fast WebAssembly interpreter
2+
// Copyright 2020 The Fizzy Authors.
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
#pragma once
6+
7+
#include "execute.hpp"
8+
9+
namespace fizzy::test
10+
{
11+
inline execution_result execute(const Module& module, FuncIdx func_idx, std::vector<uint64_t> args)
12+
{
13+
auto instance = instantiate(module);
14+
return execute(*instance, func_idx, std::move(args));
15+
}
16+
} // namespace fizzy::test

0 commit comments

Comments
 (0)