Skip to content

Commit

Permalink
feat: Rename wasmer-engine-native to wasmer-engine-dylib.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hywan committed May 28, 2021
1 parent e11fc26 commit 3d66a2e
Show file tree
Hide file tree
Showing 54 changed files with 486 additions and 519 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 11 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ wasmer-compiler-llvm = { version = "1.0.2", path = "lib/compiler-llvm", optional
wasmer-emscripten = { version = "1.0.2", path = "lib/emscripten", optional = true }
wasmer-engine = { version = "1.0.2", path = "lib/engine" }
wasmer-engine-universal = { version = "1.0.2", path = "lib/engine-universal", optional = true }
wasmer-engine-shared-object = { version = "1.0.2", path = "lib/engine-shared-object", optional = true }
wasmer-engine-dylib = { version = "1.0.2", path = "lib/engine-dylib", 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 }
wasmer-wast = { version = "1.0.2", path = "tests/lib/wast", optional = true }
Expand All @@ -41,7 +41,7 @@ members = [
"lib/emscripten",
"lib/engine",
"lib/engine-universal",
"lib/engine-shared-object",
"lib/engine-dylib",
"lib/engine-object-file",
"lib/object",
"lib/vm",
Expand Down Expand Up @@ -82,7 +82,7 @@ default = [
"wat",
"wast",
"universal",
"shared-object",
"dylib",
"object-file",
"cache",
"wasi",
Expand All @@ -94,8 +94,8 @@ universal = [
"wasmer-engine-universal",
"engine",
]
shared-object = [
"wasmer-engine-shared-object",
dylib = [
"wasmer-engine-dylib",
"engine",
]
object-file = [
Expand All @@ -111,7 +111,7 @@ compiler = [
"wasmer/compiler",
"wasmer-compiler/translator",
"wasmer-engine-universal/compiler",
"wasmer-engine-shared-object/compiler",
"wasmer-engine-dylib/compiler",
"wasmer-engine-object-file/compiler",
]
singlepass = [
Expand Down Expand Up @@ -139,9 +139,9 @@ test-llvm = [
"llvm",
]

test-shared-object = [
"shared-object",
"test-generator/test-shared-object",
test-dylib = [
"dylib",
"test-generator/test-dylib",
]
test-universal = [
"universal",
Expand Down Expand Up @@ -170,8 +170,8 @@ path = "examples/engine_universal.rs"
required-features = ["cranelift"]

[[example]]
name = "engine-shared-object"
path = "examples/engine_shared_object.rs"
name = "engine-dylib"
path = "examples/engine_dylib.rs"
required-features = ["cranelift"]

[[example]]
Expand Down
81 changes: 40 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,32 @@ SHELL=/bin/bash

# The matrix is the product of the following columns:
#
# |------------|---------------|----------|--------------|-------|
# | Compiler ⨯ Engine ⨯ Platform ⨯ Architecture ⨯ libc |
# |------------|---------------|----------|--------------|-------|
# | Cranelift | Universal | Linux | amd64 | glibc |
# | LLVM | Shared Object | Darwin | aarch64 | musl |
# | Singlepass | | Windows | | |
# |------------|---------------|----------|--------------|-------|
# |------------|-----------|----------|--------------|-------|
# | Compiler ⨯ Engine ⨯ Platform ⨯ Architecture ⨯ libc |
# |------------|-----------|----------|--------------|-------|
# | Cranelift | Universal | Linux | amd64 | glibc |
# | LLVM | Dylib | Darwin | aarch64 | musl |
# | Singlepass | | Windows | | |
# |------------|-----------|----------|--------------|-------|
#
# Here is what works and what doesn't:
#
# * Cranelift with the Universal engine works everywhere,
#
# * Cranelift with the Shared Object engine works on
# Linux+Darwin/`amd64`, but it doesn't work on */`aarch64` or
# Windows/*.
# * Cranelift with the Dylib engine works on Linux+Darwin/`amd64`, but
# it doesn't work on */`aarch64` or Windows/*.
#
# * LLVM with the Universal engine works on Linux+Darwin/`amd64`,
# but it doesn't work on */`aarch64` or Windows/*.
#
# * LLVM with the Shared Object engine works on
# * LLVM with the Dylib engine works on
# Linux+Darwin/`amd64`+`aarch64`, but it doesn't work on Windows/*.
#
# * Singlepass with the Universal engine works on Linux+Darwin/`amd64`, but
# it doesn't work on */`aarch64` or Windows/*.
#
# * Singlepass with the Shared Object engine doesn't work because it
# doesn't know how to output object files for the moment.
# * Singlepass with the Dylib engine doesn't work because it doesn't
# know how to output object files for the moment.
#
# * Windows isn't tested on `aarch64`, that's why we consider it's not
# working, but it might possibly be.
Expand Down Expand Up @@ -211,12 +210,12 @@ ifeq ($(ENABLE_CRANELIFT), 1)
ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX)))
ifeq ($(IS_AMD64), 1)
ifneq ($(LIBC), musl)
compilers_engines += cranelift-shared-object
compilers_engines += cranelift-dylib
endif
else ifeq ($(IS_AARCH64), 1)
# The object crate doesn't support yet Darwin + Aarch64 relocations
ifneq ($(IS_DARWIN), 1)
compilers_engines += cranelift-shared-object
compilers_engines += cranelift-dylib
endif
endif
endif
Expand All @@ -230,9 +229,9 @@ ifeq ($(ENABLE_LLVM), 1)
ifneq (, $(filter 1, $(IS_DARWIN) $(IS_LINUX)))
ifeq ($(IS_AMD64), 1)
compilers_engines += llvm-universal
compilers_engines += llvm-shared-object
compilers_engines += llvm-dylib
else ifeq ($(IS_AARCH64), 1)
compilers_engines += llvm-shared-object
compilers_engines += llvm-dylib
endif
endif
endif
Expand Down Expand Up @@ -301,7 +300,7 @@ 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-universal llvm-shared-object
capi_compilers_engines_exclude += llvm-universal llvm-dylib

# We exclude singlepass-universal because it doesn't support multivalue (required in wasm-c-api tests)
capi_compilers_engines_exclude += singlepass-universal
Expand Down Expand Up @@ -424,59 +423,59 @@ 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,universal,object-file,shared-object,cranelift,wasi $(capi_default_features)
RUSTFLAGS="${RUSTFLAGS}" cargo doc --manifest-path lib/c-api/Cargo.toml --no-deps --features wat,universal,object-file,dylib,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,universal,shared-object,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features)
--no-default-features --features deprecated,wat,universal,dylib,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,universal,shared-object,object-file,singlepass,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,object-file,singlepass,wasi,middlewares $(capi_default_features)

build-capi-singlepass-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,singlepass,wasi,middlewares $(capi_default_features)

build-capi-singlepass-shared-object: capi-setup
build-capi-singlepass-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,shared-object,singlepass,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,dylib,singlepass,wasi,middlewares $(capi_default_features)

build-capi-singlepass-object-file: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,object-file,singlepass,wasi,middlewares $(capi_default_features)

build-capi-cranelift: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,shared-object,object-file,cranelift,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,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,universal,shared-object,object-file,cranelift,wasi,middlewares,system-libffi $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,object-file,cranelift,wasi,middlewares,system-libffi $(capi_default_features)

build-capi-cranelift-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,cranelift,wasi,middlewares $(capi_default_features)

build-capi-cranelift-shared-object: capi-setup
build-capi-cranelift-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,shared-object,cranelift,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,dylib,cranelift,wasi,middlewares $(capi_default_features)

build-capi-cranelift-object-file: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,shared-object,object-file,cranelift,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,dylib,object-file,cranelift,wasi,middlewares $(capi_default_features)

build-capi-llvm: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,shared-object,object-file,llvm,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,universal,dylib,object-file,llvm,wasi,middlewares $(capi_default_features)

build-capi-llvm-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,universal,llvm,wasi,middlewares $(capi_default_features)

build-capi-llvm-shared-object: capi-setup
build-capi-llvm-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features deprecated,wat,shared-object,llvm,wasi,middlewares $(capi_default_features)
--no-default-features --features deprecated,wat,dylib,llvm,wasi,middlewares $(capi_default_features)

build-capi-llvm-object-file: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
Expand All @@ -488,17 +487,17 @@ build-capi-headless-universal: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features universal,wasi

build-capi-headless-shared-object: capi-setup
build-capi-headless-dylib: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features shared-object,wasi
--no-default-features --features dylib,wasi

build-capi-headless-object-file: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features object-file,wasi

build-capi-headless-all: capi-setup
RUSTFLAGS="${RUSTFLAGS}" cargo build --manifest-path lib/c-api/Cargo.toml --release \
--no-default-features --features universal,shared-object,object-file,wasi
--no-default-features --features universal,dylib,object-file,wasi

###########
# Testing #
Expand All @@ -521,20 +520,20 @@ test-packages:

test-compilers-compat: $(foreach compiler,$(compilers),test-$(compiler))

test-singlepass-shared-object:
cargo test --release --tests $(compiler_features) -- singlepass::shared-object
test-singlepass-dylib:
cargo test --release --tests $(compiler_features) -- singlepass::dylib

test-singlepass-universal:
cargo test --release --tests $(compiler_features) -- singlepass::universal

test-cranelift-shared-object:
cargo test --release --tests $(compiler_features) -- cranelift::shared-object
test-cranelift-dylib:
cargo test --release --tests $(compiler_features) -- cranelift::dylib

test-cranelift-universal:
cargo test --release --tests $(compiler_features) -- cranelift::universal

test-llvm-shared-object:
cargo test --release --tests $(compiler_features) -- llvm::shared-object
test-llvm-dylib:
cargo test --release --tests $(compiler_features) -- llvm::dylib

test-llvm-universal:
cargo test --release --tests $(compiler_features) -- llvm::universal
Expand All @@ -551,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,universal,shared-object,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features) -- --nocapture
--no-default-features --features deprecated,wat,universal,dylib,object-file,wasi,middlewares $(capi_default_features) $(capi_compiler_features) -- --nocapture

test-capi-integration-%:
# Test the Wasmer C API tests for C
Expand Down
Loading

1 comment on commit 3d66a2e

@audioXD
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing change lib/api/src/store.rs:132

#[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-universal")] {
            wasmer_engine_universal::Universal::new(config)
                .engine()
        } else if #[cfg(feature = "default-native")] {
            wasmer_engine_dylib::Dylib::new(config)
                .engine()
        } else {
            compile_error!("No default engine chosen")
        }
    }
}

Please sign in to comment.