Skip to content

Rename "runtime" to "engine". #256

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Feb 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@ jobs:
matrix:
include:
- name: 'V8 on Linux/x86_64'
runtime: 'v8'
engine: 'v8'
repo: 'v8'
os: ubuntu-20.04
arch: x86_64
action: test
flags: --config=clang --define=crypto=system
cache: true
- name: 'V8 on Linux/aarch64'
runtime: 'v8'
engine: 'v8'
repo: 'v8'
os: ubuntu-20.04
arch: aarch64
Expand All @@ -135,42 +135,42 @@ jobs:
deps: qemu-user-static libc6-arm64-cross
cache: true
- name: 'V8 on macOS/x86_64'
runtime: 'v8'
engine: 'v8'
repo: 'v8'
os: macos-11
arch: x86_64
action: test
cache: true
- name: 'WAMR on Linux/x86_64'
runtime: 'wamr'
engine: 'wamr'
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
os: ubuntu-20.04
arch: x86_64
action: test
flags: --config=clang
- name: 'WAMR on macOS/x86_64'
runtime: 'wamr'
engine: 'wamr'
repo: 'com_github_bytecodealliance_wasm_micro_runtime'
os: macos-11
arch: x86_64
action: test
- name: 'Wasmtime on Linux/x86_64'
runtime: 'wasmtime'
engine: 'wasmtime'
repo: 'com_github_bytecodealliance_wasmtime'
os: ubuntu-20.04
arch: x86_64
action: test
flags: --config=clang
- name: 'Wasmtime on Linux/aarch64'
runtime: 'wasmtime'
engine: 'wasmtime'
repo: 'com_github_bytecodealliance_wasmtime'
os: ubuntu-20.04
arch: aarch64
action: build
flags: --config=zig-cc-linux-aarch64
deps: qemu-user-static libc6-arm64-cross
- name: 'Wasmtime on Linux/s390x'
runtime: 'wasmtime'
engine: 'wasmtime'
repo: 'com_github_bytecodealliance_wasmtime'
os: ubuntu-20.04
arch: s390x
Expand All @@ -179,13 +179,13 @@ jobs:
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
cache: true
- name: 'Wasmtime on macOS/x86_64'
runtime: 'wasmtime'
engine: 'wasmtime'
repo: 'com_github_bytecodealliance_wasmtime'
os: macos-11
arch: x86_64
action: test
- name: 'WAVM on Linux/x86_64'
runtime: 'wavm'
engine: 'wavm'
repo: 'com_github_wavm_wavm'
os: ubuntu-20.04
arch: x86_64
Expand Down Expand Up @@ -216,9 +216,9 @@ jobs:
path: |
~/.cache/bazel
/private/var/tmp/_bazel_runner/
key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
key: ${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.engine }}-${{ steps.cache-key.outputs.uniq }}-${{ hashFiles('WORKSPACE', '.bazelrc', '.bazelversion', 'bazel/dependencies.bzl', 'bazel/repositories.bzl') }}
restore-keys: |
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.runtime }}-${{ steps.cache-key.outputs.uniq }}-
${{ matrix.arch }}-${{ matrix.os }}-${{ matrix.engine }}-${{ steps.cache-key.outputs.uniq }}-

- name: Download test data
uses: actions/download-artifact@v2
Expand All @@ -240,7 +240,7 @@ jobs:
bazel ${{ matrix.action }}
--verbose_failures
--test_output=errors
--define runtime=${{ matrix.runtime }}
--define engine=${{ matrix.engine }}
${{ matrix.flags }}
//test/...

Expand All @@ -250,7 +250,7 @@ jobs:
bazel ${{ matrix.action }}
--verbose_failures
--test_output=errors
--define runtime=${{ matrix.runtime }}
--define engine=${{ matrix.engine }}
${{ matrix.flags }}
--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-)\"
//test:signature_util_test
Expand Down
41 changes: 28 additions & 13 deletions BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
load("@rules_cc//cc:defs.bzl", "cc_library")
load(
"@proxy_wasm_cpp_host//bazel:select.bzl",
"proxy_wasm_select_runtime_v8",
"proxy_wasm_select_runtime_wamr",
"proxy_wasm_select_runtime_wasmtime",
"proxy_wasm_select_runtime_wavm",
"proxy_wasm_select_engine_v8",
"proxy_wasm_select_engine_wamr",
"proxy_wasm_select_engine_wasmtime",
"proxy_wasm_select_engine_wavm",
)

