Skip to content

Commit af6391b

Browse files
authored
Rename "runtime" to "engine". (#256)
Signed-off-by: Piotr Sikora <[email protected]>
1 parent e9cfbd7 commit af6391b

File tree

18 files changed

+116
-100
lines changed

18 files changed

+116
-100
lines changed

.github/workflows/cpp.yml

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,15 +118,15 @@ jobs:
118118
matrix:
119119
include:
120120
- name: 'V8 on Linux/x86_64'
121-
runtime: 'v8'
121+
engine: 'v8'
122122
repo: 'v8'
123123
os: ubuntu-20.04
124124
arch: x86_64
125125
action: test
126126
flags: --config=clang --define=crypto=system
127127
cache: true
128128
- name: 'V8 on Linux/aarch64'
129-
runtime: 'v8'
129+
engine: 'v8'
130130
repo: 'v8'
131131
os: ubuntu-20.04
132132
arch: aarch64
@@ -135,42 +135,42 @@ jobs:
135135
deps: qemu-user-static libc6-arm64-cross
136136
cache: true
137137
- name: 'V8 on macOS/x86_64'
138-
runtime: 'v8'
138+
engine: 'v8'
139139
repo: 'v8'
140140
os: macos-11
141141
arch: x86_64
142142
action: test
143143
cache: true
144144
- name: 'WAMR on Linux/x86_64'
145-
runtime: 'wamr'
145+
engine: 'wamr'
146146
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
147147
os: ubuntu-20.04
148148
arch: x86_64
149149
action: test
150150
flags: --config=clang
151151
- name: 'WAMR on macOS/x86_64'
152-
runtime: 'wamr'
152+
engine: 'wamr'
153153
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
154154
os: macos-11
155155
arch: x86_64
156156
action: test
157157
- name: 'Wasmtime on Linux/x86_64'
158-
runtime: 'wasmtime'
158+
engine: 'wasmtime'
159159
repo: 'com_github_bytecodealliance_wasmtime'
160160
os: ubuntu-20.04
161161
arch: x86_64
162162
action: test
163163
flags: --config=clang
164164
- name: 'Wasmtime on Linux/aarch64'
165-
runtime: 'wasmtime'
165+
engine: 'wasmtime'
166166
repo: 'com_github_bytecodealliance_wasmtime'
167167
os: ubuntu-20.04
168168
arch: aarch64
169169
action: build
170170
flags: --config=zig-cc-linux-aarch64
171171
deps: qemu-user-static libc6-arm64-cross
172172
- name: 'Wasmtime on Linux/s390x'
173-
runtime: 'wasmtime'
173+
engine: 'wasmtime'
174174
repo: 'com_github_bytecodealliance_wasmtime'
175175
os: ubuntu-20.04
176176
arch: s390x
@@ -179,13 +179,13 @@ jobs:
179179
run_under: docker run --rm --env HOME=$HOME --env USER=$(id -un) --volume "$HOME:$HOME" --workdir $(pwd) --user $(id -u):$(id -g) --platform linux/s390x piotrsikora/build-tools:bazel-5.0.0-clang-13-gcc-11
180180
cache: true
181181
- name: 'Wasmtime on macOS/x86_64'
182-
runtime: 'wasmtime'
182+
engine: 'wasmtime'
183183
repo: 'com_github_bytecodealliance_wasmtime'
184184
os: macos-11
185185
arch: x86_64
186186
action: test
187187
- name: 'WAVM on Linux/x86_64'
188-
runtime: 'wavm'
188+
engine: 'wavm'
189189
repo: 'com_github_wavm_wavm'
190190
os: ubuntu-20.04
191191
arch: x86_64
@@ -216,9 +216,9 @@ jobs:
216216
path: |
217217
~/.cache/bazel
218218
/private/var/tmp/_bazel_runner/
219-
key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
219+
key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.engine }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
220220
restore-keys: |
221-
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-
221+
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.engine }}-${{ steps.cache-key.outputs.uniq }}-
222222
223223
- name: Download test data
224224
uses: actions/download-artifact@v2
@@ -240,7 +240,7 @@ jobs:
240240
bazel ${{ matrix.action }}
241241
--verbose_failures
242242
--test_output=errors
243-
--define runtime=${{ matrix.runtime }}
243+
--define engine=${{ matrix.engine }}
244244
${{ matrix.flags }}
245245
//test/...
246246
@@ -250,7 +250,7 @@ jobs:
250250
bazel ${{ matrix.action }}
251251
--verbose_failures
252252
--test_output=errors
253-
--define runtime=${{ matrix.runtime }}
253+
--define engine=${{ matrix.engine }}
254254
${{ matrix.flags }}
255255
--per_file_copt=src/signature_util.cc,test/signature_util_test.cc@-DPROXY_WASM_VERIFY_WITH_ED25519_PUBKEY=\"$(xxd -p -c 256 test/test_data/signature_key1.pub | cut -b9-)\"
256256
//test:signature_util_test

