mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-03 11:18:31 +00:00
feat: Rename wasmer-engine-jit to wasmer-engine-universal.
This (small) patch renames the `wasmer-engine-jit` crate into `wasmer-engine-universal`.
This commit is contained in:
44
Cargo.lock
generated
44
Cargo.lock
generated
@@ -2436,8 +2436,8 @@ dependencies = [
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-derive",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"wat",
|
||||
@@ -2455,8 +2455,8 @@ dependencies = [
|
||||
"wasmer-compiler-cranelift",
|
||||
"wasmer-compiler-llvm",
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-middlewares",
|
||||
"wasmprinter",
|
||||
]
|
||||
@@ -2483,9 +2483,9 @@ dependencies = [
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-emscripten",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-engine-object-file",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-middlewares",
|
||||
"wasmer-types",
|
||||
"wasmer-wasi",
|
||||
@@ -2503,8 +2503,8 @@ dependencies = [
|
||||
"thiserror",
|
||||
"wasmer",
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-engine-universal",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2529,9 +2529,9 @@ dependencies = [
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-emscripten",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-engine-object-file",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"wasmer-wasi",
|
||||
@@ -2678,22 +2678,6 @@ dependencies = [
|
||||
"wasmer-vm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine-jit"
|
||||
version = "1.0.2"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"leb128",
|
||||
"loupe",
|
||||
"region",
|
||||
"rkyv",
|
||||
"wasmer-compiler",
|
||||
"wasmer-engine",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine-native"
|
||||
version = "1.0.2"
|
||||
@@ -2733,6 +2717,22 @@ dependencies = [
|
||||
"wasmer-vm",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine-universal"
|
||||
version = "1.0.2"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
"leb128",
|
||||
"loupe",
|
||||
"region",
|
||||
"rkyv",
|
||||
"wasmer-compiler",
|
||||
"wasmer-engine",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-integration-tests-cli"
|
||||
version = "1.0.2"
|
||||
@@ -2862,9 +2862,9 @@ dependencies = [
|
||||
"wasmer-emscripten",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-dummy",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-engine-object-file",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-middlewares",
|
||||
"wasmer-types",
|
||||
"wasmer-wasi",
|
||||
|
||||
22
Cargo.toml
22
Cargo.toml
@@ -17,7 +17,7 @@ wasmer-compiler-singlepass = { version = "1.0.2", path = "lib/compiler-singlepas
|
||||
wasmer-compiler-llvm = { version = "1.0.2", path = "lib/compiler-llvm", optional = true }
|
||||
wasmer-emscripten = { version = "1.0.2", path = "lib/emscripten", optional = true }
|
||||
wasmer-engine = { version = "1.0.2", path = "lib/engine" }
|
||||
wasmer-engine-jit = { version = "1.0.2", path = "lib/engine-jit", optional = true }
|
||||
wasmer-engine-universal = { version = "1.0.2", path = "lib/engine-universal", optional = true }
|
||||
wasmer-engine-native = { version = "1.0.2", path = "lib/engine-native", optional = true }
|
||||
wasmer-engine-object-file = { version = "1.0.2", path = "lib/engine-object-file", optional = true }
|
||||
wasmer-wasi = { version = "1.0.2", path = "lib/wasi", optional = true }
|
||||
@@ -40,7 +40,7 @@ members = [
|
||||
"lib/derive",
|
||||
"lib/emscripten",
|
||||
"lib/engine",
|
||||
"lib/engine-jit",
|
||||
"lib/engine-universal",
|
||||
"lib/engine-native",
|
||||
"lib/engine-object-file",
|
||||
"lib/object",
|
||||
@@ -81,7 +81,7 @@ loupe = "0.1"
|
||||
default = [
|
||||
"wat",
|
||||
"wast",
|
||||
"jit",
|
||||
"universal",
|
||||
"native",
|
||||
"object-file",
|
||||
"cache",
|
||||
@@ -90,8 +90,8 @@ default = [
|
||||
"middlewares",
|
||||
]
|
||||
engine = []
|
||||
jit = [
|
||||
"wasmer-engine-jit",
|
||||
universal = [
|
||||
"wasmer-engine-universal",
|
||||
"engine",
|
||||
]
|
||||
native = [
|
||||
@@ -110,7 +110,7 @@ wat = ["wasmer/wat"]
|
||||
compiler = [
|
||||
"wasmer/compiler",
|
||||
"wasmer-compiler/translator",
|
||||
"wasmer-engine-jit/compiler",
|
||||
"wasmer-engine-universal/compiler",
|
||||
"wasmer-engine-native/compiler",
|
||||
"wasmer-engine-object-file/compiler",
|
||||
]
|
||||
@@ -143,9 +143,9 @@ test-native = [
|
||||
"native",
|
||||
"test-generator/test-native",
|
||||
]
|
||||
test-jit = [
|
||||
"jit",
|
||||
"test-generator/test-jit",
|
||||
test-universal = [
|
||||
"universal",
|
||||
"test-generator/test-universal",
|
||||
]
|
||||
|
||||
# Specifies that we're running in coverage testing mode. This disables tests
|
||||
@@ -165,8 +165,8 @@ path = "examples/early_exit.rs"
|
||||
required-features = ["cranelift"]
|
||||
|
||||
[[example]]
|
||||
name = "engine-jit"
|
||||
path = "examples/engine_jit.rs"
|
||||
name = "engine-universal"
|
||||
path = "examples/engine_universal.rs"
|
||||
required-features = ["cranelift"]
|
||||
|
||||
[[example]]
|
||||
|
||||
70
Makefile
70
Makefile
@@ -9,28 +9,28 @@ SHELL=/bin/bash
|
||||
|
||||
# The matrix is the product of the following columns:
|
||||
#
|
||||
# |------------|--------|----------|--------------|-------|
|
||||
# |------------|-----------|----------|--------------|-------|
|
||||
# | Compiler ⨯ Engine ⨯ Platform ⨯ Architecture ⨯ libc |
|
||||
# |------------|--------|----------|--------------|-------|
|
||||
# | Cranelift | JIT | Linux | amd64 | glibc |
|
||||
# |------------|-----------|----------|--------------|-------|
|
||||
# | Cranelift | Universal | Linux | amd64 | glibc |
|
||||
# | LLVM | Native | Darwin | aarch64 | musl |
|
||||
# | Singlepass | | Windows | | |
|
||||
# |------------|--------|----------|--------------|-------|
|
||||
# |------------|-----------|----------|--------------|-------|
|
||||
#
|
||||
# Here is what works and what doesn't:
|
||||
#
|
||||
# * Cranelift with the JIT engine works everywhere,
|
||||
# * Cranelift with the Universal engine works everywhere,
|
||||
#
|
||||
# * Cranelift with the Native engine works on Linux+Darwin/`amd64`,
|
||||
# but it doesn't work on */`aarch64` or Windows/*.
|
||||
#
|
||||
# * LLVM with the JIT engine works on Linux+Darwin/`amd64`,
|
||||
# * LLVM with the Universal engine works on Linux+Darwin/`amd64`,
|
||||
# but it doesn't work on */`aarch64` or Windows/*.
|
||||
#
|
||||
# * LLVM with the Native engine works on
|
||||
# Linux+Darwin/`amd64`+`aarch64`, but it doesn't work on Windows/*.
|
||||
#
|
||||
# * Singlepass with the JIT engine works on Linux+Darwin/`amd64`, but
|
||||
# * Singlepass with the Universal engine works on Linux+Darwin/`amd64`, but
|
||||
# it doesn't work on */`aarch64` or Windows/*.
|
||||
#
|
||||
# * Singlepass with the Native engine doesn't work because it doesn't
|
||||
@@ -205,7 +205,7 @@ compilers_engines :=
|
||||
##
|
||||
|
||||
ifeq ($(ENABLE_CRANELIFT), 1)
|
||||
compilers_engines += cranelift-jit
|
||||
compilers_engines += cranelift-universal
|
||||
|
||||
ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX)))
|
||||
ifeq ($(IS_AMD64), 1)
|
||||
@@ -228,7 +228,7 @@ endif
|
||||
ifeq ($(ENABLE_LLVM), 1)
|
||||
ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX)))
|
||||
ifeq ($(IS_AMD64), 1)
|
||||
compilers_engines += llvm-jit
|
||||
compilers_engines += llvm-universal
|
||||
compilers_engines += llvm-native
|
||||
else ifeq ($(IS_AARCH64), 1)
|
||||
compilers_engines += llvm-native
|
||||
@@ -243,7 +243,7 @@ endif
|
||||
ifeq ($(ENABLE_SINGLEPASS), 1)
|
||||
ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX)))
|
||||
ifeq ($(IS_AMD64), 1)
|
||||
compilers_engines += singlepass-jit
|
||||
compilers_engines += singlepass-universal
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -300,10 +300,10 @@ capi_compilers_engines_exclude :=
|
||||
# LLVM for the moment because it causes the linker to fail since llvm is not statically linked.
|
||||
# TODO: Reenable llvm in C-API
|
||||
capi_compiler_features := --features $(subst $(space),$(comma),$(filter-out llvm, $(compilers)))
|
||||
capi_compilers_engines_exclude += llvm-jit llvm-native
|
||||
capi_compilers_engines_exclude += llvm-universal llvm-native
|
||||
|
||||
# We exclude singlepass jit because it doesn't support multivalue (required in wasm-c-api tests)
|
||||
capi_compilers_engines_exclude += singlepass-jit
|
||||
# We exclude singlepass-universal because it doesn't support multivalue (required in wasm-c-api tests)
|
||||
capi_compilers_engines_exclude += singlepass-universal
|
||||
|
||||
capi_compilers_engines := $(filter-out $(capi_compilers_engines_exclude),$(compilers_engines))
|
||||
|
||||
@@ -423,19 +423,19 @@ endif
|
||||
|
||||
build-docs-capi: capi-setup
|
||||
cd lib/c-api/doc/deprecated/ && doxygen doxyfile
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,jit,object-file,native,cranelift,wasi $(capi_default_features)
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,object-file,native,cranelift,wasi $(capi_default_features)
|
||||
|
||||
build-capi: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,native,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features)
|
||||
--no-default-features --features deprecated,wat,universal,native,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features)
|
||||
|
||||
build-capi-singlepass: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,native,object-file,singlepass,wasi,middlewares $(capi_default_features)
|
||||
--no-default-features --features deprecated,wat,universal,native,object-file,singlepass,wasi,middlewares $(capi_default_features)
|
||||
|
||||
build-capi-singlepass-jit: capi-setup
|
||||
build-capi-singlepass-universal: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,singlepass,wasi,middlewares $(capi_default_features)
|
||||
--no-default-features --features deprecated,wat,universal,singlepass,wasi,middlewares $(capi_default_features)
|
||||
|
||||
build-capi-singlepass-native: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
@@ -447,15 +447,15 @@ build-capi-singlepass-object-file: capi-setup
|
||||
|
||||
build-capi-cranelift: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,native,object-file,cranelift,wasi,middlewares $(capi_default_features)
|
||||
--no-default-features --features deprecated,wat,universal,native,object-file,cranelift,wasi,middlewares $(capi_default_features)
|
||||
|
||||
build-capi-cranelift-system-libffi: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,native,object-file,cranelift,wasi,middlewares,system-libffi $(capi_default_features)
|
||||
--no-default-features --features deprecated,wat,universal,native,object-file,cranelift,wasi,middlewares,system-libffi $(capi_default_features)
|
||||
|
||||
build-capi-cranelift-jit: capi-setup
|
||||
build-capi-cranelift-universal: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,cranelift,wasi,middlewares $(capi_default_features)
|
||||
--no-default-features --features deprecated,wat,universal,cranelift,wasi,middlewares $(capi_default_features)
|
||||
|
||||
build-capi-cranelift-native: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
@@ -467,11 +467,11 @@ build-capi-cranelift-object-file: capi-setup
|
||||
|
||||
build-capi-llvm: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,native,object-file,llvm,wasi,middlewares $(capi_default_features)
|
||||
--no-default-features --features deprecated,wat,universal,native,object-file,llvm,wasi,middlewares $(capi_default_features)
|
||||
|
||||
build-capi-llvm-jit: capi-setup
|
||||
build-capi-llvm-universal: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,llvm,wasi,middlewares $(capi_default_features)
|
||||
--no-default-features --features deprecated,wat,universal,llvm,wasi,middlewares $(capi_default_features)
|
||||
|
||||
build-capi-llvm-native: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
@@ -483,9 +483,9 @@ build-capi-llvm-object-file: capi-setup
|
||||
|
||||
# Headless (we include the minimal to be able to run)
|
||||
|
||||
build-capi-headless-jit: capi-setup
|
||||
build-capi-headless-universal: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features jit,wasi
|
||||
--no-default-features --features universal,wasi
|
||||
|
||||
build-capi-headless-native: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
@@ -497,7 +497,7 @@ build-capi-headless-object-file: capi-setup
|
||||
|
||||
build-capi-headless-all: capi-setup
|
||||
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features jit,native,object-file,wasi
|
||||
--no-default-features --features universal,native,object-file,wasi
|
||||
|
||||
###########
|
||||
# Testing #
|
||||
@@ -523,20 +523,20 @@ test-compilers-compat: $(foreach compiler,$(compilers),test-$(compiler))
|
||||
test-singlepass-native:
|
||||
cargo test --release --tests $(compiler_features) -- singlepass::native
|
||||
|
||||
test-singlepass-jit:
|
||||
cargo test --release --tests $(compiler_features) -- singlepass::jit
|
||||
test-singlepass-universal:
|
||||
cargo test --release --tests $(compiler_features) -- singlepass::universal
|
||||
|
||||
test-cranelift-native:
|
||||
cargo test --release --tests $(compiler_features) -- cranelift::native
|
||||
|
||||
test-cranelift-jit:
|
||||
cargo test --release --tests $(compiler_features) -- cranelift::jit
|
||||
test-cranelift-universal:
|
||||
cargo test --release --tests $(compiler_features) -- cranelift::universal
|
||||
|
||||
test-llvm-native:
|
||||
cargo test --release --tests $(compiler_features) -- llvm::native
|
||||
|
||||
test-llvm-jit:
|
||||
cargo test --release --tests $(compiler_features) -- llvm::jit
|
||||
test-llvm-universal:
|
||||
cargo test --release --tests $(compiler_features) -- llvm::universal
|
||||
|
||||
test-singlepass: $(foreach singlepass_engine,$(filter singlepass-%,$(compilers_engines)),test-$(singlepass_engine))
|
||||
|
||||
@@ -550,7 +550,7 @@ test-capi: build-capi package-capi $(foreach compiler_engine,$(capi_compilers_en
|
||||
|
||||
test-capi-crate-%:
|
||||
WASMER_CAPI_CONFIG=$(shell echo $@ | sed -e s/test-capi-crate-//) cargo test --manifest-path lib/c-api/Cargo.toml --release \
|
||||
--no-default-features --features deprecated,wat,jit,native,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features) -- --nocapture
|
||||
--no-default-features --features deprecated,wat,universal,native,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features) -- --nocapture
|
||||
|
||||
test-capi-integration-%:
|
||||
# Test the Wasmer C API tests for C
|
||||
|
||||
@@ -149,19 +149,21 @@ pub fn run_basic_dynamic_function(store: &Store, compiler_name: &str, c: &mut Cr
|
||||
fn run_static_benchmarks(_c: &mut Criterion) {
|
||||
#[cfg(feature = "llvm")]
|
||||
{
|
||||
let store = Store::new(&JIT::new(wasmer_compiler_llvm::LLVM::new()).engine());
|
||||
let store = Store::new(&Universal::new(wasmer_compiler_llvm::LLVM::new()).engine());
|
||||
run_basic_static_function(&store, "llvm", c);
|
||||
}
|
||||
|
||||
#[cfg(feature = "cranelift")]
|
||||
{
|
||||
let store = Store::new(&JIT::new(wasmer_compiler_cranelift::Cranelift::new()).engine());
|
||||
let store =
|
||||
Store::new(&Universal::new(wasmer_compiler_cranelift::Cranelift::new()).engine());
|
||||
run_basic_static_function(&store, "cranelift", c);
|
||||
}
|
||||
|
||||
#[cfg(feature = "singlepass")]
|
||||
{
|
||||
let store = Store::new(&JIT::new(wasmer_compiler_singlepass::Singlepass::new()).engine());
|
||||
let store =
|
||||
Store::new(&Universal::new(wasmer_compiler_singlepass::Singlepass::new()).engine());
|
||||
run_basic_static_function(&store, "singlepass", c);
|
||||
}
|
||||
}
|
||||
@@ -169,19 +171,21 @@ fn run_static_benchmarks(_c: &mut Criterion) {
|
||||
fn run_dynamic_benchmarks(_c: &mut Criterion) {
|
||||
#[cfg(feature = "llvm")]
|
||||
{
|
||||
let store = Store::new(&JIT::new(wasmer_compiler_llvm::LLVM::new()).engine());
|
||||
let store = Store::new(&Universal::new(wasmer_compiler_llvm::LLVM::new()).engine());
|
||||
run_basic_dynamic_function(&store, "llvm", c);
|
||||
}
|
||||
|
||||
#[cfg(feature = "cranelift")]
|
||||
{
|
||||
let store = Store::new(&JIT::new(wasmer_compiler_cranelift::Cranelift::new()).engine());
|
||||
let store =
|
||||
Store::new(&Universal::new(wasmer_compiler_cranelift::Cranelift::new()).engine());
|
||||
run_basic_dynamic_function(&store, "cranelift", c);
|
||||
}
|
||||
|
||||
#[cfg(feature = "singlepass")]
|
||||
{
|
||||
let store = Store::new(&JIT::new(wasmer_compiler_singlepass::Singlepass::new()).engine());
|
||||
let store =
|
||||
Store::new(&Universal::new(wasmer_compiler_singlepass::Singlepass::new()).engine());
|
||||
run_basic_dynamic_function(&store, "singlepass", c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ digraph dependencies {
|
||||
n0 [label="wasmer", color=orange];
|
||||
n1 [label="wasmer-compiler", color=orange];
|
||||
n5 [label="wasmer-engine", color=orange];
|
||||
n6 [label="wasmer-engine-jit", color=orange];
|
||||
n6 [label="wasmer-engine-universal", color=orange];
|
||||
n7 [label="wasmer-engine-native", color=orange];
|
||||
n8 [label="wasmer-types", color=orange];
|
||||
n9 [label="wasmer-vm", color=orange];
|
||||
@@ -28,7 +28,7 @@ digraph dependencies {
|
||||
label="Engines";
|
||||
color=brown;
|
||||
|
||||
n6 [label="wasmer-engine-jit", color=orange];
|
||||
n6 [label="wasmer-engine-universal", color=orange];
|
||||
n7 [label="wasmer-engine-native", color=orange];
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
||||
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
|
||||
<!-- Generated by graphviz version 2.47.1 (20210417.1919)
|
||||
-->
|
||||
<!-- Title: dependencies Pages: 1 -->
|
||||
<svg width="1067pt" height="554pt"
|
||||
viewBox="0.00 0.00 1067.00 554.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<svg width="1117pt" height="554pt"
|
||||
viewBox="0.00 0.00 1117.00 554.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 550)">
|
||||
<title>dependencies</title>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-550 1063,-550 1063,4 -4,4"/>
|
||||
<polygon fill="white" stroke="transparent" points="-4,4 -4,-550 1113,-550 1113,4 -4,4"/>
|
||||
<g id="clust1" class="cluster">
|
||||
<title>cluster_compiler</title>
|
||||
<polygon fill="none" stroke="brown" points="378,-280 378,-355 1051,-355 1051,-280 378,-280"/>
|
||||
<text text-anchor="middle" x="714.5" y="-339.8" font-family="Times,serif" font-size="14.00">Compilers</text>
|
||||
<polygon fill="none" stroke="brown" points="428,-280 428,-355 1101,-355 1101,-280 428,-280"/>
|
||||
<text text-anchor="middle" x="764.5" y="-339.8" font-family="Times,serif" font-size="14.00">Compilers</text>
|
||||
</g>
|
||||
<g id="clust2" class="cluster">
|
||||
<title>cluster_engine</title>
|
||||
<polygon fill="none" stroke="brown" points="8,-280 8,-355 370,-355 370,-280 8,-280"/>
|
||||
<text text-anchor="middle" x="189" y="-339.8" font-family="Times,serif" font-size="14.00">Engines</text>
|
||||
<polygon fill="none" stroke="brown" points="8,-280 8,-355 420,-355 420,-280 8,-280"/>
|
||||
<text text-anchor="middle" x="214" y="-339.8" font-family="Times,serif" font-size="14.00">Engines</text>
|
||||
</g>
|
||||
<g id="clust4" class="cluster">
|
||||
<title>cluster_abi</title>
|
||||
<polygon fill="none" stroke="brown" points="257,-427 257,-502 568,-502 568,-427 257,-427"/>
|
||||
<text text-anchor="middle" x="412.5" y="-486.8" font-family="Times,serif" font-size="14.00">Provided ABIs</text>
|
||||
<polygon fill="none" stroke="brown" points="307,-427 307,-502 618,-502 618,-427 307,-427"/>
|
||||
<text text-anchor="middle" x="462.5" y="-486.8" font-family="Times,serif" font-size="14.00">Provided ABIs</text>
|
||||
</g>
|
||||
<!-- n0 -->
|
||||
<g id="node1" class="node">
|
||||
<title>n0</title>
|
||||
<ellipse fill="none" stroke="orange" cx="479" cy="-381" rx="38.19" ry="18"/>
|
||||
<text text-anchor="middle" x="479" y="-377.3" font-family="Times,serif" font-size="14.00">wasmer</text>
|
||||
<ellipse fill="none" stroke="orange" cx="529" cy="-381" rx="38.19" ry="18"/>
|
||||
<text text-anchor="middle" x="529" y="-377.3" font-family="Times,serif" font-size="14.00">wasmer</text>
|
||||
</g>
|
||||
<!-- n6 -->
|
||||
<g id="node4" class="node">
|
||||
<title>n6</title>
|
||||
<ellipse fill="none" stroke="orange" cx="287" cy="-306" rx="75.29" ry="18"/>
|
||||
<text text-anchor="middle" x="287" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-engine-jit</text>
|
||||
<ellipse fill="none" stroke="orange" cx="312" cy="-306" rx="100.18" ry="18"/>
|
||||
<text text-anchor="middle" x="312" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-engine-universal</text>
|
||||
</g>
|
||||
<!-- n0->n6 -->
|
||||
<g id="edge12" class="edge">
|
||||
<title>n0->n6</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M443.28,-373.99C422.62,-369.9 396.37,-363.65 374,-355 355.71,-347.93 336.5,-337.67 320.81,-328.45"/>
|
||||
<polygon fill="orange" stroke="orange" points="322.38,-325.31 312,-323.18 318.78,-331.32 322.38,-325.31"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M494.06,-373.25C473.43,-368.88 446.95,-362.59 424,-355 400.49,-347.23 375.06,-336.52 354.38,-327.2"/>
|
||||
<polygon fill="orange" stroke="orange" points="355.79,-323.99 345.24,-323.02 352.88,-330.36 355.79,-323.99"/>
|
||||
</g>
|
||||
<!-- n7 -->
|
||||
<g id="node5" class="node">
|
||||
@@ -51,194 +51,194 @@
|
||||
<!-- n0->n7 -->
|
||||
<g id="edge13" class="edge">
|
||||
<title>n0->n7</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M440.26,-380.88C386.12,-381.13 285.24,-378.02 203,-355 181.25,-348.91 158.5,-338.09 140.41,-328.25"/>
|
||||
<polygon fill="orange" stroke="orange" points="141.84,-325.04 131.4,-323.23 138.43,-331.16 141.84,-325.04"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M490.82,-378.88C416.77,-376.4 256.26,-369.51 203,-355 181.21,-349.06 158.46,-338.25 140.37,-328.38"/>
|
||||
<polygon fill="orange" stroke="orange" points="141.8,-325.17 131.37,-323.34 138.38,-331.28 141.8,-325.17"/>
|
||||
</g>
|
||||
<!-- n2 -->
|
||||
<g id="node13" class="node">
|
||||
<title>n2</title>
|
||||
<ellipse fill="none" stroke="orange" cx="938" cy="-306" rx="105.08" ry="18"/>
|
||||
<text text-anchor="middle" x="938" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-compiler-cranelift</text>
|
||||
<ellipse fill="none" stroke="orange" cx="988" cy="-306" rx="105.08" ry="18"/>
|
||||
<text text-anchor="middle" x="988" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-compiler-cranelift</text>
|
||||
</g>
|
||||
<!-- n0->n2 -->
|
||||
<g id="edge9" class="edge">
|
||||
<title>n0->n2</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M517.13,-378.78C594.16,-376.05 765.84,-368.62 823,-355 848.67,-348.88 875.98,-337.7 897.54,-327.67"/>
|
||||
<polygon fill="orange" stroke="orange" points="899.18,-330.76 906.71,-323.31 896.18,-324.44 899.18,-330.76"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M567.13,-378.78C644.16,-376.05 815.84,-368.62 873,-355 898.67,-348.88 925.98,-337.7 947.54,-327.67"/>
|
||||
<polygon fill="orange" stroke="orange" points="949.18,-330.76 956.71,-323.31 946.18,-324.44 949.18,-330.76"/>
|
||||
</g>
|
||||
<!-- n3 -->
|
||||
<g id="node14" class="node">
|
||||
<title>n3</title>
|
||||
<ellipse fill="none" stroke="orange" cx="479" cy="-306" rx="92.88" ry="18"/>
|
||||
<text text-anchor="middle" x="479" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-compiler-llvm</text>
|
||||
<ellipse fill="none" stroke="orange" cx="529" cy="-306" rx="92.88" ry="18"/>
|
||||
<text text-anchor="middle" x="529" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-compiler-llvm</text>
|
||||
</g>
|
||||
<!-- n0->n3 -->
|
||||
<g id="edge10" class="edge">
|
||||
<title>n0->n3</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M479,-362.7C479,-354.25 479,-343.87 479,-334.37"/>
|
||||
<polygon fill="orange" stroke="orange" points="482.5,-334.18 479,-324.18 475.5,-334.18 482.5,-334.18"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M529,-362.7C529,-354.25 529,-343.87 529,-334.37"/>
|
||||
<polygon fill="orange" stroke="orange" points="532.5,-334.18 529,-324.18 525.5,-334.18 532.5,-334.18"/>
|
||||
</g>
|
||||
<!-- n4 -->
|
||||
<g id="node15" class="node">
|
||||
<title>n4</title>
|
||||
<ellipse fill="none" stroke="orange" cx="702" cy="-306" rx="112.38" ry="18"/>
|
||||
<text text-anchor="middle" x="702" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-compiler-singlepass</text>
|
||||
<ellipse fill="none" stroke="orange" cx="752" cy="-306" rx="112.38" ry="18"/>
|
||||
<text text-anchor="middle" x="752" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer-compiler-singlepass</text>
|
||||
</g>
|
||||
<!-- n0->n4 -->
|
||||
<g id="edge11" class="edge">
|
||||
<title>n0->n4</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M513.33,-372.82C533.27,-368.35 558.77,-362.1 581,-355 606.24,-346.94 633.75,-336.2 656.14,-326.91"/>
|
||||
<polygon fill="orange" stroke="orange" points="657.53,-330.13 665.41,-323.04 654.83,-323.67 657.53,-330.13"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M563.33,-372.82C583.27,-368.35 608.77,-362.1 631,-355 656.24,-346.94 683.75,-336.2 706.14,-326.91"/>
|
||||
<polygon fill="orange" stroke="orange" points="707.53,-330.13 715.41,-323.04 704.83,-323.67 707.53,-330.13"/>
|
||||
</g>
|
||||
<!-- n1 -->
|
||||
<g id="node2" class="node">
|
||||
<title>n1</title>
|
||||
<ellipse fill="none" stroke="orange" cx="590" cy="-162" rx="73.39" ry="18"/>
|
||||
<text text-anchor="middle" x="590" y="-158.3" font-family="Times,serif" font-size="14.00">wasmer-compiler</text>
|
||||
<ellipse fill="none" stroke="orange" cx="640" cy="-162" rx="73.39" ry="18"/>
|
||||
<text text-anchor="middle" x="640" y="-158.3" font-family="Times,serif" font-size="14.00">wasmer-compiler</text>
|
||||
</g>
|
||||
<!-- n9 -->
|
||||
<g id="node7" class="node">
|
||||
<title>n9</title>
|
||||
<ellipse fill="none" stroke="orange" cx="590" cy="-90" rx="53.09" ry="18"/>
|
||||
<text text-anchor="middle" x="590" y="-86.3" font-family="Times,serif" font-size="14.00">wasmer-vm</text>
|
||||
<ellipse fill="none" stroke="orange" cx="640" cy="-90" rx="53.09" ry="18"/>
|
||||
<text text-anchor="middle" x="640" y="-86.3" font-family="Times,serif" font-size="14.00">wasmer-vm</text>
|
||||
</g>
|
||||
<!-- n1->n9 -->
|
||||
<g id="edge20" class="edge">
|
||||
<title>n1->n9</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M590,-143.7C590,-135.98 590,-126.71 590,-118.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="593.5,-118.1 590,-108.1 586.5,-118.1 593.5,-118.1"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M640,-143.7C640,-135.98 640,-126.71 640,-118.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="643.5,-118.1 640,-108.1 636.5,-118.1 643.5,-118.1"/>
|
||||
</g>
|
||||
<!-- n5 -->
|
||||
<g id="node3" class="node">
|
||||
<title>n5</title>
|
||||
<ellipse fill="none" stroke="orange" cx="287" cy="-234" rx="64.99" ry="18"/>
|
||||
<text text-anchor="middle" x="287" y="-230.3" font-family="Times,serif" font-size="14.00">wasmer-engine</text>
|
||||
<ellipse fill="none" stroke="orange" cx="312" cy="-234" rx="64.99" ry="18"/>
|
||||
<text text-anchor="middle" x="312" y="-230.3" font-family="Times,serif" font-size="14.00">wasmer-engine</text>
|
||||
</g>
|
||||
<!-- n5->n1 -->
|
||||
<g id="edge19" class="edge">
|
||||
<title>n5->n1</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M335.35,-221.83C387.75,-209.72 471.52,-190.37 528.56,-177.19"/>
|
||||
<polygon fill="orange" stroke="orange" points="529.58,-180.55 538.53,-174.89 528,-173.73 529.58,-180.55"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M361.82,-222.37C419.2,-210.12 513.6,-189.98 576.28,-176.6"/>
|
||||
<polygon fill="orange" stroke="orange" points="577.39,-179.94 586.44,-174.43 575.93,-173.09 577.39,-179.94"/>
|
||||
</g>
|
||||
<!-- n6->n5 -->
|
||||
<g id="edge17" class="edge">
|
||||
<title>n6->n5</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M287,-287.7C287,-279.98 287,-270.71 287,-262.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="290.5,-262.1 287,-252.1 283.5,-262.1 290.5,-262.1"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M312,-287.7C312,-279.98 312,-270.71 312,-262.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="315.5,-262.1 312,-252.1 308.5,-262.1 315.5,-262.1"/>
|
||||
</g>
|
||||
<!-- n7->n5 -->
|
||||
<g id="edge18" class="edge">
|
||||
<title>n7->n5</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M144.49,-289.81C172.98,-278.85 211.51,-264.03 241.33,-252.57"/>
|
||||
<polygon fill="orange" stroke="orange" points="242.6,-255.83 250.68,-248.97 240.09,-249.29 242.6,-255.83"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M148.65,-290.24C182.01,-278.96 228,-263.4 262.69,-251.67"/>
|
||||
<polygon fill="orange" stroke="orange" points="264.26,-254.84 272.61,-248.32 262.02,-248.21 264.26,-254.84"/>
|
||||
</g>
|
||||
<!-- n8 -->
|
||||
<g id="node6" class="node">
|
||||
<title>n8</title>
|
||||
<ellipse fill="none" stroke="orange" cx="590" cy="-18" rx="59.59" ry="18"/>
|
||||
<text text-anchor="middle" x="590" y="-14.3" font-family="Times,serif" font-size="14.00">wasmer-types</text>
|
||||
<ellipse fill="none" stroke="orange" cx="640" cy="-18" rx="59.59" ry="18"/>
|
||||
<text text-anchor="middle" x="640" y="-14.3" font-family="Times,serif" font-size="14.00">wasmer-types</text>
|
||||
</g>
|
||||
<!-- n9->n8 -->
|
||||
<g id="edge21" class="edge">
|
||||
<title>n9->n8</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M590,-71.7C590,-63.98 590,-54.71 590,-46.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="593.5,-46.1 590,-36.1 586.5,-46.1 593.5,-46.1"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M640,-71.7C640,-63.98 640,-54.71 640,-46.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="643.5,-46.1 640,-36.1 636.5,-46.1 643.5,-46.1"/>
|
||||
</g>
|
||||
<!-- n10 -->
|
||||
<g id="node8" class="node">
|
||||
<title>n10</title>
|
||||
<ellipse fill="none" stroke="orange" cx="338" cy="-528" rx="59.29" ry="18"/>
|
||||
<text text-anchor="middle" x="338" y="-524.3" font-family="Times,serif" font-size="14.00">wasmer-c-api</text>
|
||||
<ellipse fill="none" stroke="orange" cx="388" cy="-528" rx="59.29" ry="18"/>
|
||||
<text text-anchor="middle" x="388" y="-524.3" font-family="Times,serif" font-size="14.00">wasmer-c-api</text>
|
||||
</g>
|
||||
<!-- n11 -->
|
||||
<g id="node9" class="node">
|
||||
<title>n11</title>
|
||||
<ellipse fill="none" stroke="orange" cx="479" cy="-453" rx="80.69" ry="18"/>
|
||||
<text text-anchor="middle" x="479" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer-emscripten</text>
|
||||
<ellipse fill="none" stroke="orange" cx="529" cy="-453" rx="80.69" ry="18"/>
|
||||
<text text-anchor="middle" x="529" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer-emscripten</text>
|
||||
</g>
|
||||
<!-- n10->n11 -->
|
||||
<g id="edge5" class="edge">
|
||||
<title>n10->n11</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M368.64,-512.56C375.69,-509.16 383.13,-505.5 390,-502 407,-493.34 425.6,-483.38 441.39,-474.79"/>
|
||||
<polygon fill="orange" stroke="orange" points="443.22,-477.77 450.32,-469.91 439.87,-471.63 443.22,-477.77"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M418.64,-512.56C425.69,-509.16 433.13,-505.5 440,-502 457,-493.34 475.6,-483.38 491.39,-474.79"/>
|
||||
<polygon fill="orange" stroke="orange" points="493.22,-477.77 500.32,-469.91 489.87,-471.63 493.22,-477.77"/>
|
||||
</g>
|
||||
<!-- n12 -->
|
||||
<g id="node10" class="node">
|
||||
<title>n12</title>
|
||||
<ellipse fill="none" stroke="orange" cx="323" cy="-453" rx="57.69" ry="18"/>
|
||||
<text text-anchor="middle" x="323" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer-wasi</text>
|
||||
<ellipse fill="none" stroke="orange" cx="373" cy="-453" rx="57.69" ry="18"/>
|
||||
<text text-anchor="middle" x="373" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer-wasi</text>
|
||||
</g>
|
||||
<!-- n10->n12 -->
|
||||
<g id="edge6" class="edge">
|
||||
<title>n10->n12</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M334.45,-509.7C332.69,-501.15 330.53,-490.65 328.56,-481.07"/>
|
||||
<polygon fill="orange" stroke="orange" points="331.97,-480.27 326.53,-471.18 325.11,-481.68 331.97,-480.27"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M384.45,-509.7C382.69,-501.15 380.53,-490.65 378.56,-481.07"/>
|
||||
<polygon fill="orange" stroke="orange" points="381.97,-480.27 376.53,-471.18 375.11,-481.68 381.97,-480.27"/>
|
||||
</g>
|
||||
<!-- n11->n0 -->
|
||||
<g id="edge7" class="edge">
|
||||
<title>n11->n0</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M479,-434.7C479,-426.98 479,-417.71 479,-409.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="482.5,-409.1 479,-399.1 475.5,-409.1 482.5,-409.1"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M529,-434.7C529,-426.98 529,-417.71 529,-409.11"/>
|
||||
<polygon fill="orange" stroke="orange" points="532.5,-409.1 529,-399.1 525.5,-409.1 532.5,-409.1"/>
|
||||
</g>
|
||||
<!-- n12->n0 -->
|
||||
<g id="edge8" class="edge">
|
||||
<title>n12->n0</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M354.57,-437.83C380.1,-426.38 416.07,-410.24 442.77,-398.26"/>
|
||||
<polygon fill="orange" stroke="orange" points="444.46,-401.33 452.15,-394.05 441.6,-394.95 444.46,-401.33"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M404.57,-437.83C430.1,-426.38 466.07,-410.24 492.77,-398.26"/>
|
||||
<polygon fill="orange" stroke="orange" points="494.46,-401.33 502.15,-394.05 491.6,-394.95 494.46,-401.33"/>
|
||||
</g>
|
||||
<!-- n13 -->
|
||||
<g id="node11" class="node">
|
||||
<title>n13</title>
|
||||
<ellipse fill="none" stroke="orange" cx="639" cy="-453" rx="61.99" ry="18"/>
|
||||
<text text-anchor="middle" x="639" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer-cache</text>
|
||||
<ellipse fill="none" stroke="orange" cx="689" cy="-453" rx="61.99" ry="18"/>
|
||||
<text text-anchor="middle" x="689" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer-cache</text>
|
||||
</g>
|
||||
<!-- n13->n0 -->
|
||||
<g id="edge4" class="edge">
|
||||
<title>n13->n0</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M606.24,-437.67C579.82,-426.11 542.7,-409.87 515.37,-397.91"/>
|
||||
<polygon fill="orange" stroke="orange" points="516.71,-394.68 506.14,-393.87 513.9,-401.09 516.71,-394.68"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M656.24,-437.67C629.82,-426.11 592.7,-409.87 565.37,-397.91"/>
|
||||
<polygon fill="orange" stroke="orange" points="566.71,-394.68 556.14,-393.87 563.9,-401.09 566.71,-394.68"/>
|
||||
</g>
|
||||
<!-- n14 -->
|
||||
<g id="node12" class="node">
|
||||
<title>n14</title>
|
||||
<ellipse fill="none" stroke="orange" cx="479" cy="-528" rx="50.09" ry="18"/>
|
||||
<text text-anchor="middle" x="479" y="-524.3" font-family="Times,serif" font-size="14.00">wasmer-cli</text>
|
||||
<ellipse fill="none" stroke="orange" cx="529" cy="-528" rx="50.09" ry="18"/>
|
||||
<text text-anchor="middle" x="529" y="-524.3" font-family="Times,serif" font-size="14.00">wasmer-cli</text>
|
||||
</g>
|
||||
<!-- n14->n11 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>n14->n11</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M479,-509.7C479,-501.25 479,-490.87 479,-481.37"/>
|
||||
<polygon fill="orange" stroke="orange" points="482.5,-481.18 479,-471.18 475.5,-481.18 482.5,-481.18"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M529,-509.7C529,-501.25 529,-490.87 529,-481.37"/>
|
||||
<polygon fill="orange" stroke="orange" points="532.5,-481.18 529,-471.18 525.5,-481.18 532.5,-481.18"/>
|
||||
</g>
|
||||
<!-- n14->n12 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>n14->n12</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M436.19,-518.44C420.87,-514.52 403.75,-509.12 389,-502 375.04,-495.26 360.95,-485.51 349.4,-476.55"/>
|
||||
<polygon fill="orange" stroke="orange" points="351.47,-473.73 341.47,-470.23 347.11,-479.2 351.47,-473.73"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M486.19,-518.44C470.87,-514.52 453.75,-509.12 439,-502 425.04,-495.26 410.95,-485.51 399.4,-476.55"/>
|
||||
<polygon fill="orange" stroke="orange" points="401.47,-473.73 391.47,-470.23 397.11,-479.2 401.47,-473.73"/>
|
||||
</g>
|
||||
<!-- n14->n13 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>n14->n13</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M522.27,-518.78C538.34,-514.85 556.44,-509.37 572,-502 586.15,-495.3 600.45,-485.56 612.18,-476.6"/>
|
||||
<polygon fill="orange" stroke="orange" points="614.53,-479.2 620.23,-470.26 610.21,-473.7 614.53,-479.2"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M572.27,-518.78C588.34,-514.85 606.44,-509.37 622,-502 636.15,-495.3 650.45,-485.56 662.18,-476.6"/>
|
||||
<polygon fill="orange" stroke="orange" points="664.53,-479.2 670.23,-470.26 660.21,-473.7 664.53,-479.2"/>
|
||||
</g>
|
||||
<!-- n2->n1 -->
|
||||
<g id="edge14" class="edge">
|
||||
<title>n2->n1</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M899.09,-289.12C834.21,-262.65 704.27,-209.63 635.35,-181.5"/>
|
||||
<polygon fill="orange" stroke="orange" points="636.62,-178.24 626.04,-177.71 633.98,-184.72 636.62,-178.24"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M949.09,-289.12C884.21,-262.65 754.27,-209.63 685.35,-181.5"/>
|
||||
<polygon fill="orange" stroke="orange" points="686.62,-178.24 676.04,-177.71 683.98,-184.72 686.62,-178.24"/>
|
||||
</g>
|
||||
<!-- n3->n1 -->
|
||||
<g id="edge15" class="edge">
|
||||
<title>n3->n1</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M492.17,-288.15C511.61,-263.28 548.12,-216.57 570.62,-187.79"/>
|
||||
<polygon fill="orange" stroke="orange" points="573.45,-189.86 576.85,-179.82 567.93,-185.55 573.45,-189.86"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M542.17,-288.15C561.61,-263.28 598.12,-216.57 620.62,-187.79"/>
|
||||
<polygon fill="orange" stroke="orange" points="623.45,-189.86 626.85,-179.82 617.93,-185.55 623.45,-189.86"/>
|
||||
</g>
|
||||
<!-- n4->n1 -->
|
||||
<g id="edge16" class="edge">
|
||||
<title>n4->n1</title>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M688.49,-287.87C668.79,-262.9 632.08,-216.35 609.46,-187.68"/>
|
||||
<polygon fill="orange" stroke="orange" points="612.15,-185.43 603.21,-179.75 606.65,-189.77 612.15,-185.43"/>
|
||||
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M738.49,-287.87C718.79,-262.9 682.08,-216.35 659.46,-187.68"/>
|
||||
<polygon fill="orange" stroke="orange" points="662.15,-185.43 653.21,-179.75 656.65,-189.77 662.15,-185.43"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
@@ -220,18 +220,18 @@ example.
|
||||
|
||||
### Engines
|
||||
|
||||
1. [**JIT engine**][engine-jit], explains what an engine is, what the
|
||||
JIT engine is, and how to set it up. The example completes itself
|
||||
1. [**Universal engine**][engine-universal], explains what an engine is, what the
|
||||
Universal engine is, and how to set it up. The example completes itself
|
||||
with the compilation of the Wasm module, its instantiation, and
|
||||
finally, by calling an exported function.
|
||||
|
||||
_Keywords_: JIT, engine, in-memory, executable code.
|
||||
_Keywords_: Universal, engine, in-memory, executable code.
|
||||
|
||||
<details>
|
||||
<summary><em>Execute the example</em></summary>
|
||||
|
||||
```shell
|
||||
$ cargo run --example engine-jit --release --features "cranelift"
|
||||
$ cargo run --example engine-universal --release --features "cranelift"
|
||||
```
|
||||
|
||||
</details>
|
||||
@@ -375,7 +375,7 @@ example.
|
||||
</details>
|
||||
|
||||
[hello-world]: ./hello_world.rs
|
||||
[engine-jit]: ./engine_jit.rs
|
||||
[engine-universal]: ./engine_universal.rs
|
||||
[engine-native]: ./engine_native.rs
|
||||
[engine-headless]: ./engine_headless.rs
|
||||
[compiler-singlepass]: ./compiler_singlepass.rs
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let compiler = Cranelift::default();
|
||||
|
||||
// Create the store
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
|
||||
use wasmer_compiler_llvm::LLVM;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let compiler = LLVM::default();
|
||||
|
||||
// Create the store
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
|
||||
use wasmer_compiler_singlepass::Singlepass;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -33,7 +33,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
let compiler = Singlepass::default();
|
||||
|
||||
// Create the store
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -18,7 +18,7 @@ use anyhow::bail;
|
||||
use std::fmt;
|
||||
use wasmer::{imports, wat2wasm, Function, Instance, Module, NativeFunc, RuntimeError, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
// First we need to create an error type that we'll use to signal the end of execution.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
@@ -55,7 +55,7 @@ fn main() -> anyhow::Result<()> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
//! What problem does it solve, and what does it mean?
|
||||
//!
|
||||
//! Once a Wasm module is compiled into executable code and stored
|
||||
//! somewhere (e.g. in memory with the JIT engine, or in a native
|
||||
//! somewhere (e.g. in memory with the Universal engine, or in a native
|
||||
//! object with the native engine), the module can be instantiated and
|
||||
//! executed. But imagine for a second the following scenario:
|
||||
//!
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
//! Defining an engine in Wasmer is one of the fundamental steps.
|
||||
//!
|
||||
//! This example illustrates how to use the `wasmer_engine_jit`, aka
|
||||
//! the JIT engine. An engine applies roughly 2 steps:
|
||||
//! This example illustrates how to use the `wasmer_engine_universal`,
|
||||
//! aka the Universal engine. An engine applies roughly 2 steps:
|
||||
//!
|
||||
//! 1. It compiles the Wasm module bytes to executable code, through
|
||||
//! the intervention of a compiler,
|
||||
//! 2. It stores the executable code somewhere.
|
||||
//!
|
||||
//! In the particular context of the JIT engine, the executable code
|
||||
//! is stored in memory.
|
||||
//! In the particular context of the Universal engine, the executable
|
||||
//! code is stored in memory.
|
||||
//!
|
||||
//! You can run the example directly by executing in Wasmer root:
|
||||
//!
|
||||
//! ```shell
|
||||
//! cargo run --example engine-jit --release --features "cranelift"
|
||||
//! cargo run --example engine-universal --release --features "cranelift"
|
||||
//! ```
|
||||
//!
|
||||
//! Ready?
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -44,12 +44,12 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// compile the Wasm module into executable code.
|
||||
let compiler_config = Cranelift::default();
|
||||
|
||||
println!("Creating JIT engine...");
|
||||
println!("Creating Universal engine...");
|
||||
// Define the engine that will drive everything.
|
||||
//
|
||||
// In this case, the engine is `wasmer_engine_jit` which roughly
|
||||
// In this case, the engine is `wasmer_engine_universal` which roughly
|
||||
// means that the executable code will live in memory.
|
||||
let engine = JIT::new(compiler_config).engine();
|
||||
let engine = Universal::new(compiler_config).engine();
|
||||
|
||||
// Create a store, that holds the engine.
|
||||
let store = Store::new(&engine);
|
||||
@@ -86,6 +86,6 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_engine_jit() -> Result<(), Box<dyn std::error::Error>> {
|
||||
fn test_engine_universal() -> Result<(), Box<dyn std::error::Error>> {
|
||||
main()
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -39,7 +39,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store, Value};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -40,7 +40,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Mutability, Store, Type, Value};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Array, Instance, Module, Store, WasmPtr};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -37,7 +37,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Features, Instance, Module, Store, Value};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -36,7 +36,7 @@ fn main() -> anyhow::Result<()> {
|
||||
features.multi_value(true);
|
||||
|
||||
// Set up the engine. That's where we define the features!
|
||||
let engine = JIT::new(compiler).features(features);
|
||||
let engine = Universal::new(compiler).features(features);
|
||||
|
||||
// Now, let's define the store, and compile the module.
|
||||
let store = Store::new(&engine.engine());
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Function, Instance, Module, NativeFunc, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
// First we create a simple Wasm program to use with Wasmer.
|
||||
@@ -42,9 +42,9 @@ fn main() -> anyhow::Result<()> {
|
||||
// You can use `Store::default()` for that.
|
||||
//
|
||||
// However for the purposes of showing what's happening, we create a compiler
|
||||
// (`Cranelift`) and pass it to an engine (`JIT`). We then pass the engine to
|
||||
// (`Cranelift`) and pass it to an engine (`Universal`). We then pass the engine to
|
||||
// the store and are now ready to compile and run WebAssembly!
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
// We then use our store and Wasm bytes to compile a `Module`.
|
||||
// A `Module` is a compiled WebAssembly module that isn't ready to execute yet.
|
||||
|
||||
@@ -20,7 +20,7 @@ use wasmer::{
|
||||
Type, Value,
|
||||
};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module.
|
||||
@@ -44,7 +44,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Function, FunctionType, Instance, Module, Store, Type, Value};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -42,7 +42,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use std::sync::{Arc, Mutex};
|
||||
use wasmer::{imports, wat2wasm, Function, Instance, Module, Store, WasmerEnv};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -49,7 +49,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Global, Instance, Module, Store, Value};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module with the text representation.
|
||||
@@ -38,7 +38,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Let's declare the Wasm module.
|
||||
@@ -39,7 +39,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
use std::mem;
|
||||
use wasmer::{imports, wat2wasm, Bytes, Instance, Module, NativeFunc, Pages, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
// this example is a work in progress:
|
||||
// TODO: clean it up and comment it https://github.com/wasmerio/wasmer/issues/1749
|
||||
@@ -57,7 +57,7 @@ fn main() -> anyhow::Result<()> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -20,7 +20,7 @@ use wasmer::wasmparser::Operator;
|
||||
use wasmer::CompilerConfig;
|
||||
use wasmer::{imports, wat2wasm, Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
use wasmer_middlewares::{
|
||||
metering::{get_remaining_points, set_remaining_points, MeteringPoints},
|
||||
Metering,
|
||||
@@ -69,8 +69,8 @@ fn main() -> anyhow::Result<()> {
|
||||
// Create a Store.
|
||||
//
|
||||
// We use our previously create compiler configuration
|
||||
// with the JIT engine.
|
||||
let store = Store::new(&JIT::new(compiler_config).engine());
|
||||
// with the Universal engine.
|
||||
let store = Store::new(&Universal::new(compiler_config).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -2,7 +2,7 @@ use wasmer::{
|
||||
imports, wat2wasm, Function, Instance, Module, NativeFunc, Store, TableType, Type, Value,
|
||||
};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
/// A function we'll call through a table.
|
||||
fn host_callback(arg1: i32, arg2: i32) -> i32 {
|
||||
@@ -51,7 +51,7 @@ fn main() -> anyhow::Result<()> {
|
||||
)?;
|
||||
|
||||
// We set up our store with an engine and a compiler.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
// Then compile our Wasm.
|
||||
let module = Module::new(&store, wasm_bytes)?;
|
||||
let import_object = imports! {};
|
||||
|
||||
@@ -9,7 +9,7 @@ use wasmer::{
|
||||
Tunables,
|
||||
};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
/// A custom tunables that allows you to set a memory limit.
|
||||
///
|
||||
@@ -144,7 +144,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
// Any compiler and any engine do the job here
|
||||
let compiler = Cranelift::default();
|
||||
let engine = JIT::new(compiler).engine();
|
||||
let engine = Universal::new(compiler).engine();
|
||||
|
||||
// Here is where the fun begins
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
use wasmer::{Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
use wasmer_wasi::WasiState;
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -32,7 +32,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
use wasmer::{Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
use wasmer_wasi::{Pipe, WasiState};
|
||||
|
||||
fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -28,7 +28,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
// Note that we don't need to specify the engine/compiler if we want to use
|
||||
// the default provided by Wasmer.
|
||||
// You can use `Store::default()` for that.
|
||||
let store = Store::new(&JIT::new(Cranelift::default()).engine());
|
||||
let store = Store::new(&Universal::new(Cranelift::default()).engine());
|
||||
|
||||
println!("Compiling module...");
|
||||
// Let's compile the Wasm module.
|
||||
|
||||
@@ -16,7 +16,7 @@ wasmer = { path = "../lib/api" }
|
||||
wasmer-compiler-cranelift = { path = "../lib/compiler-cranelift", optional = true }
|
||||
wasmer-compiler-llvm = { path = "../lib/compiler-llvm", optional = true }
|
||||
wasmer-compiler-singlepass = { path = "../lib/compiler-singlepass", optional = true }
|
||||
wasmer-engine-jit = { path = "../lib/engine-jit", optional = true }
|
||||
wasmer-engine-universal = { path = "../lib/engine-universal", optional = true }
|
||||
wasmer-engine-native = { path = "../lib/engine-native", optional = true }
|
||||
wasmer-middlewares = { path = "../lib/middlewares" }
|
||||
wasmprinter = "0.2"
|
||||
@@ -25,33 +25,33 @@ wasmprinter = "0.2"
|
||||
cranelift = [ "wasmer-compiler-cranelift" ]
|
||||
llvm = [ "wasmer-compiler-llvm" ]
|
||||
singlepass = [ "wasmer-compiler-singlepass" ]
|
||||
jit = [ "wasmer-engine-jit" ]
|
||||
universal = [ "wasmer-engine-universal" ]
|
||||
native = [ "wasmer-engine-native" ]
|
||||
|
||||
[[bin]]
|
||||
name = "equivalence_jit"
|
||||
path = "fuzz_targets/equivalence_jit.rs"
|
||||
required-features = ["jit"]
|
||||
name = "equivalence_universal"
|
||||
path = "fuzz_targets/equivalence_universal.rs"
|
||||
required-features = ["universal"]
|
||||
|
||||
[[bin]]
|
||||
name = "jit_cranelift"
|
||||
path = "fuzz_targets/jit_cranelift.rs"
|
||||
required-features = ["jit", "cranelift"]
|
||||
name = "universal_cranelift"
|
||||
path = "fuzz_targets/universal_cranelift.rs"
|
||||
required-features = ["universal", "cranelift"]
|
||||
|
||||
[[bin]]
|
||||
name = "jit_llvm"
|
||||
path = "fuzz_targets/jit_llvm.rs"
|
||||
required-features = ["jit", "llvm"]
|
||||
name = "universal_llvm"
|
||||
path = "fuzz_targets/universal_llvm.rs"
|
||||
required-features = ["universal", "llvm"]
|
||||
|
||||
[[bin]]
|
||||
name = "jit_singlepass"
|
||||
path = "fuzz_targets/jit_singlepass.rs"
|
||||
required-features = ["jit", "singlepass"]
|
||||
name = "universal_singlepass"
|
||||
path = "fuzz_targets/universal_singlepass.rs"
|
||||
required-features = ["universal", "singlepass"]
|
||||
|
||||
[[bin]]
|
||||
name = "metering"
|
||||
path = "fuzz_targets/metering.rs"
|
||||
required-features = ["jit", "cranelift"]
|
||||
required-features = ["universal", "cranelift"]
|
||||
|
||||
[[bin]]
|
||||
name = "native_cranelift"
|
||||
|
||||
@@ -10,15 +10,15 @@ $ cargo install cargo-fuzz
|
||||
|
||||
`cargo-fuzz` is documented in the [Rust Fuzz Book](https://rust-fuzz.github.io/book/cargo-fuzz.html).
|
||||
|
||||
## Running a fuzzer (validate, jit_llvm, native_cranelift, ...)
|
||||
## Running a fuzzer (`validate`, `universal_llvm`, `native_cranelift`…)
|
||||
|
||||
Once `cargo-fuzz` is installed, you can run the `validate` fuzzer with
|
||||
```sh
|
||||
cargo fuzz run validate
|
||||
```
|
||||
or the `jit_cranelift` fuzzer
|
||||
or the `universal_cranelift` fuzzer
|
||||
```sh
|
||||
cargo fuzz run jit_cranelift
|
||||
cargo fuzz run universal_cranelift
|
||||
```
|
||||
See the [fuzz/fuzz_targets](https://github.com/wasmerio/wasmer/tree/fuzz/fuzz_targets/) directory for the full list of targets.
|
||||
|
||||
@@ -36,12 +36,12 @@ You should see output that looks something like this:
|
||||
#1409042 NEW cov: 115073 ft: 503951 corp: 4667/1814Kb lim: 4096 exec/s: 884 rss: 857Mb L: 174/4096 MS: 2 ChangeByte-ChangeASCIIInt-
|
||||
```
|
||||
|
||||
It will continue to generate random inputs forever, until it finds a bug or is terminated. The testcases for bugs it finds go into `fuzz/artifacts/jit_cranelift` and you can rerun the fuzzer on a single input by passing it on the command line `cargo fuzz run jit_cranelift /path/to/testcase`.
|
||||
It will continue to generate random inputs forever, until it finds a bug or is terminated. The testcases for bugs it finds go into `fuzz/artifacts/universal_cranelift` and you can rerun the fuzzer on a single input by passing it on the command line `cargo fuzz run universal_cranelift /path/to/testcase`.
|
||||
|
||||
## The corpus
|
||||
|
||||
Each fuzzer has an individual corpus under fuzz/corpus/test_name, created on first run if not already present. The fuzzers use `wasm-smith` which means that the testcase files are random number seeds input to the wasm generator, not `.wasm` files themselves. In order to debug a testcase, you may find that you need to convert it into a `.wasm` file. Using the standalone `wasm-smith` tool doesn't work for this purpose because we use a custom configuration to our `wasm_smith::Module`. Instead, our fuzzers use an environment variable `DUMP_TESTCASE=path`. For example:
|
||||
|
||||
```
|
||||
DUMP_TESTCASE=/tmp/crash.wasm cargo fuzz run --features=jit,singlepass jit_singlepass fuzz/artifacts/jit_singlepass/crash-0966412eab4f89c52ce5d681807c8030349470f6
|
||||
DUMP_TESTCASE=/tmp/crash.wasm cargo fuzz run --features=universal,singlepass universal_singlepass fuzz/artifacts/universal_singlepass/crash-0966412eab4f89c52ce5d681807c8030349470f6
|
||||
```
|
||||
|
||||
@@ -11,7 +11,7 @@ use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_compiler_llvm::LLVM;
|
||||
#[cfg(feature = "singlepass")]
|
||||
use wasmer_compiler_singlepass::Singlepass;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
#[derive(Arbitrary, Debug, Default, Copy, Clone)]
|
||||
struct ExportedFunctionConfig;
|
||||
@@ -48,7 +48,7 @@ impl std::fmt::Debug for WasmSmithModule {
|
||||
#[cfg(feature = "singlepass")]
|
||||
fn maybe_instantiate_singlepass(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
|
||||
let compiler = Singlepass::default();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(&store, &wasm_bytes);
|
||||
let module = match module {
|
||||
Ok(m) => m,
|
||||
@@ -69,7 +69,7 @@ fn maybe_instantiate_cranelift(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
|
||||
let mut compiler = Cranelift::default();
|
||||
compiler.canonicalize_nans(true);
|
||||
compiler.enable_verifier();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(&store, &wasm_bytes)?;
|
||||
let instance = Instance::new(&module, &imports! {})?;
|
||||
Ok(Some(instance))
|
||||
@@ -80,7 +80,7 @@ fn maybe_instantiate_llvm(wasm_bytes: &[u8]) -> Result<Option<Instance>> {
|
||||
let mut compiler = LLVM::default();
|
||||
compiler.canonicalize_nans(true);
|
||||
compiler.enable_verifier();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(&store, &wasm_bytes)?;
|
||||
let instance = Instance::new(&module, &imports! {})?;
|
||||
Ok(Some(instance))
|
||||
@@ -6,7 +6,7 @@ use wasm_smith::{Config, ConfiguredModule};
|
||||
use wasmer::wasmparser::Operator;
|
||||
use wasmer::{imports, CompilerConfig, Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
use wasmer_middlewares::Metering;
|
||||
|
||||
#[derive(Arbitrary, Debug, Default, Copy, Clone)]
|
||||
@@ -56,7 +56,7 @@ fuzz_target!(|module: WasmSmithModule| {
|
||||
compiler.enable_verifier();
|
||||
let metering = Arc::new(Metering::new(10, cost));
|
||||
compiler.push_middleware(metering);
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(&store, &wasm_bytes).unwrap();
|
||||
match Instance::new(&module, &imports! {}) {
|
||||
Ok(_) => {}
|
||||
|
||||
@@ -4,7 +4,7 @@ use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
|
||||
use wasm_smith::{Config, ConfiguredModule};
|
||||
use wasmer::{imports, CompilerConfig, Instance, Module, Store};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
#[derive(Arbitrary, Debug, Default, Copy, Clone)]
|
||||
struct NoImportsConfig;
|
||||
@@ -42,7 +42,7 @@ fuzz_target!(|module: WasmSmithModule| {
|
||||
let mut compiler = Cranelift::default();
|
||||
compiler.canonicalize_nans(true);
|
||||
compiler.enable_verifier();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(&store, &wasm_bytes).unwrap();
|
||||
match Instance::new(&module, &imports! {}) {
|
||||
Ok(_) => {}
|
||||
@@ -4,7 +4,7 @@ use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
|
||||
use wasm_smith::{Config, ConfiguredModule};
|
||||
use wasmer::{imports, CompilerConfig, Instance, Module, Store};
|
||||
use wasmer_compiler_llvm::LLVM;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
#[derive(Arbitrary, Debug, Default, Copy, Clone)]
|
||||
struct NoImportsConfig;
|
||||
@@ -42,7 +42,7 @@ fuzz_target!(|module: WasmSmithModule| {
|
||||
let mut compiler = LLVM::default();
|
||||
compiler.canonicalize_nans(true);
|
||||
compiler.enable_verifier();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(&store, &wasm_bytes).unwrap();
|
||||
match Instance::new(&module, &imports! {}) {
|
||||
Ok(_) => {}
|
||||
@@ -4,7 +4,7 @@ use libfuzzer_sys::{arbitrary, arbitrary::Arbitrary, fuzz_target};
|
||||
use wasm_smith::{Config, ConfiguredModule};
|
||||
use wasmer::{imports, Instance, Module, Store};
|
||||
use wasmer_compiler_singlepass::Singlepass;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
#[derive(Arbitrary, Debug, Default, Copy, Clone)]
|
||||
struct NoImportsConfig;
|
||||
@@ -40,7 +40,7 @@ fuzz_target!(|module: WasmSmithModule| {
|
||||
}
|
||||
|
||||
let compiler = Singlepass::default();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(&store, &wasm_bytes);
|
||||
let module = match module {
|
||||
Ok(m) => m,
|
||||
@@ -1,7 +1,7 @@
|
||||
wasmer:
|
||||
language: rust
|
||||
features:
|
||||
- jit
|
||||
- universal
|
||||
- cranelift
|
||||
- singlepass
|
||||
deps:
|
||||
|
||||
@@ -18,7 +18,7 @@ wasmer-compiler-llvm = { path = "../compiler-llvm", version = "1.0.2", optional
|
||||
wasmer-compiler = { path = "../compiler", version = "1.0.2" }
|
||||
wasmer-derive = { path = "../derive", version = "1.0.2" }
|
||||
wasmer-engine = { path = "../engine", version = "1.0.2" }
|
||||
wasmer-engine-jit = { path = "../engine-jit", version = "1.0.2", optional = true }
|
||||
wasmer-engine-universal = { path = "../engine-universal", version = "1.0.2", optional = true }
|
||||
wasmer-engine-native = { path = "../engine-native", version = "1.0.2", optional = true }
|
||||
wasmer-types = { path = "../types", version = "1.0.2" }
|
||||
indexmap = { version = "1.4", features = ["serde-1"] }
|
||||
@@ -43,15 +43,15 @@ anyhow = "1.0"
|
||||
maintenance = { status = "actively-developed" }
|
||||
|
||||
[features]
|
||||
default = ["wat", "default-cranelift", "default-jit"]
|
||||
default = ["wat", "default-cranelift", "default-universal"]
|
||||
compiler = [
|
||||
"wasmer-compiler/translator",
|
||||
"wasmer-engine-jit/compiler",
|
||||
"wasmer-engine-universal/compiler",
|
||||
"wasmer-engine-native/compiler",
|
||||
]
|
||||
engine = []
|
||||
jit = [
|
||||
"wasmer-engine-jit",
|
||||
universal = [
|
||||
"wasmer-engine-universal",
|
||||
"engine"
|
||||
]
|
||||
native = [
|
||||
@@ -87,8 +87,8 @@ default-llvm = [
|
||||
"llvm",
|
||||
"default-compiler"
|
||||
]
|
||||
default-jit = [
|
||||
"jit",
|
||||
default-universal = [
|
||||
"universal",
|
||||
"default-engine"
|
||||
]
|
||||
default-native = [
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# `wasmer` [](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [](https://slack.wasmer.io) [](https://github.com/wasmerio/wasmer/blob/master/LICENSE) [](https://crates.io/crates/wasmer)
|
||||
|
||||
[`Wasmer`](https://wasmer.io/) is the most popular [WebAssembly](https://webassembly.org/)
|
||||
runtime for Rust (...and also the fastest). It supports JIT (Just in Time) and AOT (Ahead of time)
|
||||
[`Wasmer`](https://wasmer.io/) is the most popular
|
||||
[WebAssembly](https://webassembly.org/) runtime for Rust (...and also
|
||||
the fastest). It supports JIT (Just in Time) and AOT (Ahead of time)
|
||||
compilation as well as pluggable compilers suited to your needs.
|
||||
|
||||
It's designed to be safe and secure, and runnable in any kind of environment.
|
||||
|
||||
@@ -215,7 +215,7 @@
|
||||
//! enable new functionality and features that set defaults.
|
||||
//!
|
||||
//! The features that enable new functionality are:
|
||||
//! - `jit` - enable the JIT engine. (See [wasmer-jit][])
|
||||
//! - `universal` - enable the Universal engine. (See [wasmer-universal][])
|
||||
//! - `native` - enable the native engine. (See [wasmer-native][])
|
||||
//! - `cranelift` - enable Wasmer's Cranelift compiler. (See [wasmer-cranelift][])
|
||||
//! - `llvm` - enable Wasmer's LLVM compiler. (See [wasmer-llvm][])
|
||||
@@ -230,12 +230,12 @@
|
||||
//! - `default-singlepass` - set Wasmer's Singlepass compiler as the default.
|
||||
//!
|
||||
//! The next set is the default engine set:
|
||||
//! - `default-jit` - set the JIT engine as the default.
|
||||
//! - `default-universal` - set the Universal engine as the default.
|
||||
//! - `default-native` - set the native engine as the default.
|
||||
//!
|
||||
//! --------
|
||||
//!
|
||||
//! By default the `wat`, `default-cranelift`, and `default-jit` features
|
||||
//! By default the `wat`, `default-cranelift`, and `default-universal` features
|
||||
//! are enabled.
|
||||
//!
|
||||
//!
|
||||
@@ -247,7 +247,7 @@
|
||||
//! [wasmer-cranelift]: https://docs.rs/wasmer-compiler-cranelift/*/wasmer_compiler_cranelift/
|
||||
//! [wasmer-emscripten]: https://docs.rs/wasmer-emscripten/*/wasmer_emscripten/
|
||||
//! [wasmer-engine]: https://docs.rs/wasmer-engine/*/wasmer_engine/
|
||||
//! [wasmer-jit]: https://docs.rs/wasmer-engine-jit/*/wasmer_engine_jit/
|
||||
//! [wasmer-universal]: https://docs.rs/wasmer-engine-universal/*/wasmer_engine_universal/
|
||||
//! [wasmer-native]: https://docs.rs/wasmer-engine-native/*/wasmer_engine_native/
|
||||
//! [wasmer-singlepass]: https://docs.rs/wasmer-compiler-singlepass/*/wasmer_compiler_singlepass/
|
||||
//! [wasmer-llvm]: https://docs.rs/wasmer-compiler-llvm/*/wasmer_compiler_llvm/
|
||||
@@ -348,9 +348,9 @@ compile_error!(
|
||||
If you wish to use more than one compiler, you can simply create the own store. Eg.:
|
||||
|
||||
```
|
||||
use wasmer::{Store, JIT, Singlepass};
|
||||
use wasmer::{Store, Universal, Singlepass};
|
||||
|
||||
let engine = JIT::new(Singlepass::default()).engine();
|
||||
let engine = Universal::new(Singlepass::default()).engine();
|
||||
let store = Store::new(&engine);
|
||||
```"#
|
||||
);
|
||||
@@ -364,8 +364,8 @@ pub use wasmer_compiler_cranelift::{Cranelift, CraneliftOptLevel};
|
||||
#[cfg(feature = "llvm")]
|
||||
pub use wasmer_compiler_llvm::{LLVMOptLevel, LLVM};
|
||||
|
||||
#[cfg(feature = "jit")]
|
||||
pub use wasmer_engine_jit::{JITArtifact, JITEngine, JIT};
|
||||
#[cfg(feature = "universal")]
|
||||
pub use wasmer_engine_universal::{Universal, UniversalArtifact, UniversalEngine};
|
||||
|
||||
#[cfg(feature = "native")]
|
||||
pub use wasmer_engine_native::{Native, NativeArtifact, NativeEngine};
|
||||
|
||||
@@ -55,7 +55,7 @@ impl Module {
|
||||
///
|
||||
/// Creating a WebAssembly module from bytecode can result in a
|
||||
/// [`CompileError`] since this operation requires to transorm the Wasm
|
||||
/// bytecode into code the machine can easily execute (normally through a JIT).
|
||||
/// bytecode into code the machine can easily execute.
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
|
||||
@@ -126,8 +126,8 @@ impl Default for Store {
|
||||
#[allow(unreachable_code, unused_mut)]
|
||||
fn get_engine(mut config: impl CompilerConfig + 'static) -> impl Engine + Send + Sync {
|
||||
cfg_if::cfg_if! {
|
||||
if #[cfg(feature = "default-jit")] {
|
||||
wasmer_engine_jit::JIT::new(config)
|
||||
if #[cfg(feature = "default-universal")] {
|
||||
wasmer_engine_universal::Universal::new(config)
|
||||
.engine()
|
||||
} else if #[cfg(feature = "default-native")] {
|
||||
wasmer_engine_native::Native::new(config)
|
||||
|
||||
@@ -21,7 +21,7 @@ wasmer-compiler-singlepass = { version = "1.0.2", path = "../compiler-singlepass
|
||||
wasmer-compiler-llvm = { version = "1.0.2", path = "../compiler-llvm", optional = true }
|
||||
wasmer-emscripten = { version = "1.0.2", path = "../emscripten", optional = true }
|
||||
wasmer-engine = { version = "1.0.2", path = "../engine" }
|
||||
wasmer-engine-jit = { version = "1.0.2", path = "../engine-jit", optional = true }
|
||||
wasmer-engine-universal = { version = "1.0.2", path = "../engine-universal", optional = true }
|
||||
wasmer-engine-native = { version = "1.0.2", path = "../engine-native", optional = true }
|
||||
wasmer-engine-object-file = { version = "1.0.2", path = "../engine-object-file", optional = true }
|
||||
wasmer-middlewares = { version = "1.0.2", path = "../middlewares", optional = true }
|
||||
@@ -46,7 +46,7 @@ default = [
|
||||
"deprecated",
|
||||
"wat",
|
||||
"cranelift",
|
||||
"jit",
|
||||
"universal",
|
||||
"wasi",
|
||||
"middlewares",
|
||||
]
|
||||
@@ -55,8 +55,8 @@ wasi = ["wasmer-wasi", "typetag", "serde"]
|
||||
engine = []
|
||||
middlewares = ["wasmer-middlewares"]
|
||||
deprecated = ["libffi", "wasmer/experimental-reference-types-extern-ref"]
|
||||
jit = [
|
||||
"wasmer-engine-jit",
|
||||
universal = [
|
||||
"wasmer-engine-universal",
|
||||
"engine",
|
||||
]
|
||||
native = [
|
||||
@@ -69,7 +69,7 @@ object-file = [
|
||||
]
|
||||
compiler = [
|
||||
"wasmer/compiler",
|
||||
"wasmer-engine-jit/compiler",
|
||||
"wasmer-engine-universal/compiler",
|
||||
"wasmer-engine-native/compiler",
|
||||
"wasmer-engine-object-file/compiler"
|
||||
]
|
||||
|
||||
@@ -36,7 +36,7 @@ const PRE_HEADER: &'static str = r#"
|
||||
"#;
|
||||
|
||||
#[allow(unused)]
|
||||
const JIT_FEATURE_AS_C_DEFINE: &'static str = "WASMER_JIT_ENABLED";
|
||||
const UNIVERSAL_FEATURE_AS_C_DEFINE: &'static str = "WASMER_UNIVERSAL_ENABLED";
|
||||
|
||||
#[allow(unused)]
|
||||
const COMPILER_FEATURE_AS_C_DEFINE: &'static str = "WASMER_COMPILER_ENABLED";
|
||||
@@ -138,7 +138,7 @@ fn build_wasm_c_api_headers(crate_dir: &str, out_dir: &str) {
|
||||
pre_header = PRE_HEADER
|
||||
);
|
||||
|
||||
map_feature_as_c_define!("jit", JIT_FEATURE_AS_C_DEFINE, pre_header);
|
||||
map_feature_as_c_define!("universal", UNIVERSAL_FEATURE_AS_C_DEFINE, pre_header);
|
||||
map_feature_as_c_define!("compiler", COMPILER_FEATURE_AS_C_DEFINE, pre_header);
|
||||
map_feature_as_c_define!("wasi", WASI_FEATURE_AS_C_DEFINE, pre_header);
|
||||
map_feature_as_c_define!("middlewares", MIDDLEWARES_FEATURE_AS_C_DEFINE, pre_header);
|
||||
@@ -294,7 +294,7 @@ fn new_builder(language: Language, crate_dir: &str, include_guard: &str, header:
|
||||
.with_documentation(false)
|
||||
.with_define("target_family", "windows", "_WIN32")
|
||||
.with_define("target_arch", "x86_64", "ARCH_X86_64")
|
||||
.with_define("feature", "jit", JIT_FEATURE_AS_C_DEFINE)
|
||||
.with_define("feature", "universal", UNIVERSAL_FEATURE_AS_C_DEFINE)
|
||||
.with_define("feature", "compiler", COMPILER_FEATURE_AS_C_DEFINE)
|
||||
.with_define("feature", "wasi", WASI_FEATURE_AS_C_DEFINE)
|
||||
.with_define("feature", "emscripten", EMSCRIPTEN_FEATURE_AS_C_DEFINE);
|
||||
|
||||
@@ -12,12 +12,12 @@ use crate::error::{update_last_error, CApiError};
|
||||
use cfg_if::cfg_if;
|
||||
use std::sync::Arc;
|
||||
use wasmer::Engine;
|
||||
#[cfg(feature = "jit")]
|
||||
use wasmer_engine_jit::JIT;
|
||||
#[cfg(feature = "native")]
|
||||
use wasmer_engine_native::Native;
|
||||
#[cfg(feature = "object-file")]
|
||||
use wasmer_engine_object_file::ObjectFile;
|
||||
#[cfg(feature = "universal")]
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
/// Kind of compilers that can be used by the engines.
|
||||
///
|
||||
@@ -65,9 +65,9 @@ impl Default for wasmer_compiler_t {
|
||||
#[repr(C)]
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum wasmer_engine_t {
|
||||
/// Variant to represent the JIT engine. See the
|
||||
/// [`wasmer_engine_jit`] Rust crate.
|
||||
JIT = 0,
|
||||
/// Variant to represent the universal engine. See the
|
||||
/// [`wasmer_engine_universal`] Rust crate.
|
||||
UNIVERSAL = 0,
|
||||
|
||||
/// Variant to represent the Native engine. See the
|
||||
/// [`wasmer_engine_native`] Rust crate.
|
||||
@@ -81,8 +81,8 @@ pub enum wasmer_engine_t {
|
||||
impl Default for wasmer_engine_t {
|
||||
fn default() -> Self {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "jit")] {
|
||||
Self::JIT
|
||||
if #[cfg(feature = "universal")] {
|
||||
Self::UNIVERSAL
|
||||
} else if #[cfg(feature = "native")] {
|
||||
Self::NATIVE
|
||||
} else if #[cfg(feature = "object-file")] {
|
||||
@@ -245,9 +245,9 @@ pub extern "C" fn wasm_config_set_compiler(
|
||||
/// // Create the configuration.
|
||||
/// wasm_config_t* config = wasm_config_new();
|
||||
///
|
||||
/// // Use the JIT engine, if available.
|
||||
/// if (wasmer_is_engine_available(JIT)) {
|
||||
/// wasm_config_set_engine(config, JIT);
|
||||
/// // Use the Universal engine, if available.
|
||||
/// if (wasmer_is_engine_available(UNIVERSAL)) {
|
||||
/// wasm_config_set_engine(config, UNIVERSAL);
|
||||
/// }
|
||||
/// // Or maybe the Native engine?
|
||||
/// else if (wasmer_is_engine_available(NATIVE)) {
|
||||
@@ -284,9 +284,9 @@ pub struct wasm_engine_t {
|
||||
pub(crate) inner: Arc<dyn Engine + Send + Sync>,
|
||||
}
|
||||
|
||||
// Compiler JIT
|
||||
#[cfg(feature = "compiler")]
|
||||
use wasmer::CompilerConfig;
|
||||
|
||||
#[cfg(feature = "compiler")]
|
||||
fn get_default_compiler_config() -> Box<dyn CompilerConfig> {
|
||||
cfg_if! {
|
||||
@@ -303,8 +303,8 @@ fn get_default_compiler_config() -> Box<dyn CompilerConfig> {
|
||||
}
|
||||
|
||||
cfg_if! {
|
||||
if #[cfg(all(feature = "jit", feature = "compiler"))] {
|
||||
/// Creates a new JIT engine with the default compiler.
|
||||
if #[cfg(all(feature = "universal", feature = "compiler"))] {
|
||||
/// Creates a new Universal engine with the default compiler.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -314,11 +314,11 @@ cfg_if! {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
||||
let compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::new(compiler_config).engine());
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(Universal::new(compiler_config).engine());
|
||||
Box::new(wasm_engine_t { inner: engine })
|
||||
}
|
||||
} else if #[cfg(feature = "jit")] {
|
||||
/// Creates a new headless JIT engine.
|
||||
} else if #[cfg(feature = "universal")] {
|
||||
/// Creates a new headless Universal engine.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
@@ -327,7 +327,7 @@ cfg_if! {
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::headless().engine());
|
||||
let engine: Arc<dyn Engine + Send + Sync> = Arc::new(Universal::headless().engine());
|
||||
Box::new(wasm_engine_t { inner: engine })
|
||||
}
|
||||
} else if #[cfg(all(feature = "native", feature = "compiler"))] {
|
||||
@@ -383,7 +383,7 @@ cfg_if! {
|
||||
/// cbindgen:ignore
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
|
||||
unimplemented!("No engine attached; You might want to recompile `wasmer_c_api` with for example `--feature jit`");
|
||||
unimplemented!("No engine attached; You might want to recompile `wasmer_c_api` with for example `--feature universal`");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -483,10 +483,10 @@ pub extern "C" fn wasm_engine_new_with_config(
|
||||
}
|
||||
|
||||
let inner: Arc<dyn Engine + Send + Sync> = match config.engine {
|
||||
wasmer_engine_t::JIT => {
|
||||
wasmer_engine_t::UNIVERSAL => {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "jit")] {
|
||||
let mut builder = JIT::new(compiler_config);
|
||||
if #[cfg(feature = "universal")] {
|
||||
let mut builder = Universal::new(compiler_config);
|
||||
|
||||
if let Some(target) = config.target {
|
||||
builder = builder.target(target.inner);
|
||||
@@ -498,7 +498,7 @@ pub extern "C" fn wasm_engine_new_with_config(
|
||||
|
||||
Arc::new(builder.engine())
|
||||
} else {
|
||||
return return_with_error("Wasmer has not been compiled with the `jit` feature.");
|
||||
return return_with_error("Wasmer has not been compiled with the `universal` feature.");
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -546,10 +546,10 @@ pub extern "C" fn wasm_engine_new_with_config(
|
||||
Some(Box::new(wasm_engine_t { inner }))
|
||||
} else {
|
||||
let inner: Arc<dyn Engine + Send + Sync> = match config.engine {
|
||||
wasmer_engine_t::JIT => {
|
||||
wasmer_engine_t::UNIVERSAL => {
|
||||
cfg_if! {
|
||||
if #[cfg(feature = "jit")] {
|
||||
let mut builder = JIT::headless();
|
||||
if #[cfg(feature = "universal")] {
|
||||
let mut builder = Universal::headless();
|
||||
|
||||
if let Some(target) = config.target {
|
||||
builder = builder.target(target.inner);
|
||||
@@ -561,7 +561,7 @@ pub extern "C" fn wasm_engine_new_with_config(
|
||||
|
||||
Arc::new(builder.engine())
|
||||
} else {
|
||||
return return_with_error("Wasmer has not been compiled with the `jit` feature.");
|
||||
return return_with_error("Wasmer has not been compiled with the `universal` feature.");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@@ -119,7 +119,7 @@ pub extern "C" fn wasmer_is_headless() -> bool {
|
||||
#[no_mangle]
|
||||
pub extern "C" fn wasmer_is_engine_available(engine: wasmer_engine_t) -> bool {
|
||||
match engine {
|
||||
wasmer_engine_t::JIT if cfg!(feature = "jit") => true,
|
||||
wasmer_engine_t::UNIVERSAL if cfg!(feature = "universal") => true,
|
||||
wasmer_engine_t::NATIVE if cfg!(feature = "native") => true,
|
||||
wasmer_engine_t::OBJECT_FILE if cfg!(feature = "object-file") => true,
|
||||
_ => false,
|
||||
@@ -194,7 +194,14 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_wasmer_is_engine_available() {
|
||||
set_var("JIT", if cfg!(feature = "jit") { "1" } else { "0" });
|
||||
set_var(
|
||||
"UNIVERSAL",
|
||||
if cfg!(feature = "universal") {
|
||||
"1"
|
||||
} else {
|
||||
"0"
|
||||
},
|
||||
);
|
||||
set_var("NATIVE", if cfg!(feature = "native") { "1" } else { "0" });
|
||||
set_var(
|
||||
"OBJECT_FILE",
|
||||
@@ -210,7 +217,7 @@ mod tests {
|
||||
#include <stdlib.h>
|
||||
|
||||
int main() {
|
||||
assert(wasmer_is_engine_available(JIT) == (getenv("JIT")[0] == '1'));
|
||||
assert(wasmer_is_engine_available(UNIVERSAL) == (getenv("UNIVERSAL")[0] == '1'));
|
||||
assert(wasmer_is_engine_available(NATIVE) == (getenv("NATIVE")[0] == '1'));
|
||||
assert(wasmer_is_engine_available(OBJECT_FILE) == (getenv("OBJECT_FILE")[0] == '1'));
|
||||
|
||||
@@ -219,7 +226,7 @@ mod tests {
|
||||
})
|
||||
.success();
|
||||
|
||||
remove_var("JIT");
|
||||
remove_var("UNIVERSAL");
|
||||
remove_var("NATIVE");
|
||||
remove_var("OBJECT_FILE");
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ wasm_engine_t *wasm_engine_new() {
|
||||
abort();
|
||||
}
|
||||
if (strcmp(wasmer_test_engine, "jit") == 0) {
|
||||
assert(wasmer_is_engine_available(JIT));
|
||||
wasm_config_set_engine(config, JIT);
|
||||
assert(wasmer_is_engine_available(UNIVERSAL));
|
||||
wasm_config_set_engine(config, UNIVERSAL);
|
||||
} else if (strcmp(wasmer_test_engine, "native") == 0) {
|
||||
assert(wasmer_is_engine_available(NATIVE));
|
||||
wasm_config_set_engine(config, NATIVE);
|
||||
|
||||
@@ -62,8 +62,8 @@
|
||||
# define DEPRECATED(message) __declspec(deprecated(message))
|
||||
#endif
|
||||
|
||||
// The `jit` feature has been enabled for this build.
|
||||
#define WASMER_JIT_ENABLED
|
||||
// The `universal` feature has been enabled for this build.
|
||||
#define WASMER_UNIVERSAL_ENABLED
|
||||
|
||||
// The `compiler` feature has been enabled for this build.
|
||||
#define WASMER_COMPILER_ENABLED
|
||||
@@ -124,7 +124,7 @@ typedef enum wasmer_compiler_t {
|
||||
#endif
|
||||
|
||||
typedef enum wasmer_engine_t {
|
||||
JIT = 0,
|
||||
UNIVERSAL = 0,
|
||||
NATIVE = 1,
|
||||
OBJECT_FILE = 2,
|
||||
} wasmer_engine_t;
|
||||
|
||||
2
lib/cache/Cargo.toml
vendored
2
lib/cache/Cargo.toml
vendored
@@ -21,7 +21,7 @@ criterion = "0.3"
|
||||
tempfile = "3"
|
||||
rand = "0.8.3"
|
||||
wasmer-compiler-singlepass = { path = "../compiler-singlepass", version = "1.0.2" }
|
||||
wasmer-engine-jit = { path = "../engine-jit", version = "1.0.2" }
|
||||
wasmer-engine-universal = { path = "../engine-universal", version = "1.0.2" }
|
||||
wasmer-engine-native = { path = "../engine-native", version = "1.0.2" }
|
||||
|
||||
[[bench]]
|
||||
|
||||
16
lib/cache/benches/bench_filesystem_cache.rs
vendored
16
lib/cache/benches/bench_filesystem_cache.rs
vendored
@@ -6,25 +6,25 @@ use wasmer::{Module, Store};
|
||||
use wasmer_cache::Cache;
|
||||
use wasmer_cache::{FileSystemCache, Hash};
|
||||
use wasmer_compiler_singlepass::Singlepass;
|
||||
use wasmer_engine_jit::JIT;
|
||||
use wasmer_engine_native::Native;
|
||||
use wasmer_engine_universal::Universal;
|
||||
|
||||
fn random_key() -> Hash {
|
||||
Hash::new(rand::thread_rng().gen::<[u8; 32]>())
|
||||
}
|
||||
|
||||
pub fn store_cache_jit(c: &mut Criterion) {
|
||||
pub fn store_cache_universal(c: &mut Criterion) {
|
||||
let tmp_dir = TempDir::new().unwrap();
|
||||
let mut fs_cache = FileSystemCache::new(tmp_dir.path()).unwrap();
|
||||
let compiler = Singlepass::default();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(
|
||||
&store,
|
||||
std::fs::read("../../lib/c-api/tests/assets/qjs.wasm").unwrap(),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
c.bench_function("store jit module in filesystem cache", |b| {
|
||||
c.bench_function("store universal module in filesystem cache", |b| {
|
||||
b.iter(|| {
|
||||
let key = random_key();
|
||||
fs_cache.store(key, &module).unwrap()
|
||||
@@ -32,11 +32,11 @@ pub fn store_cache_jit(c: &mut Criterion) {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn load_cache_jit(c: &mut Criterion) {
|
||||
pub fn load_cache_universal(c: &mut Criterion) {
|
||||
let tmp_dir = TempDir::new().unwrap();
|
||||
let mut fs_cache = FileSystemCache::new(tmp_dir.path()).unwrap();
|
||||
let compiler = Singlepass::default();
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
let module = Module::new(
|
||||
&store,
|
||||
std::fs::read("../../lib/c-api/tests/assets/qjs.wasm").unwrap(),
|
||||
@@ -45,7 +45,7 @@ pub fn load_cache_jit(c: &mut Criterion) {
|
||||
let key = Hash::new([0u8; 32]);
|
||||
fs_cache.store(key, &module).unwrap();
|
||||
|
||||
c.bench_function("load jit module in filesystem cache", |b| {
|
||||
c.bench_function("load universal module in filesystem cache", |b| {
|
||||
b.iter(|| unsafe { fs_cache.load(&store, key.clone()).unwrap() })
|
||||
});
|
||||
}
|
||||
@@ -90,6 +90,6 @@ pub fn load_cache_native(c: &mut Criterion) {
|
||||
criterion_group! {
|
||||
name = benches;
|
||||
config = Criterion::default().sample_size(300);
|
||||
targets = store_cache_jit, load_cache_jit, store_cache_native, load_cache_native
|
||||
targets = store_cache_universal, load_cache_universal, store_cache_native, load_cache_native
|
||||
}
|
||||
criterion_main!(benches);
|
||||
|
||||
@@ -31,7 +31,7 @@ wasmer-compiler-singlepass = { version = "1.0.2", path = "../compiler-singlepass
|
||||
wasmer-compiler-llvm = { version = "1.0.2", path = "../compiler-llvm", optional = true }
|
||||
wasmer-emscripten = { version = "1.0.2", path = "../emscripten", optional = true }
|
||||
wasmer-engine = { version = "1.0.2", path = "../engine" }
|
||||
wasmer-engine-jit = { version = "1.0.2", path = "../engine-jit", optional = true }
|
||||
wasmer-engine-universal = { version = "1.0.2", path = "../engine-universal", optional = true }
|
||||
wasmer-engine-native = { version = "1.0.2", path = "../engine-native", optional = true }
|
||||
wasmer-engine-object-file = { version = "1.0.2", path = "../engine-object-file", optional = true }
|
||||
wasmer-vm = { version = "1.0.2", path = "../vm" }
|
||||
@@ -60,7 +60,7 @@ tempfile = "3"
|
||||
default = [
|
||||
"wat",
|
||||
"wast",
|
||||
"jit",
|
||||
"universal",
|
||||
"native",
|
||||
"object-file",
|
||||
"cache",
|
||||
@@ -68,8 +68,8 @@ default = [
|
||||
"emscripten",
|
||||
]
|
||||
engine = []
|
||||
jit = [
|
||||
"wasmer-engine-jit",
|
||||
universal = [
|
||||
"wasmer-engine-universal",
|
||||
"engine",
|
||||
]
|
||||
native = [
|
||||
@@ -87,7 +87,7 @@ emscripten = ["wasmer-emscripten"]
|
||||
wat = ["wasmer/wat"]
|
||||
compiler = [
|
||||
"wasmer-compiler/translator",
|
||||
"wasmer-engine-jit/compiler",
|
||||
"wasmer-engine-universal/compiler",
|
||||
"wasmer-engine-native/compiler",
|
||||
"wasmer-engine-object-file/compiler",
|
||||
]
|
||||
@@ -110,4 +110,4 @@ llvm = [
|
||||
debug = ["fern", "log", "wasmer-wasi/logging"]
|
||||
disable-all-logging = ["wasmer-wasi/disable-all-logging"]
|
||||
headless = []
|
||||
headless-minimal = ["headless", "disable-all-logging", "wasi", "native", "jit"]
|
||||
headless-minimal = ["headless", "disable-all-logging", "wasi", "native", "universal"]
|
||||
|
||||
@@ -25,7 +25,7 @@ cargo build --release --features "singlepass,cranelift"
|
||||
The Wasmer supports the following features:
|
||||
* `wat` (default): support for executing WebAssembly text files.
|
||||
* `wast`(default): support for running wast test files.
|
||||
* `jit` (default): support for the [JIT engine].
|
||||
* `universal` (default): support for the [Universal engine].
|
||||
* `native` (default): support for the [Native engine].
|
||||
* `cache` (default): support or automatically caching compiled artifacts.
|
||||
* `wasi` (default): support for [WASI].
|
||||
@@ -35,7 +35,7 @@ The Wasmer supports the following features:
|
||||
* `cranelift`: support for the [Cranelift compiler].
|
||||
* `llvm`: support for the [LLVM compiler].
|
||||
|
||||
[JIT Engine]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-jit/
|
||||
[Universal Engine]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-universal/
|
||||
[Native Engine]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-native/
|
||||
[WASI]: https://github.com/wasmerio/wasmer/tree/master/lib/wasi/
|
||||
[Emscripten]: https://github.com/wasmerio/wasmer/tree/master/lib/emscripten/
|
||||
|
||||
@@ -47,13 +47,15 @@ impl Compile {
|
||||
EngineType::Native => {
|
||||
wasmer_engine_native::NativeArtifact::get_default_extension(target_triple)
|
||||
}
|
||||
#[cfg(feature = "jit")]
|
||||
EngineType::JIT => wasmer_engine_jit::JITArtifact::get_default_extension(target_triple),
|
||||
#[cfg(feature = "universal")]
|
||||
EngineType::Universal => {
|
||||
wasmer_engine_universal::UniversalArtifact::get_default_extension(target_triple)
|
||||
}
|
||||
#[cfg(feature = "object-file")]
|
||||
EngineType::ObjectFile => {
|
||||
wasmer_engine_object_file::ObjectFileArtifact::get_default_extension(target_triple)
|
||||
}
|
||||
#[cfg(not(all(feature = "native", feature = "jit", feature = "object-file")))]
|
||||
#[cfg(not(all(feature = "native", feature = "universal", feature = "object-file")))]
|
||||
_ => bail!("selected engine type is not compiled in"),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -214,10 +214,10 @@ impl Run {
|
||||
return Ok(module);
|
||||
}
|
||||
}
|
||||
#[cfg(feature = "jit")]
|
||||
#[cfg(feature = "universal")]
|
||||
{
|
||||
if wasmer_engine_jit::JITArtifact::is_deserializable(&contents) {
|
||||
let engine = wasmer_engine_jit::JIT::headless().engine();
|
||||
if wasmer_engine_universal::UniversalArtifact::is_deserializable(&contents) {
|
||||
let engine = wasmer_engine_universal::Universal::headless().engine();
|
||||
let store = Store::new(&engine);
|
||||
let module = unsafe { Module::deserialize_from_file(&store, &self.path)? };
|
||||
return Ok(module);
|
||||
@@ -305,9 +305,10 @@ impl Run {
|
||||
wasmer_engine_native::NativeArtifact::get_default_extension(&Triple::host())
|
||||
.to_string()
|
||||
}
|
||||
#[cfg(feature = "jit")]
|
||||
EngineType::JIT => {
|
||||
wasmer_engine_jit::JITArtifact::get_default_extension(&Triple::host()).to_string()
|
||||
#[cfg(feature = "universal")]
|
||||
EngineType::Universal => {
|
||||
wasmer_engine_universal::UniversalArtifact::get_default_extension(&Triple::host())
|
||||
.to_string()
|
||||
}
|
||||
// We use the compiler type as the default extension
|
||||
_ => compiler_type.to_string(),
|
||||
|
||||
@@ -19,16 +19,16 @@ pub struct StoreOptions {
|
||||
#[clap(flatten)]
|
||||
compiler: CompilerOptions,
|
||||
|
||||
/// Use JIT Engine.
|
||||
/// Use Universal Engine.
|
||||
#[clap(long, conflicts_with_all = &["native", "object-file"])]
|
||||
jit: bool,
|
||||
universal: bool,
|
||||
|
||||
/// Use Native Engine.
|
||||
#[clap(long, conflicts_with_all = &["jit", "object-file"])]
|
||||
#[clap(long, conflicts_with_all = &["universal", "object-file"])]
|
||||
native: bool,
|
||||
|
||||
/// Use ObjectFile Engine.
|
||||
#[clap(long, conflicts_with_all = &["jit", "native"])]
|
||||
#[clap(long, conflicts_with_all = &["universal", "native"])]
|
||||
object_file: bool,
|
||||
}
|
||||
|
||||
@@ -136,9 +136,9 @@ impl CompilerOptions {
|
||||
) -> Result<Box<dyn Engine + Send + Sync>> {
|
||||
let features = self.get_features(compiler_config.default_features_for_target(&target))?;
|
||||
let engine: Box<dyn Engine + Send + Sync> = match engine_type {
|
||||
#[cfg(feature = "jit")]
|
||||
EngineType::JIT => Box::new(
|
||||
wasmer_engine_jit::JIT::new(compiler_config)
|
||||
#[cfg(feature = "universal")]
|
||||
EngineType::Universal => Box::new(
|
||||
wasmer_engine_universal::Universal::new(compiler_config)
|
||||
.features(features)
|
||||
.target(target)
|
||||
.engine(),
|
||||
@@ -157,7 +157,7 @@ impl CompilerOptions {
|
||||
.features(features)
|
||||
.engine(),
|
||||
),
|
||||
#[cfg(not(all(feature = "jit", feature = "native", feature = "object-file")))]
|
||||
#[cfg(not(all(feature = "universal", feature = "native", feature = "object-file")))]
|
||||
engine => bail!(
|
||||
"The `{}` engine is not included in this binary.",
|
||||
engine.to_string()
|
||||
@@ -360,8 +360,8 @@ impl FromStr for CompilerType {
|
||||
/// The engine used for the store
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum EngineType {
|
||||
/// JIT Engine
|
||||
JIT,
|
||||
/// Universal Engine
|
||||
Universal,
|
||||
/// Native Engine
|
||||
Native,
|
||||
/// Object File Engine
|
||||
@@ -371,7 +371,7 @@ pub enum EngineType {
|
||||
impl ToString for EngineType {
|
||||
fn to_string(&self) -> String {
|
||||
match self {
|
||||
Self::JIT => "jit".to_string(),
|
||||
Self::Universal => "universal".to_string(),
|
||||
Self::Native => "native".to_string(),
|
||||
Self::ObjectFile => "objectfile".to_string(),
|
||||
}
|
||||
@@ -414,16 +414,16 @@ impl StoreOptions {
|
||||
#[cfg(feature = "engine")]
|
||||
impl StoreOptions {
|
||||
fn get_engine(&self) -> Result<EngineType> {
|
||||
if self.jit {
|
||||
Ok(EngineType::JIT)
|
||||
if self.universal {
|
||||
Ok(EngineType::Universal)
|
||||
} else if self.native {
|
||||
Ok(EngineType::Native)
|
||||
} else if self.object_file {
|
||||
Ok(EngineType::ObjectFile)
|
||||
} else {
|
||||
// Auto mode, we choose the best engine for that platform
|
||||
if cfg!(feature = "jit") {
|
||||
Ok(EngineType::JIT)
|
||||
if cfg!(feature = "universal") {
|
||||
Ok(EngineType::Universal)
|
||||
} else if cfg!(feature = "native") {
|
||||
Ok(EngineType::Native)
|
||||
} else if cfg!(feature = "object-file") {
|
||||
@@ -441,15 +441,17 @@ impl StoreOptions {
|
||||
fn get_engine_headless(&self) -> Result<(Arc<dyn Engine + Send + Sync>, EngineType)> {
|
||||
let engine_type = self.get_engine()?;
|
||||
let engine: Arc<dyn Engine + Send + Sync> = match engine_type {
|
||||
#[cfg(feature = "jit")]
|
||||
EngineType::JIT => Arc::new(wasmer_engine_jit::JIT::headless().engine()),
|
||||
#[cfg(feature = "universal")]
|
||||
EngineType::Universal => {
|
||||
Arc::new(wasmer_engine_universal::Universal::headless().engine())
|
||||
}
|
||||
#[cfg(feature = "native")]
|
||||
EngineType::Native => Arc::new(wasmer_engine_native::Native::headless().engine()),
|
||||
#[cfg(feature = "object-file")]
|
||||
EngineType::ObjectFile => {
|
||||
Arc::new(wasmer_engine_object_file::ObjectFile::headless().engine())
|
||||
}
|
||||
#[cfg(not(all(feature = "jit", feature = "native", feature = "object-file")))]
|
||||
#[cfg(not(all(feature = "universal", feature = "native", feature = "object-file")))]
|
||||
engine => bail!(
|
||||
"The `{}` engine is not included in this binary.",
|
||||
engine.to_string()
|
||||
|
||||
@@ -5,12 +5,12 @@ This crate contains a compiler implementation based on Cranelift.
|
||||
## Usage
|
||||
|
||||
```rust
|
||||
use wasmer::{Store, JIT};
|
||||
use wasmer::{Store, Universal};
|
||||
use wasmer_compiler_cranelift::Cranelift;
|
||||
|
||||
let compiler = Cranelift::new();
|
||||
// Put it into an engine and add it to the store
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
```
|
||||
|
||||
*Note: you can find a [full working example using Cranelift compiler
|
||||
|
||||
@@ -5,12 +5,12 @@ This crate contains a compiler implementation based on [the LLVM Compiler Infras
|
||||
## Usage
|
||||
|
||||
```rust
|
||||
use wasmer::{Store, JIT};
|
||||
use wasmer::{Store, Universal};
|
||||
use wasmer_compiler_llvm::LLVM;
|
||||
|
||||
let compiler = LLVM::new();
|
||||
// Put it into an engine and add it to the store
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
```
|
||||
|
||||
*Note: you can find a [full working example using LLVM compiler here][example].*
|
||||
|
||||
@@ -5,12 +5,12 @@ This crate contains a compiler implementation based on the Singlepass linear com
|
||||
## Usage
|
||||
|
||||
```rust
|
||||
use wasmer::{Store, JIT};
|
||||
use wasmer::{Store, Universal};
|
||||
use wasmer_compiler_singlepass::Singlepass;
|
||||
|
||||
let compiler = Singlepass::new();
|
||||
// Put it into an engine and add it to the store
|
||||
let store = Store::new(&JIT::new(compiler).engine());
|
||||
let store = Store::new(&Universal::new(compiler).engine());
|
||||
```
|
||||
|
||||
*Note: you can find a [full working example using Singlepass compiler
|
||||
|
||||
@@ -3,10 +3,6 @@
|
||||
|
||||
//! A `Compilation` contains the compiled function bodies for a WebAssembly
|
||||
//! module (`CompiledFunction`).
|
||||
//!
|
||||
//! The `CompiledFunction` will be used mainly by different frontends:
|
||||
//! * `jit`: to generate a JIT
|
||||
//! * `obj`: to generate a native object
|
||||
|
||||
use crate::lib::std::vec::Vec;
|
||||
use crate::section::{CustomSection, SectionIndex};
|
||||
|
||||
6
lib/deprecated/runtime-core/Cargo.lock
generated
6
lib/deprecated/runtime-core/Cargo.lock
generated
@@ -1182,7 +1182,7 @@ dependencies = [
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-derive",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
@@ -1305,7 +1305,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine-jit"
|
||||
name = "wasmer-engine-universal"
|
||||
version = "1.0.2"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
@@ -1363,7 +1363,7 @@ dependencies = [
|
||||
"wasmer-compiler-llvm",
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
]
|
||||
|
||||
@@ -22,7 +22,7 @@ wasmer-compiler-llvm = { path = "../../compiler-llvm", version = "1.0.2", option
|
||||
wasmer-compiler-cranelift = { path = "../../compiler-cranelift", version = "1.0.2", optional = true }
|
||||
wasmer-compiler-singlepass = { path = "../../compiler-singlepass", version = "1.0.2", optional = true }
|
||||
wasmer-engine = { path = "../../engine", version = "1.0.2" }
|
||||
wasmer-engine-jit = { path = "../../engine-jit", version = "1.0.2" }
|
||||
wasmer-engine-universal = { path = "../../engine-universal", version = "1.0.2" }
|
||||
wasmer-vm = { path = "../../vm", version = "1.0.2" }
|
||||
lazy_static = "1.4"
|
||||
|
||||
|
||||
6
lib/deprecated/runtime/Cargo.lock
generated
6
lib/deprecated/runtime/Cargo.lock
generated
@@ -1182,7 +1182,7 @@ dependencies = [
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-derive",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-engine-native",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
@@ -1305,7 +1305,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wasmer-engine-jit"
|
||||
name = "wasmer-engine-universal"
|
||||
version = "1.0.2"
|
||||
dependencies = [
|
||||
"cfg-if 0.1.10",
|
||||
@@ -1370,7 +1370,7 @@ dependencies = [
|
||||
"wasmer-compiler-llvm",
|
||||
"wasmer-compiler-singlepass",
|
||||
"wasmer-engine",
|
||||
"wasmer-engine-jit",
|
||||
"wasmer-engine-universal",
|
||||
"wasmer-types",
|
||||
"wasmer-vm",
|
||||
]
|
||||
|
||||
@@ -13,9 +13,9 @@ This allows Wasmer to achieve *blazing fast* **native startup times**.
|
||||
*Note: you can find a [full working example using the Native engine
|
||||
here][example].*
|
||||
|
||||
### Difference with `wasmer-engine-jit`
|
||||
### Difference with `wasmer-engine-universal`
|
||||
|
||||
The Native Engine and JIT engine mainly differ on how the Modules are loaded/stored.
|
||||
The Native Engine and Universal Engine mainly differ on how the Modules are loaded/stored.
|
||||
Using the same compilers, both will have the same runtime speed.
|
||||
|
||||
However, the Native engine uses the Operating System shared library loader (via `dlopen`)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
[package]
|
||||
name = "wasmer-engine-jit"
|
||||
name = "wasmer-engine-universal"
|
||||
version = "1.0.2"
|
||||
description = "Wasmer JIT Engine"
|
||||
description = "Wasmer Universal Engine"
|
||||
categories = ["wasm"]
|
||||
keywords = ["wasm", "webassembly", "engine", "jit"]
|
||||
keywords = ["wasm", "webassembly", "engine", "universal"]
|
||||
authors = ["Wasmer Engineering Team <engineering@wasmer.io>"]
|
||||
repository = "https://github.com/wasmerio/wasmer"
|
||||
license = "MIT OR Apache-2.0 WITH LLVM-exception "
|
||||
@@ -1,11 +1,11 @@
|
||||
# `wasmer-engine-jit` [](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [](https://slack.wasmer.io) [](https://github.com/wasmerio/wasmer/blob/master/LICENSE)
|
||||
# `wasmer-engine-universal` [](https://github.com/wasmerio/wasmer/actions?query=workflow%3Abuild) [](https://slack.wasmer.io) [](https://github.com/wasmerio/wasmer/blob/master/LICENSE)
|
||||
|
||||
The Wasmer JIT engine is usable with any compiler implementation based
|
||||
on [`wasmer-compiler`]. After the compiler process the result, the JIT
|
||||
The Wasmer Universal engine is usable with any compiler implementation based
|
||||
on [`wasmer-compiler`]. After the compiler process the result, the Universal
|
||||
pushes it into memory and links its contents so it can be usable by
|
||||
the [`wasmer`] API.
|
||||
|
||||
*Note: you can find a [full working example using the JIT engine
|
||||
*Note: you can find a [full working example using the Universal engine
|
||||
here][example].*
|
||||
|
||||
### Acknowledgments
|
||||
@@ -20,6 +20,6 @@ attributions of the project.
|
||||
|
||||
[`wasmer-compiler`]: https://github.com/wasmerio/wasmer/tree/master/lib/compiler
|
||||
[`wasmer`]: https://github.com/wasmerio/wasmer/tree/master/lib/api
|
||||
[example]: https://github.com/wasmerio/wasmer/blob/master/examples/engine_jit.rs
|
||||
[example]: https://github.com/wasmerio/wasmer/blob/master/examples/engine_universal.rs
|
||||
[`wasmtime-jit`]: https://crates.io/crates/wasmtime-jit
|
||||
[Wasmer `ATTRIBUTIONS`]: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md
|
||||
@@ -1,7 +1,7 @@
|
||||
//! Define `JITArtifact` to allow compiling and instantiating to be
|
||||
//! Define `UniversalArtifact` to allow compiling and instantiating to be
|
||||
//! done as separate steps.
|
||||
|
||||
use crate::engine::{JITEngine, JITEngineInner};
|
||||
use crate::engine::{UniversalEngine, UniversalEngineInner};
|
||||
use crate::link::link_module;
|
||||
#[cfg(feature = "compiler")]
|
||||
use crate::serialize::SerializableCompilation;
|
||||
@@ -27,12 +27,12 @@ use wasmer_vm::{
|
||||
VMTrampoline,
|
||||
};
|
||||
|
||||
const SERIALIZED_METADATA_LENGTH_OFFSET: usize = 16;
|
||||
const SERIALIZED_METADATA_LENGTH_OFFSET: usize = 22;
|
||||
const SERIALIZED_METADATA_CONTENT_OFFSET: usize = 32;
|
||||
|
||||
/// A compiled wasm module, ready to be instantiated.
|
||||
#[derive(MemoryUsage)]
|
||||
pub struct JITArtifact {
|
||||
pub struct UniversalArtifact {
|
||||
serializable: SerializableModule,
|
||||
finished_functions: BoxedSlice<LocalFunctionIndex, FunctionBodyPtr>,
|
||||
#[loupe(skip)]
|
||||
@@ -44,28 +44,28 @@ pub struct JITArtifact {
|
||||
finished_function_lengths: BoxedSlice<LocalFunctionIndex, usize>,
|
||||
}
|
||||
|
||||
impl JITArtifact {
|
||||
const MAGIC_HEADER: &'static [u8; 16] = b"\0wasmer-jit\0\0\0\0\0";
|
||||
impl UniversalArtifact {
|
||||
const MAGIC_HEADER: &'static [u8; 22] = b"\0wasmer-universal\0\0\0\0\0";
|
||||
|
||||
/// Check if the provided bytes look like a serialized `JITArtifact`.
|
||||
/// Check if the provided bytes look like a serialized `UniversalArtifact`.
|
||||
pub fn is_deserializable(bytes: &[u8]) -> bool {
|
||||
bytes.starts_with(Self::MAGIC_HEADER)
|
||||
}
|
||||
|
||||
/// Compile a data buffer into a `JITArtifact`, which may then be instantiated.
|
||||
/// Compile a data buffer into a `UniversalArtifact`, which may then be instantiated.
|
||||
#[cfg(feature = "compiler")]
|
||||
pub fn new(
|
||||
jit: &JITEngine,
|
||||
engine: &UniversalEngine,
|
||||
data: &[u8],
|
||||
tunables: &dyn Tunables,
|
||||
) -> Result<Self, CompileError> {
|
||||
let environ = ModuleEnvironment::new();
|
||||
let mut inner_jit = jit.inner_mut();
|
||||
let features = inner_jit.features();
|
||||
let mut inner_engine = engine.inner_mut();
|
||||
let features = inner_engine.features();
|
||||
|
||||
let translation = environ.translate(data).map_err(CompileError::Wasm)?;
|
||||
|
||||
let compiler = inner_jit.compiler()?;
|
||||
let compiler = inner_engine.compiler()?;
|
||||
|
||||
// We try to apply the middleware first
|
||||
let mut module = translation.module;
|
||||
@@ -92,7 +92,7 @@ impl JITArtifact {
|
||||
|
||||
// Compile the Module
|
||||
let compilation = compiler.compile_module(
|
||||
&jit.target(),
|
||||
&engine.target(),
|
||||
&compile_info,
|
||||
// SAFETY: Calling `unwrap` is correct since
|
||||
// `environ.translate()` above will write some data into
|
||||
@@ -128,26 +128,29 @@ impl JITArtifact {
|
||||
compile_info,
|
||||
data_initializers,
|
||||
};
|
||||
Self::from_parts(&mut inner_jit, serializable)
|
||||
Self::from_parts(&mut inner_engine, serializable)
|
||||
}
|
||||
|
||||
/// Compile a data buffer into a `JITArtifact`, which may then be instantiated.
|
||||
/// Compile a data buffer into a `UniversalArtifact`, which may then be instantiated.
|
||||
#[cfg(not(feature = "compiler"))]
|
||||
pub fn new(_jit: &JITEngine, _data: &[u8]) -> Result<Self, CompileError> {
|
||||
pub fn new(_engine: &UniversalEngine, _data: &[u8]) -> Result<Self, CompileError> {
|
||||
Err(CompileError::Codegen(
|
||||
"Compilation is not enabled in the engine".to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Deserialize a JITArtifact
|
||||
/// Deserialize a UniversalArtifact
|
||||
///
|
||||
/// # Safety
|
||||
/// This function is unsafe because rkyv reads directly without validating
|
||||
/// the data.
|
||||
pub unsafe fn deserialize(jit: &JITEngine, bytes: &[u8]) -> Result<Self, DeserializeError> {
|
||||
pub unsafe fn deserialize(
|
||||
universal: &UniversalEngine,
|
||||
bytes: &[u8],
|
||||
) -> Result<Self, DeserializeError> {
|
||||
if !Self::is_deserializable(bytes) {
|
||||
return Err(DeserializeError::Incompatible(
|
||||
"The provided bytes are not wasmer-jit".to_string(),
|
||||
"The provided bytes are not wasmer-universal".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -162,12 +165,13 @@ impl JITArtifact {
|
||||
);
|
||||
|
||||
let serializable = SerializableModule::deserialize(metadata_slice)?;
|
||||
Self::from_parts(&mut jit.inner_mut(), serializable).map_err(DeserializeError::Compiler)
|
||||
Self::from_parts(&mut universal.inner_mut(), serializable)
|
||||
.map_err(DeserializeError::Compiler)
|
||||
}
|
||||
|
||||
/// Construct a `JITArtifact` from component parts.
|
||||
/// Construct a `UniversalArtifact` from component parts.
|
||||
pub fn from_parts(
|
||||
inner_jit: &mut JITEngineInner,
|
||||
inner_engine: &mut UniversalEngineInner,
|
||||
serializable: SerializableModule,
|
||||
) -> Result<Self, CompileError> {
|
||||
let (
|
||||
@@ -175,7 +179,7 @@ impl JITArtifact {
|
||||
finished_function_call_trampolines,
|
||||
finished_dynamic_function_trampolines,
|
||||
custom_sections,
|
||||
) = inner_jit.allocate(
|
||||
) = inner_engine.allocate(
|
||||
&serializable.compile_info.module,
|
||||
&serializable.compilation.function_bodies,
|
||||
&serializable.compilation.function_call_trampolines,
|
||||
@@ -194,7 +198,7 @@ impl JITArtifact {
|
||||
|
||||
// Compute indices into the shared signature table.
|
||||
let signatures = {
|
||||
let signature_registry = inner_jit.signatures();
|
||||
let signature_registry = inner_engine.signatures();
|
||||
serializable
|
||||
.compile_info
|
||||
.module
|
||||
@@ -218,9 +222,9 @@ impl JITArtifact {
|
||||
None => None,
|
||||
};
|
||||
// Make all code compiled thus far executable.
|
||||
inner_jit.publish_compiled_code();
|
||||
inner_engine.publish_compiled_code();
|
||||
|
||||
inner_jit.publish_eh_frame(eh_frame)?;
|
||||
inner_engine.publish_eh_frame(eh_frame)?;
|
||||
|
||||
let finished_function_lengths = finished_functions
|
||||
.values()
|
||||
@@ -237,7 +241,7 @@ impl JITArtifact {
|
||||
let finished_dynamic_function_trampolines =
|
||||
finished_dynamic_function_trampolines.into_boxed_slice();
|
||||
let signatures = signatures.into_boxed_slice();
|
||||
let func_data_registry = inner_jit.func_data().clone();
|
||||
let func_data_registry = inner_engine.func_data().clone();
|
||||
|
||||
Ok(Self {
|
||||
serializable,
|
||||
@@ -253,12 +257,12 @@ impl JITArtifact {
|
||||
|
||||
/// Get the default extension when serializing this artifact
|
||||
pub fn get_default_extension(_triple: &Triple) -> &'static str {
|
||||
// `.wjit` is the default extension for all the triples
|
||||
"wjit"
|
||||
// `.wuniversal` is the default extension for all the triples
|
||||
"wuniversal"
|
||||
}
|
||||
}
|
||||
|
||||
impl Artifact for JITArtifact {
|
||||
impl Artifact for UniversalArtifact {
|
||||
fn module(&self) -> Arc<ModuleInfo> {
|
||||
self.serializable.compile_info.module.clone()
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
use crate::JITEngine;
|
||||
use crate::UniversalEngine;
|
||||
use wasmer_compiler::{CompilerConfig, Features, Target};
|
||||
|
||||
/// The JIT builder
|
||||
pub struct JIT {
|
||||
/// The Universal builder
|
||||
pub struct Universal {
|
||||
#[allow(dead_code)]
|
||||
compiler_config: Option<Box<dyn CompilerConfig>>,
|
||||
target: Option<Target>,
|
||||
features: Option<Features>,
|
||||
}
|
||||
|
||||
impl JIT {
|
||||
/// Create a new JIT
|
||||
impl Universal {
|
||||
/// Create a new Universal
|
||||
pub fn new<T>(compiler_config: T) -> Self
|
||||
where
|
||||
T: Into<Box<dyn CompilerConfig>>,
|
||||
@@ -22,7 +22,7 @@ impl JIT {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new headless JIT
|
||||
/// Create a new headless Universal
|
||||
pub fn headless() -> Self {
|
||||
Self {
|
||||
compiler_config: None,
|
||||
@@ -43,24 +43,24 @@ impl JIT {
|
||||
self
|
||||
}
|
||||
|
||||
/// Build the `JITEngine` for this configuration
|
||||
/// Build the `UniversalEngine` for this configuration
|
||||
#[cfg(feature = "compiler")]
|
||||
pub fn engine(self) -> JITEngine {
|
||||
pub fn engine(self) -> UniversalEngine {
|
||||
let target = self.target.unwrap_or_default();
|
||||
if let Some(compiler_config) = self.compiler_config {
|
||||
let features = self
|
||||
.features
|
||||
.unwrap_or_else(|| compiler_config.default_features_for_target(&target));
|
||||
let compiler = compiler_config.compiler();
|
||||
JITEngine::new(compiler, target, features)
|
||||
UniversalEngine::new(compiler, target, features)
|
||||
} else {
|
||||
JITEngine::headless()
|
||||
UniversalEngine::headless()
|
||||
}
|
||||
}
|
||||
|
||||
/// Build the `JITEngine` for this configuration
|
||||
/// Build the `UniversalEngine` for this configuration
|
||||
#[cfg(not(feature = "compiler"))]
|
||||
pub fn engine(self) -> JITEngine {
|
||||
JITEngine::headless()
|
||||
pub fn engine(self) -> UniversalEngine {
|
||||
UniversalEngine::headless()
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
//! JIT compilation.
|
||||
//! Universal compilation.
|
||||
|
||||
use crate::{CodeMemory, JITArtifact};
|
||||
use crate::{CodeMemory, UniversalArtifact};
|
||||
use loupe::MemoryUsage;
|
||||
use std::sync::{Arc, Mutex};
|
||||
#[cfg(feature = "compiler")]
|
||||
@@ -17,21 +17,21 @@ use wasmer_vm::{
|
||||
VMCallerCheckedAnyfunc, VMFuncRef, VMFunctionBody, VMSharedSignatureIndex, VMTrampoline,
|
||||
};
|
||||
|
||||
/// A WebAssembly `JIT` Engine.
|
||||
/// A WebAssembly `Universal` Engine.
|
||||
#[derive(Clone, MemoryUsage)]
|
||||
pub struct JITEngine {
|
||||
inner: Arc<Mutex<JITEngineInner>>,
|
||||
pub struct UniversalEngine {
|
||||
inner: Arc<Mutex<UniversalEngineInner>>,
|
||||
/// The target for the compiler
|
||||
target: Arc<Target>,
|
||||
engine_id: EngineId,
|
||||
}
|
||||
|
||||
impl JITEngine {
|
||||
/// Create a new `JITEngine` with the given config
|
||||
impl UniversalEngine {
|
||||
/// Create a new `UniversalEngine` with the given config
|
||||
#[cfg(feature = "compiler")]
|
||||
pub fn new(compiler: Box<dyn Compiler>, target: Target, features: Features) -> Self {
|
||||
Self {
|
||||
inner: Arc::new(Mutex::new(JITEngineInner {
|
||||
inner: Arc::new(Mutex::new(UniversalEngineInner {
|
||||
compiler: Some(compiler),
|
||||
code_memory: vec![],
|
||||
signatures: SignatureRegistry::new(),
|
||||
@@ -43,7 +43,7 @@ impl JITEngine {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a headless `JITEngine`
|
||||
/// Create a headless `UniversalEngine`
|
||||
///
|
||||
/// A headless engine is an engine without any compiler attached.
|
||||
/// This is useful for assuring a minimal runtime for running
|
||||
@@ -58,7 +58,7 @@ impl JITEngine {
|
||||
/// they just take already processed Modules (via `Module::serialize`).
|
||||
pub fn headless() -> Self {
|
||||
Self {
|
||||
inner: Arc::new(Mutex::new(JITEngineInner {
|
||||
inner: Arc::new(Mutex::new(UniversalEngineInner {
|
||||
#[cfg(feature = "compiler")]
|
||||
compiler: None,
|
||||
code_memory: vec![],
|
||||
@@ -71,16 +71,16 @@ impl JITEngine {
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn inner(&self) -> std::sync::MutexGuard<'_, JITEngineInner> {
|
||||
pub(crate) fn inner(&self) -> std::sync::MutexGuard<'_, UniversalEngineInner> {
|
||||
self.inner.lock().unwrap()
|
||||
}
|
||||
|
||||
pub(crate) fn inner_mut(&self) -> std::sync::MutexGuard<'_, JITEngineInner> {
|
||||
pub(crate) fn inner_mut(&self) -> std::sync::MutexGuard<'_, UniversalEngineInner> {
|
||||
self.inner.lock().unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
impl Engine for JITEngine {
|
||||
impl Engine for UniversalEngine {
|
||||
/// The target
|
||||
fn target(&self) -> &Target {
|
||||
&self.target
|
||||
@@ -115,7 +115,7 @@ impl Engine for JITEngine {
|
||||
binary: &[u8],
|
||||
tunables: &dyn Tunables,
|
||||
) -> Result<Arc<dyn Artifact>, CompileError> {
|
||||
Ok(Arc::new(JITArtifact::new(&self, binary, tunables)?))
|
||||
Ok(Arc::new(UniversalArtifact::new(&self, binary, tunables)?))
|
||||
}
|
||||
|
||||
/// Compile a WebAssembly binary
|
||||
@@ -126,14 +126,14 @@ impl Engine for JITEngine {
|
||||
_tunables: &dyn Tunables,
|
||||
) -> Result<Arc<dyn Artifact>, CompileError> {
|
||||
Err(CompileError::Codegen(
|
||||
"The JITEngine is operating in headless mode, so it can not compile Modules."
|
||||
"The UniversalEngine is operating in headless mode, so it can not compile Modules."
|
||||
.to_string(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Deserializes a WebAssembly module
|
||||
unsafe fn deserialize(&self, bytes: &[u8]) -> Result<Arc<dyn Artifact>, DeserializeError> {
|
||||
Ok(Arc::new(JITArtifact::deserialize(&self, &bytes)?))
|
||||
Ok(Arc::new(UniversalArtifact::deserialize(&self, &bytes)?))
|
||||
}
|
||||
|
||||
fn id(&self) -> &EngineId {
|
||||
@@ -145,9 +145,9 @@ impl Engine for JITEngine {
|
||||
}
|
||||
}
|
||||
|
||||
/// The inner contents of `JITEngine`
|
||||
/// The inner contents of `UniversalEngine`
|
||||
#[derive(MemoryUsage)]
|
||||
pub struct JITEngineInner {
|
||||
pub struct UniversalEngineInner {
|
||||
/// The compiler
|
||||
#[cfg(feature = "compiler")]
|
||||
compiler: Option<Box<dyn Compiler>>,
|
||||
@@ -165,12 +165,12 @@ pub struct JITEngineInner {
|
||||
func_data: Arc<FuncDataRegistry>,
|
||||
}
|
||||
|
||||
impl JITEngineInner {
|
||||
impl UniversalEngineInner {
|
||||
/// Gets the compiler associated to this engine.
|
||||
#[cfg(feature = "compiler")]
|
||||
pub fn compiler(&self) -> Result<&dyn Compiler, CompileError> {
|
||||
if self.compiler.is_none() {
|
||||
return Err(CompileError::Codegen("The JITEngine is operating in headless mode, so it can only execute already compiled Modules.".to_string()));
|
||||
return Err(CompileError::Codegen("The UniversalEngine is operating in headless mode, so it can only execute already compiled Modules.".to_string()));
|
||||
}
|
||||
Ok(&**self.compiler.as_ref().unwrap())
|
||||
}
|
||||
@@ -185,7 +185,7 @@ impl JITEngineInner {
|
||||
#[cfg(not(feature = "compiler"))]
|
||||
pub fn validate<'data>(&self, _data: &'data [u8]) -> Result<(), CompileError> {
|
||||
Err(CompileError::Validate(
|
||||
"The JITEngine is not compiled with compiler support, which is required for validating"
|
||||
"The UniversalEngine is not compiled with compiler support, which is required for validating"
|
||||
.to_string(),
|
||||
))
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
//! JIT backend for Wasmer compilers.
|
||||
//! Universal backend for Wasmer compilers.
|
||||
//!
|
||||
//! Given a compiler (such as `CraneliftCompiler` or `LLVMCompiler`)
|
||||
//! it generates the compiled machine code, and publishes it into
|
||||
@@ -32,10 +32,10 @@ mod link;
|
||||
mod serialize;
|
||||
mod unwind;
|
||||
|
||||
pub use crate::artifact::JITArtifact;
|
||||
pub use crate::builder::JIT;
|
||||
pub use crate::artifact::UniversalArtifact;
|
||||
pub use crate::builder::Universal;
|
||||
pub use crate::code_memory::CodeMemory;
|
||||
pub use crate::engine::JITEngine;
|
||||
pub use crate::engine::UniversalEngine;
|
||||
pub use crate::link::link_module;
|
||||
|
||||
/// Version number of this crate.
|
||||
@@ -1,4 +1,4 @@
|
||||
//! Linking for JIT-compiled code.
|
||||
//! Linking for Universal-compiled code.
|
||||
|
||||
use std::ptr::write_unaligned;
|
||||
use wasmer_compiler::{
|
||||
@@ -30,7 +30,7 @@ pub struct SerializableCompilation {
|
||||
}
|
||||
|
||||
/// Serializable struct that is able to serialize from and to
|
||||
/// a `JITArtifactInfo`.
|
||||
/// a `UniversalArtifactInfo`.
|
||||
#[derive(MemoryUsage, Archive, RkyvDeserialize, RkyvSerialize)]
|
||||
pub struct SerializableModule {
|
||||
pub compilation: SerializableCompilation,
|
||||
@@ -8,9 +8,11 @@ Wasmer Engines are mainly responsible for two things:
|
||||
* **Load** an`Artifact` so it can be used by the user (normally,
|
||||
pushing the code into executable memory and so on).
|
||||
|
||||
It currently has two implementations:
|
||||
1. JIT with [`wasmer-engine-jit`],
|
||||
2. Native with [`wasmer-engine-native`].
|
||||
It currently has three implementations:
|
||||
|
||||
1. Universal with [`wasmer-engine-universal`],
|
||||
2. Native with [`wasmer-engine-native`],
|
||||
3. Object with [`wasmer-engine-object-file`].
|
||||
|
||||
## Example Implementation
|
||||
|
||||
@@ -26,8 +28,9 @@ Please check [Wasmer `ATTRIBUTIONS`] to further see licenses and other
|
||||
attributions of the project.
|
||||
|
||||
|
||||
[`wasmer-engine-jit`]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-jit
|
||||
[`wasmer-engine-universal`]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-universal
|
||||
[`wasmer-engine-native`]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-native
|
||||
[`wasmer-engine-object-file`]: https://github.com/wasmerio/wasmer/tree/master/lib/engine-object-file
|
||||
[`wasmer-engine-dummy`]: https://github.com/wasmerio/wasmer/tree/master/tests/lib/engine-dummy
|
||||
[`wasmtime-api`]: https://crates.io/crates/wasmtime
|
||||
[Wasmer `ATTRIBUTIONS`]: https://github.com/wasmerio/wasmer/blob/master/ATTRIBUTIONS.md
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//! JIT compilation.
|
||||
//! Engine trait and associated types.
|
||||
|
||||
use crate::tunables::Tunables;
|
||||
use crate::{Artifact, DeserializeError};
|
||||
@@ -14,7 +14,7 @@ use wasmer_vm::{VMCallerCheckedAnyfunc, VMFuncRef, VMSharedSignatureIndex};
|
||||
/// A unimplemented Wasmer `Engine`.
|
||||
///
|
||||
/// This trait is used by implementors to implement custom engines
|
||||
/// such as: JIT or Native.
|
||||
/// such as: Universal or Native.
|
||||
///
|
||||
/// The product that an `Engine` produces and consumes is the [`Artifact`].
|
||||
pub trait Engine: MemoryUsage {
|
||||
|
||||
@@ -288,7 +288,7 @@ mod tests {
|
||||
use super::*;
|
||||
|
||||
use std::sync::Arc;
|
||||
use wasmer::{imports, wat2wasm, CompilerConfig, Cranelift, Module, Store, JIT};
|
||||
use wasmer::{imports, wat2wasm, CompilerConfig, Cranelift, Module, Store, Universal};
|
||||
|
||||
fn cost_function(operator: &Operator) -> u64 {
|
||||
match operator {
|
||||
@@ -319,7 +319,7 @@ mod tests {
|
||||
let metering = Arc::new(Metering::new(10, cost_function));
|
||||
let mut compiler_config = Cranelift::default();
|
||||
compiler_config.push_middleware(metering.clone());
|
||||
let store = Store::new(&JIT::new(compiler_config).engine());
|
||||
let store = Store::new(&Universal::new(compiler_config).engine());
|
||||
let module = Module::new(&store, bytecode()).unwrap();
|
||||
|
||||
// Instantiate
|
||||
@@ -364,7 +364,7 @@ mod tests {
|
||||
let metering = Arc::new(Metering::new(10, cost_function));
|
||||
let mut compiler_config = Cranelift::default();
|
||||
compiler_config.push_middleware(metering.clone());
|
||||
let store = Store::new(&JIT::new(compiler_config).engine());
|
||||
let store = Store::new(&Universal::new(compiler_config).engine());
|
||||
let module = Module::new(&store, bytecode()).unwrap();
|
||||
|
||||
// Instantiate
|
||||
|
||||
@@ -34,20 +34,20 @@ dep_graph = {
|
||||
"wasmer-compiler-singlepass": set(["wasmer-types", "wasmer-vm", "wasmer-compiler"]),
|
||||
"wasmer-compiler-cranelift": set(["wasmer-types", "wasmer-vm", "wasmer-compiler"]),
|
||||
"wasmer-compiler-llvm": set(["wasmer-types", "wasmer-vm", "wasmer-compiler"]),
|
||||
"wasmer-engine-jit": set(["wasmer-types", "wasmer-vm", "wasmer-compiler", "wasmer-engine"]),
|
||||
"wasmer-engine-universal": set(["wasmer-types", "wasmer-vm", "wasmer-compiler", "wasmer-engine"]),
|
||||
"wasmer-engine-native": set(["wasmer-types", "wasmer-vm", "wasmer-compiler", "wasmer-engine",
|
||||
"wasmer-object"]),
|
||||
"wasmer-engine-object-file": set(["wasmer-types", "wasmer-vm", "wasmer-compiler", "wasmer-engine",
|
||||
"wasmer-object"]),
|
||||
"wasmer": set(["wasmer-vm", "wasmer-compiler-singlepass", "wasmer-compiler-cranelift",
|
||||
"wasmer-compiler-llvm", "wasmer-compiler", "wasmer-engine", "wasmer-engine-jit",
|
||||
"wasmer-compiler-llvm", "wasmer-compiler", "wasmer-engine", "wasmer-engine-universal",
|
||||
"wasmer-engine-native", "wasmer-engine-object-file", "wasmer-types", "wasmer-derive"]),
|
||||
"wasmer-cache": set(["wasmer"]),
|
||||
"wasmer-wasi": set(["wasmer"]),
|
||||
"wasmer-wasi-experimental-io-devices": set(["wasmer-wasi"]),
|
||||
"wasmer-emscripten": set(["wasmer"]),
|
||||
"wasmer-c-api": set(["wasmer", "wasmer-compiler", "wasmer-compiler-cranelift", "wasmer-compiler-singlepass",
|
||||
"wasmer-compiler-llvm", "wasmer-emscripten", "wasmer-engine", "wasmer-engine-jit",
|
||||
"wasmer-compiler-llvm", "wasmer-emscripten", "wasmer-engine", "wasmer-engine-universal",
|
||||
"wasmer-engine-native", "wasmer-engine-object-file", "wasmer-wasi", "wasmer-types"]),
|
||||
"wasmer-middlewares": set(["wasmer", "wasmer-types", "wasmer-vm"]),
|
||||
}
|
||||
@@ -65,7 +65,7 @@ location = {
|
||||
"wasmer-compiler-cranelift": "compiler-cranelift",
|
||||
"wasmer-compiler-llvm": "compiler-llvm",
|
||||
"wasmer-engine": "engine",
|
||||
"wasmer-engine-jit": "engine-jit",
|
||||
"wasmer-engine-universal": "engine-universal",
|
||||
"wasmer-engine-native": "engine-native",
|
||||
"wasmer-engine-object-file": "engine-object-file",
|
||||
"wasmer-cache": "cache",
|
||||
|
||||
@@ -11,7 +11,7 @@ pub enum Compiler {
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub enum Engine {
|
||||
Native,
|
||||
JIT,
|
||||
Universal,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
@@ -69,9 +69,9 @@ impl Config {
|
||||
}
|
||||
Box::new(engine.engine())
|
||||
}
|
||||
#[cfg(feature = "jit")]
|
||||
Engine::JIT => {
|
||||
let mut engine = wasmer_engine_jit::JIT::new(compiler_config);
|
||||
#[cfg(feature = "universal")]
|
||||
Engine::Universal => {
|
||||
let mut engine = wasmer_engine_universal::Universal::new(compiler_config);
|
||||
if let Some(ref features) = self.features {
|
||||
engine = engine.features(features.clone())
|
||||
}
|
||||
@@ -89,8 +89,8 @@ impl Config {
|
||||
match &self.engine {
|
||||
#[cfg(feature = "native")]
|
||||
Engine::Native => Box::new(wasmer_engine_native::Native::headless().engine()),
|
||||
#[cfg(feature = "jit")]
|
||||
Engine::JIT => Box::new(wasmer_engine_jit::JIT::headless().engine()),
|
||||
#[cfg(feature = "universal")]
|
||||
Engine::Universal => Box::new(wasmer_engine_universal::Universal::headless().engine()),
|
||||
#[allow(dead_code)]
|
||||
engine => panic!(
|
||||
"The {:?} Engine is not enabled. Please enable it using the features",
|
||||
|
||||
@@ -36,8 +36,8 @@ singlepass multi_value_imports::native
|
||||
singlepass multi_value_imports::dynamic
|
||||
|
||||
|
||||
# LLVM/JIT doesn't work in macOS M1. Skip all tests
|
||||
llvm+jit+macos+aarch64 *
|
||||
# LLVM/Universal doesn't work in macOS M1. Skip all tests
|
||||
llvm+universal+macos+aarch64 *
|
||||
|
||||
# TODO: We need to fix this. The issue happens only in Cranelift/LLVM and macOS,
|
||||
# is caused by libunwind overflowing the stack while creating the stacktrace.
|
||||
|
||||
@@ -21,7 +21,7 @@ impl Compiler {
|
||||
|
||||
#[derive(Debug, Copy, Clone)]
|
||||
pub enum Engine {
|
||||
Jit,
|
||||
Universal,
|
||||
Native,
|
||||
ObjectFile,
|
||||
}
|
||||
@@ -29,7 +29,7 @@ pub enum Engine {
|
||||
impl Engine {
|
||||
pub const fn to_flag(self) -> &'static str {
|
||||
match self {
|
||||
Engine::Jit => "--jit",
|
||||
Engine::Universal => "--universal",
|
||||
Engine::Native => "--native",
|
||||
Engine::ObjectFile => "--object-file",
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ impl Ignores {
|
||||
arch = Some(alias.to_string());
|
||||
}
|
||||
// Engines
|
||||
"jit" | "native" => {
|
||||
"universal" | "native" => {
|
||||
engine = Some(alias.to_string());
|
||||
}
|
||||
// Compilers
|
||||
@@ -212,7 +212,7 @@ mod tests {
|
||||
os: Some("macos".to_string()),
|
||||
arch: None,
|
||||
target_env: None,
|
||||
engine: Some("jit".to_string()),
|
||||
engine: Some("universal".to_string()),
|
||||
compiler: None,
|
||||
pattern_to_ignore: "other".to_string()
|
||||
}
|
||||
@@ -220,7 +220,7 @@ mod tests {
|
||||
"macos",
|
||||
"unknown",
|
||||
"",
|
||||
"jit",
|
||||
"universal",
|
||||
"compiler",
|
||||
"some::random::text"
|
||||
));
|
||||
|
||||
@@ -110,7 +110,7 @@ pub fn compiler_test(attrs: TokenStream, input: TokenStream) -> TokenStream {
|
||||
let construct_compiler_test =
|
||||
|func: &::syn::ItemFn, compiler_name: &str| -> ::proc_macro2::TokenStream {
|
||||
let mod_name = ::quote::format_ident!("{}", compiler_name.to_lowercase());
|
||||
let jit_engine_test = construct_engine_test(func, compiler_name, "JIT");
|
||||
let universal_engine_test = construct_engine_test(func, compiler_name, "Universal");
|
||||
let native_engine_test = construct_engine_test(func, compiler_name, "Native");
|
||||
let compiler_name_lowercase = compiler_name.to_lowercase();
|
||||
|
||||
@@ -119,7 +119,7 @@ pub fn compiler_test(attrs: TokenStream, input: TokenStream) -> TokenStream {
|
||||
mod #mod_name {
|
||||
use super::*;
|
||||
|
||||
#jit_engine_test
|
||||
#universal_engine_test
|
||||
#native_engine_test
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,10 +62,10 @@ gen_tests! {
|
||||
use super::*;
|
||||
#[test]
|
||||
#[cold]
|
||||
#[cfg(feature = "jit")]
|
||||
fn jit() {
|
||||
#[cfg(feature = "universal")]
|
||||
fn universal() {
|
||||
add(crate::Config::new(
|
||||
crate::Engine::JIT,
|
||||
crate::Engine::Universal,
|
||||
crate::Compiler::Singlepass
|
||||
))
|
||||
}
|
||||
@@ -85,10 +85,10 @@ gen_tests! {
|
||||
use super::*;
|
||||
#[test]
|
||||
#[cold]
|
||||
#[cfg(feature = "jit")]
|
||||
fn jit() {
|
||||
#[cfg(feature = "universal")]
|
||||
fn universal() {
|
||||
add(crate::Config::new(
|
||||
crate::Engine::JIT,
|
||||
crate::Engine::Universal,
|
||||
crate::Compiler::Cranelift
|
||||
))
|
||||
}
|
||||
@@ -108,10 +108,10 @@ gen_tests! {
|
||||
use super::*;
|
||||
#[test]
|
||||
#[cold]
|
||||
#[cfg(feature = "jit")]
|
||||
fn jit() {
|
||||
#[cfg(feature = "universal")]
|
||||
fn universal() {
|
||||
add(crate::Config::new(
|
||||
crate::Engine::JIT,
|
||||
crate::Engine::Universal,
|
||||
crate::Compiler::LLVM
|
||||
))
|
||||
}
|
||||
@@ -127,10 +127,4 @@ gen_tests! {
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// basic_expansion:
|
||||
// stringify! {
|
||||
// ...
|
||||
// };
|
||||
|
||||
}
|
||||
|
||||
@@ -11,4 +11,4 @@ target-lexicon = "0.12"
|
||||
|
||||
[features]
|
||||
test-native = []
|
||||
test-jit = []
|
||||
test-universal = []
|
||||
|
||||
Reference in New Issue
Block a user