licenses(["notice"]) # Apache 2
Expand Down Expand Up @@ -82,7 +82,10 @@ cc_library(
"include/proxy-wasm/null_vm_plugin.h",
"include/proxy-wasm/wasm_api_impl.h",
],
defines = ["PROXY_WASM_HAS_RUNTIME_NULL"],
defines = [
"PROXY_WASM_HAS_RUNTIME_NULL",
"PROXY_WASM_HOST_ENGINE_NULL",
],
deps = [
":headers",
"@com_google_protobuf//:protobuf_lite",
Expand All @@ -96,7 +99,10 @@ cc_library(
"src/v8/v8.cc",
],
hdrs = ["include/proxy-wasm/v8.h"],
defines = ["PROXY_WASM_HAS_RUNTIME_V8"],
defines = [
"PROXY_WASM_HAS_RUNTIME_V8",
"PROXY_WASM_HOST_ENGINE_V8",
],
deps = [
":wasm_vm_headers",
"//external:wee8",
Expand All @@ -111,7 +117,10 @@ cc_library(
"src/wamr/wamr.cc",
],
hdrs = ["include/proxy-wasm/wamr.h"],
defines = ["PROXY_WASM_HAS_RUNTIME_WAMR"],
defines = [
"PROXY_WASM_HAS_RUNTIME_WAMR",
"PROXY_WASM_HOST_ENGINE_WAMR",
],
deps = [
":wasm_vm_headers",
"//external:wamr",
Expand All @@ -126,7 +135,10 @@ cc_library(
"src/wasmtime/wasmtime.cc",
],
hdrs = ["include/proxy-wasm/wasmtime.h"],
defines = ["PROXY_WASM_HAS_RUNTIME_WASMTIME"],
defines = [
"PROXY_WASM_HAS_RUNTIME_WASMTIME",
"PROXY_WASM_HOST_ENGINE_WASMTIME",
],
deps = [
":wasm_vm_headers",
"//external:wasmtime",
Expand All @@ -144,7 +156,10 @@ cc_library(
"-Wno-non-virtual-dtor",
"-Wno-old-style-cast",
],
defines = ["PROXY_WASM_HAS_RUNTIME_WAVM"],
defines = [
"PROXY_WASM_HAS_RUNTIME_WAVM",
"PROXY_WASM_HOST_ENGINE_WAVM",
],
deps = [
":wasm_vm_headers",
"//external:wavm",
Expand All @@ -156,13 +171,13 @@ cc_library(
deps = [
":base_lib",
":null_lib",
] + proxy_wasm_select_runtime_v8(
] + proxy_wasm_select_engine_v8(
[":v8_lib"],
) + proxy_wasm_select_runtime_wamr(
) + proxy_wasm_select_engine_wamr(
[":wamr_lib"],
) + proxy_wasm_select_runtime_wasmtime(
) + proxy_wasm_select_engine_wasmtime(
[":wasmtime_lib"],
) + proxy_wasm_select_runtime_wavm(
) + proxy_wasm_select_engine_wavm(
[":wavm_lib"],
),
)
16 changes: 8 additions & 8 deletions bazel/BUILD
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
load("@bazel_skylib//lib:selects.bzl", "selects")

config_setting(
name = "runtime_v8",
values = {"define": "runtime=v8"},
name = "engine_v8",
values = {"define": "engine=v8"},
)

config_setting(
name = "runtime_wamr",
values = {"define": "runtime=wamr"},
name = "engine_wamr",
values = {"define": "engine=wamr"},
)

config_setting(
name = "runtime_wasmtime",
values = {"define": "runtime=wasmtime"},
name = "engine_wasmtime",
values = {"define": "engine=wasmtime"},
)

config_setting(
name = "runtime_wavm",
values = {"define": "runtime=wavm"},
name = "engine_wavm",
values = {"define": "engine=wavm"},
)

config_setting(
Expand Down
16 changes: 8 additions & 8 deletions bazel/select.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,26 @@
# See the License for the specific language governing permissions and
# limitations under the License.

def proxy_wasm_select_runtime_v8(xs):
def proxy_wasm_select_engine_v8(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_v8": xs,
"@proxy_wasm_cpp_host//bazel:engine_v8": xs,
"//conditions:default": [],
})

def proxy_wasm_select_runtime_wamr(xs):
def proxy_wasm_select_engine_wamr(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_wamr": xs,
"@proxy_wasm_cpp_host//bazel:engine_wamr": xs,
"//conditions:default": [],
})

def proxy_wasm_select_runtime_wasmtime(xs):
def proxy_wasm_select_engine_wasmtime(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_wasmtime": xs,
"@proxy_wasm_cpp_host//bazel:engine_wasmtime": xs,
"//conditions:default": [],
})

def proxy_wasm_select_runtime_wavm(xs):
def proxy_wasm_select_engine_wavm(xs):
return select({
"@proxy_wasm_cpp_host//bazel:runtime_wavm": xs,
"@proxy_wasm_cpp_host//bazel:engine_wavm": xs,
"//conditions:default": [],
})
6 changes: 3 additions & 3 deletions include/proxy-wasm/context.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ class WasmVm;
*/
struct PluginBase {
PluginBase(std::string_view name, std::string_view root_id, std::string_view vm_id,
std::string_view runtime, std::string_view plugin_configuration, bool fail_open,
std::string_view engine, std::string_view plugin_configuration, bool fail_open,
std::string_view key)
: name_(std::string(name)), root_id_(std::string(root_id)), vm_id_(std::string(vm_id)),
runtime_(std::string(runtime)), plugin_configuration_(plugin_configuration),
engine_(std::string(engine)), plugin_configuration_(plugin_configuration),
fail_open_(fail_open),
key_(root_id_ + "||" + plugin_configuration_ + "||" + std::string(key)),
log_prefix_(makeLogPrefix()) {}

const std::string name_;
const std::string root_id_;
const std::string vm_id_;
const std::string runtime_;
const std::string engine_;
const std::string plugin_configuration_;
const bool fail_open_;

Expand Down
2 changes: 1 addition & 1 deletion include/proxy-wasm/null_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ struct NullVm : public WasmVm {
NullVm(const NullVm &other) : plugin_name_(other.plugin_name_) {}

// WasmVm
std::string_view runtime() override { return "null"; }
std::string_view getEngineName() override { return "null"; }
Cloneable cloneable() override { return Cloneable::InstantiatedModule; };
std::unique_ptr<WasmVm> clone() override;
bool load(std::string_view bytecode, std::string_view precompiled,
Expand Down
6 changes: 3 additions & 3 deletions include/proxy-wasm/wasm_vm.h
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ class WasmVm {
public:
virtual ~WasmVm() = default;
/**
* Identify the Wasm runtime.
* @return the name of the underlying Wasm runtime.
* Identify the Wasm engine.
* @return the name of the underlying Wasm engine.
*/
virtual std::string_view runtime() = 0;
virtual std::string_view getEngineName() = 0;

/**
* Whether or not the VM implementation supports cloning. Cloning is VM system dependent.
Expand Down
2 changes: 1 addition & 1 deletion src/v8/v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class V8 : public WasmVm {
V8() {}

// WasmVm
std::string_view runtime() override { return "v8"; }
std::string_view getEngineName() override { return "v8"; }

bool load(std::string_view bytecode, std::string_view precompiled,
const std::unordered_map<uint32_t, std::string> function_names) override;
Expand Down
2 changes: 1 addition & 1 deletion src/wamr/wamr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class Wamr : public WasmVm {
public:
Wamr() {}

std::string_view runtime() override { return "wamr"; }
std::string_view getEngineName() override { return "wamr"; }
std::string_view getPrecompiledSectionName() override { return ""; }

Cloneable cloneable() override { return Cloneable::NotCloneable; }
Expand Down
4 changes: 2 additions & 2 deletions src/wasm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ bool WasmBase::load(const std::string &code, bool allow_precompiled) {
return false;
}

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

// Store for future use in non-cloneable runtimes.
// Store for future use in non-cloneable Wasm engines.
if (wasm_vm_->cloneable() == Cloneable::NotCloneable) {
module_bytecode_ = stripped;
module_precompiled_ = precompiled;
Expand Down
2 changes: 1 addition & 1 deletion src/wasmtime/wasmtime.cc
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class Wasmtime : public WasmVm {
public:
Wasmtime() {}

std::string_view runtime() override { return "wasmtime"; }
std::string_view getEngineName() override { return "wasmtime"; }
Cloneable cloneable() override { return Cloneable::CompiledBytecode; }
std::string_view getPrecompiledSectionName() override { return ""; }

Expand Down
2 changes: 1 addition & 1 deletion src/wavm/wavm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ struct Wavm : public WasmVm {
~Wavm() override;

// WasmVm
std::string_view runtime() override { return "wavm"; }
std::string_view getEngineName() override { return "wavm"; }
Cloneable cloneable() override { return Cloneable::InstantiatedModule; };
std::unique_ptr<WasmVm> clone() override;
bool load(std::string_view bytecode, std::string_view precompiled,
Expand Down
4 changes: 2 additions & 2 deletions test/exports_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
namespace proxy_wasm {
namespace {

auto test_values = testing::ValuesIn(getRuntimes());
auto test_values = testing::ValuesIn(getWasmEngines());

INSTANTIATE_TEST_SUITE_P(Runtimes, TestVM, test_values);
INSTANTIATE_TEST_SUITE_P(WasmEngines, TestVM, test_values);

class TestContext : public ContextBase {
public:
Expand Down
2 changes: 1 addition & 1 deletion test/null_vm_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class BaseVmTest : public testing::Test {
TEST_F(BaseVmTest, NullVmStartup) {
auto wasm_vm = createNullVm();
EXPECT_TRUE(wasm_vm != nullptr);
EXPECT_TRUE(wasm_vm->runtime() == "null");
EXPECT_TRUE(wasm_vm->getEngineName() == "null");
EXPECT_TRUE(wasm_vm->cloneable() == Cloneable::InstantiatedModule);
auto wasm_vm_clone = wasm_vm->clone();
EXPECT_TRUE(wasm_vm_clone != nullptr);
Expand Down
Loading