BUILD

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
load("@rules_cc//cc:defs.bzl", "cc_library")
22
load(
33
"@proxy_wasm_cpp_host//bazel:select.bzl",
4-
"proxy_wasm_select_runtime_v8",
5-
"proxy_wasm_select_runtime_wamr",
6-
"proxy_wasm_select_runtime_wasmtime",
7-
"proxy_wasm_select_runtime_wavm",
4+
"proxy_wasm_select_engine_v8",
5+
"proxy_wasm_select_engine_wamr",
6+
"proxy_wasm_select_engine_wasmtime",
7+
"proxy_wasm_select_engine_wavm",
88
)
99

1010
licenses(["notice"]) # Apache 2
@@ -82,7 +82,10 @@ cc_library(
8282
"include/proxy-wasm/null_vm_plugin.h",
8383
"include/proxy-wasm/wasm_api_impl.h",
8484
],
85-
defines = ["PROXY_WASM_HAS_RUNTIME_NULL"],
85+
defines = [
86+
"PROXY_WASM_HAS_RUNTIME_NULL",
87+
"PROXY_WASM_HOST_ENGINE_NULL",
88+
],
8689
deps = [
8790
":headers",
8891
"@com_google_protobuf//:protobuf_lite",
@@ -96,7 +99,10 @@ cc_library(
9699
"src/v8/v8.cc",
97100
],
98101
hdrs = ["include/proxy-wasm/v8.h"],
99-
defines = ["PROXY_WASM_HAS_RUNTIME_V8"],
102+
defines = [
103+
"PROXY_WASM_HAS_RUNTIME_V8",
104+
"PROXY_WASM_HOST_ENGINE_V8",
105+
],
100106
deps = [
101107
":wasm_vm_headers",
102108
"//external:wee8",
@@ -111,7 +117,10 @@ cc_library(
111117
"src/wamr/wamr.cc",
112118
],
113119
hdrs = ["include/proxy-wasm/wamr.h"],
114-
defines = ["PROXY_WASM_HAS_RUNTIME_WAMR"],
120+
defines = [
121+
"PROXY_WASM_HAS_RUNTIME_WAMR",
122+
"PROXY_WASM_HOST_ENGINE_WAMR",
123+
],
115124
deps = [
116125
":wasm_vm_headers",
117126
"//external:wamr",
@@ -126,7 +135,10 @@ cc_library(
126135
"src/wasmtime/wasmtime.cc",
127136
],
128137
hdrs = ["include/proxy-wasm/wasmtime.h"],
129-
defines = ["PROXY_WASM_HAS_RUNTIME_WASMTIME"],
138+
defines = [
139+
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
140+
"PROXY_WASM_HOST_ENGINE_WASMTIME",
141+
],
130142
deps = [
131143
":wasm_vm_headers",
132144
"//external:wasmtime",
@@ -144,7 +156,10 @@ cc_library(
144156
"-Wno-non-virtual-dtor",
145157
"-Wno-old-style-cast",
146158
],
147-
defines = ["PROXY_WASM_HAS_RUNTIME_WAVM"],
159+
defines = [
160+
"PROXY_WASM_HAS_RUNTIME_WAVM",
161+
"PROXY_WASM_HOST_ENGINE_WAVM",
162+
],
148163
deps = [
149164
":wasm_vm_headers",
150165
"//external:wavm",
@@ -156,13 +171,13 @@ cc_library(
156171
deps = [
157172
":base_lib",
158173
":null_lib",
159-
] + proxy_wasm_select_runtime_v8(
174+
] + proxy_wasm_select_engine_v8(
160175
[":v8_lib"],
161-
) + proxy_wasm_select_runtime_wamr(
176+
) + proxy_wasm_select_engine_wamr(
162177
[":wamr_lib"],
163-
) + proxy_wasm_select_runtime_wasmtime(
178+
) + proxy_wasm_select_engine_wasmtime(
164179
[":wasmtime_lib"],
165-
) + proxy_wasm_select_runtime_wavm(
180+
) + proxy_wasm_select_engine_wavm(
166181
[":wavm_lib"],
167182
),
168183
)

bazel/BUILD

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
load("@bazel_skylib//lib:selects.bzl", "selects")
22

33
config_setting(
4-
name = "runtime_v8",
5-
values = {"define": "runtime=v8"},
4+
name = "engine_v8",
5+
values = {"define": "engine=v8"},
66
)
77

88
config_setting(
9-
name = "runtime_wamr",
10-
values = {"define": "runtime=wamr"},
9+
name = "engine_wamr",
10+
values = {"define": "engine=wamr"},
1111
)
1212

1313
config_setting(
14-
name = "runtime_wasmtime",
15-
values = {"define": "runtime=wasmtime"},
14+
name = "engine_wasmtime",
15+
values = {"define": "engine=wasmtime"},
1616
)
1717

1818
config_setting(
19-
name = "runtime_wavm",
20-
values = {"define": "runtime=wavm"},
19+
name = "engine_wavm",
20+
values = {"define": "engine=wavm"},
2121
)
2222

2323
config_setting(

bazel/select.bzl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
def proxy_wasm_select_runtime_v8(xs):
15+
def proxy_wasm_select_engine_v8(xs):
1616
return select({
17-
"@proxy_wasm_cpp_host//bazel:runtime_v8": xs,
17+
"@proxy_wasm_cpp_host//bazel:engine_v8": xs,
1818
"//conditions:default": [],
1919
})
2020

21-
def proxy_wasm_select_runtime_wamr(xs):
21+
def proxy_wasm_select_engine_wamr(xs):
2222
return select({
23-
"@proxy_wasm_cpp_host//bazel:runtime_wamr": xs,
23+
"@proxy_wasm_cpp_host//bazel:engine_wamr": xs,
2424
"//conditions:default": [],
2525
})
2626

27-
def proxy_wasm_select_runtime_wasmtime(xs):
27+
def proxy_wasm_select_engine_wasmtime(xs):
2828
return select({
29-
"@proxy_wasm_cpp_host//bazel:runtime_wasmtime": xs,
29+
"@proxy_wasm_cpp_host//bazel:engine_wasmtime": xs,
3030
"//conditions:default": [],
3131
})
3232

33-
def proxy_wasm_select_runtime_wavm(xs):
33+
def proxy_wasm_select_engine_wavm(xs):
3434
return select({
35-
"@proxy_wasm_cpp_host//bazel:runtime_wavm": xs,
35+
"@proxy_wasm_cpp_host//bazel:engine_wavm": xs,
3636
"//conditions:default": [],
3737
})

include/proxy-wasm/context.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ class WasmVm;
4949
*/
5050
struct PluginBase {
5151
PluginBase(std::string_view name, std::string_view root_id, std::string_view vm_id,
52-
std::string_view runtime, std::string_view plugin_configuration, bool fail_open,
52+
std::string_view engine, std::string_view plugin_configuration, bool fail_open,
5353
std::string_view key)
5454
: name_(std::string(name)), root_id_(std::string(root_id)), vm_id_(std::string(vm_id)),
55-
runtime_(std::string(runtime)), plugin_configuration_(plugin_configuration),
55+
engine_(std::string(engine)), plugin_configuration_(plugin_configuration),
5656
fail_open_(fail_open),
5757
key_(root_id_ + "||" + plugin_configuration_ + "||" + std::string(key)),
5858
log_prefix_(makeLogPrefix()) {}
5959

6060
const std::string name_;
6161
const std::string root_id_;
6262
const std::string vm_id_;
63-
const std::string runtime_;
63+
const std::string engine_;
6464
const std::string plugin_configuration_;
6565
const bool fail_open_;
6666

include/proxy-wasm/null_vm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ struct NullVm : public WasmVm {
3232
NullVm(const NullVm &other) : plugin_name_(other.plugin_name_) {}
3333

3434
// WasmVm
35-
std::string_view runtime() override { return "null"; }
35+
std::string_view getEngineName() override { return "null"; }
3636
Cloneable cloneable() override { return Cloneable::InstantiatedModule; };
3737
std::unique_ptr<WasmVm> clone() override;
3838
bool load(std::string_view bytecode, std::string_view precompiled,

include/proxy-wasm/wasm_vm.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ class WasmVm {
180180
public:
181181
virtual ~WasmVm() = default;
182182
/**
183-
* Identify the Wasm runtime.
184-
* @return the name of the underlying Wasm runtime.
183+
* Identify the Wasm engine.
184+
* @return the name of the underlying Wasm engine.
185185
*/
186-
virtual std::string_view runtime() = 0;
186+
virtual std::string_view getEngineName() = 0;
187187

188188
/**
189189
* Whether or not the VM implementation supports cloning. Cloning is VM system dependent.

src/v8/v8.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class V8 : public WasmVm {
6060
V8() {}
6161

6262
// WasmVm
63-
std::string_view runtime() override { return "v8"; }
63+
std::string_view getEngineName() override { return "v8"; }
6464

6565
bool load(std::string_view bytecode, std::string_view precompiled,
6666
const std::unordered_map<uint32_t, std::string> function_names) override;

src/wamr/wamr.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Wamr : public WasmVm {
5555
public:
5656
Wamr() {}
5757

58-
std::string_view runtime() override { return "wamr"; }
58+
std::string_view getEngineName() override { return "wamr"; }
5959
std::string_view getPrecompiledSectionName() override { return ""; }
6060

6161
Cloneable cloneable() override { return Cloneable::NotCloneable; }

src/wasm.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ bool WasmBase::load(const std::string &code, bool allow_precompiled) {
231231
return false;
232232
}
233233

234-
if (wasm_vm_->runtime() == "null") {
234+
if (wasm_vm_->getEngineName() == "null") {
235235
auto ok = wasm_vm_->load(code, {}, {});
236236
if (!ok) {
237237
fail(FailState::UnableToInitializeCode, "Failed to load NullVM plugin");
@@ -292,7 +292,7 @@ bool WasmBase::load(const std::string &code, bool allow_precompiled) {
292292
return false;
293293
}
294294

295-
// Store for future use in non-cloneable runtimes.
295+
// Store for future use in non-cloneable Wasm engines.
296296
if (wasm_vm_->cloneable() == Cloneable::NotCloneable) {
297297
module_bytecode_ = stripped;
298298
module_precompiled_ = precompiled;

src/wasmtime/wasmtime.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class Wasmtime : public WasmVm {
5252
public:
5353
Wasmtime() {}
5454

55-
std::string_view runtime() override { return "wasmtime"; }
55+
std::string_view getEngineName() override { return "wasmtime"; }
5656
Cloneable cloneable() override { return Cloneable::CompiledBytecode; }
5757
std::string_view getPrecompiledSectionName() override { return ""; }
5858

src/wavm/wavm.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ struct Wavm : public WasmVm {
203203
~Wavm() override;
204204

205205
// WasmVm
206-
std::string_view runtime() override { return "wavm"; }
206+
std::string_view getEngineName() override { return "wavm"; }
207207
Cloneable cloneable() override { return Cloneable::InstantiatedModule; };
208208
std::unique_ptr<WasmVm> clone() override;
209209
bool load(std::string_view bytecode, std::string_view precompiled,

test/exports_test.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
namespace proxy_wasm {
3131
namespace {
3232

33-
auto test_values = testing::ValuesIn(getRuntimes());
33+
auto test_values = testing::ValuesIn(getWasmEngines());
3434

35-
INSTANTIATE_TEST_SUITE_P(Runtimes, TestVM, test_values);
35+
INSTANTIATE_TEST_SUITE_P(WasmEngines, TestVM, test_values);
3636

3737
class TestContext : public ContextBase {
3838
public:

test/null_vm_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class BaseVmTest : public testing::Test {
6464
TEST_F(BaseVmTest, NullVmStartup) {
6565
auto wasm_vm = createNullVm();
6666
EXPECT_TRUE(wasm_vm != nullptr);
67-
EXPECT_TRUE(wasm_vm->runtime() == "null");
67+
EXPECT_TRUE(wasm_vm->getEngineName() == "null");
6868
EXPECT_TRUE(wasm_vm->cloneable() == Cloneable::InstantiatedModule);
6969
auto wasm_vm_clone = wasm_vm->clone();
7070
EXPECT_TRUE(wasm_vm_clone != nullptr);

0 commit comments

Comments
 (0)