Merge branch 'master' into run-without-run

This commit is contained in:
Mark McCaskey 2019-11-20 15:47:40 -08:00
commit b2d19e1f51
38 changed files with 799 additions and 403 deletions

View File

@ -2,7 +2,13 @@
## **[Unreleased]**
- [#987](https://github.com/wasmerio/wasmer/pull/987) Fix `runtime-c-api` header files when compiled by gnuc.
## 0.10.2 - 2019-11-18
- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command
- [#964](https://github.com/wasmerio/wasmer/pull/964) Enable cross-compilation for specific target
- [#971](https://github.com/wasmerio/wasmer/pull/971) In LLVM backend, use unaligned loads and stores for non-atomic accesses to wasmer memory.
- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang.
- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment.
- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional.

146
Cargo.lock generated
View File

@ -720,8 +720,8 @@ version = "0.1.0"
dependencies = [
"rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-runtime 0.10.2",
"wasmer-runtime-core 0.10.2",
]
[[package]]
@ -1333,7 +1333,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "wasmer"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1343,24 +1343,24 @@ dependencies = [
"structopt 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"typetag 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.10.1",
"wasmer-dev-utils 0.10.1",
"wasmer-emscripten 0.10.1",
"wasmer-emscripten-tests 0.10.1",
"wasmer-clif-backend 0.10.2",
"wasmer-dev-utils 0.10.2",
"wasmer-emscripten 0.10.2",
"wasmer-emscripten-tests 0.10.2",
"wasmer-kernel-loader 0.1.0",
"wasmer-llvm-backend 0.10.1",
"wasmer-middleware-common 0.10.1",
"wasmer-middleware-common-tests 0.10.1",
"wasmer-runtime 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-singlepass-backend 0.10.1",
"wasmer-wasi 0.10.1",
"wasmer-wasi-tests 0.10.1",
"wasmer-llvm-backend 0.10.2",
"wasmer-middleware-common 0.10.2",
"wasmer-middleware-common-tests 0.10.2",
"wasmer-runtime 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-singlepass-backend 0.10.2",
"wasmer-wasi 0.10.2",
"wasmer-wasi-tests 0.10.2",
]
[[package]]
name = "wasmer-clif-backend"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cranelift-codegen 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1376,8 +1376,8 @@ dependencies = [
"target-lexicon 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-fork-frontend 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-fork-wasm 0.44.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.10.1",
"wasmer-win-exception-handler 0.10.1",
"wasmer-runtime-core 0.10.2",
"wasmer-win-exception-handler 0.10.2",
"wasmparser 0.39.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1409,35 +1409,35 @@ dependencies = [
[[package]]
name = "wasmer-dev-utils"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasmer-emscripten"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"getrandom 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.10.1",
"wasmer-runtime-core 0.10.2",
]
[[package]]
name = "wasmer-emscripten-tests"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.10.1",
"wasmer-dev-utils 0.10.1",
"wasmer-emscripten 0.10.1",
"wasmer-llvm-backend 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-singlepass-backend 0.10.1",
"wasmer-clif-backend 0.10.2",
"wasmer-dev-utils 0.10.2",
"wasmer-emscripten 0.10.2",
"wasmer-llvm-backend 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-singlepass-backend 0.10.2",
]
[[package]]
@ -1445,12 +1445,12 @@ name = "wasmer-kernel-loader"
version = "0.1.0"
dependencies = [
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.10.1",
"wasmer-runtime-core 0.10.2",
]
[[package]]
name = "wasmer-llvm-backend"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"cc 1.0.46 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1464,60 +1464,60 @@ dependencies = [
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.10.1",
"wasmer-runtime-core 0.10.2",
"wasmparser 0.39.2 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasmer-middleware-common"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"wasmer-runtime-core 0.10.1",
"wasmer-runtime-core 0.10.2",
]
[[package]]
name = "wasmer-middleware-common-tests"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.10.1",
"wasmer-llvm-backend 0.10.1",
"wasmer-middleware-common 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-singlepass-backend 0.10.1",
"wasmer-clif-backend 0.10.2",
"wasmer-llvm-backend 0.10.2",
"wasmer-middleware-common 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-singlepass-backend 0.10.2",
]
[[package]]
name = "wasmer-runtime"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.10.1",
"wasmer-llvm-backend 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-singlepass-backend 0.10.1",
"wasmer-clif-backend 0.10.2",
"wasmer-llvm-backend 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-singlepass-backend 0.10.2",
]
[[package]]
name = "wasmer-runtime-c-api"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"cbindgen 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-wasi 0.10.1",
"wasmer-runtime 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-wasi 0.10.2",
]
[[package]]
name = "wasmer-runtime-core"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"blake2b_simd 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1543,18 +1543,18 @@ dependencies = [
[[package]]
name = "wasmer-runtime-core-tests"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.10.1",
"wasmer-llvm-backend 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-singlepass-backend 0.10.1",
"wasmer-clif-backend 0.10.2",
"wasmer-llvm-backend 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-singlepass-backend 0.10.2",
]
[[package]]
name = "wasmer-singlepass-backend"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"dynasm 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1563,24 +1563,24 @@ dependencies = [
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)",
"smallvec 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.10.1",
"wasmer-runtime-core 0.10.2",
]
[[package]]
name = "wasmer-spectests"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wabt 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.10.1",
"wasmer-llvm-backend 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-singlepass-backend 0.10.1",
"wasmer-clif-backend 0.10.2",
"wasmer-llvm-backend 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-singlepass-backend 0.10.2",
]
[[package]]
name = "wasmer-wasi"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"bincode 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1591,31 +1591,31 @@ dependencies = [
"serde 1.0.102 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"typetag 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.10.1",
"wasmer-runtime-core 0.10.2",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "wasmer-wasi-tests"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-clif-backend 0.10.1",
"wasmer-dev-utils 0.10.1",
"wasmer-llvm-backend 0.10.1",
"wasmer-runtime 0.10.1",
"wasmer-runtime-core 0.10.1",
"wasmer-singlepass-backend 0.10.1",
"wasmer-wasi 0.10.1",
"wasmer-clif-backend 0.10.2",
"wasmer-dev-utils 0.10.2",
"wasmer-llvm-backend 0.10.2",
"wasmer-runtime 0.10.2",
"wasmer-runtime-core 0.10.2",
"wasmer-singlepass-backend 0.10.2",
"wasmer-wasi 0.10.2",
]
[[package]]
name = "wasmer-win-exception-handler"
version = "0.10.1"
version = "0.10.2"
dependencies = [
"cmake 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.65 (registry+https://github.com/rust-lang/crates.io-index)",
"wasmer-runtime-core 0.10.1",
"wasmer-runtime-core 0.10.2",
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
]

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer"
version = "0.10.1"
version = "0.10.2"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
repository = "https://github.com/wasmerio/wasmer"

View File

@ -167,15 +167,12 @@ nginx and Lua do not work on Windows - you can track the progress on [this issue
2. Install [Rust for Windows](https://win.rustup.rs)
3. Install [Python for Windows](https://www.python.org/downloads/release/python-2714/). The Windows x86-64 MSI installer is fine.
Make sure to enable "Add python.exe to Path" during installation.
4. Install [Git for Windows](https://git-scm.com/download/win). Allow it to add `git.exe` to your PATH (default
3. Install [Git for Windows](https://git-scm.com/download/win). Allow it to add `git.exe` to your PATH (default
settings for the installer are fine).
5. Install [CMake](https://cmake.org/download/). Ensure CMake is in your PATH.
4. Install [CMake](https://cmake.org/download/). Ensure CMake is in your PATH.
6. Install [LLVM 8.0](https://prereleases.llvm.org/win-snapshots/LLVM-8.0.0-r351033-win64.exe)
5. Install [LLVM 8.0](https://prereleases.llvm.org/win-snapshots/LLVM-8.0.0-r351033-win64.exe)
</p>
</details>

View File

@ -205,7 +205,7 @@ jobs:
dependsOn:
- Build_CLI
- Build_Library
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
condition: or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/tags'))
steps:
# - download: current
- task: DownloadPipelineArtifact@1
@ -259,3 +259,4 @@ trigger:
- master
- staging
- trying
- refs/tags/*

View File

@ -18,7 +18,7 @@
| - | :-: | :-: | :-: |
| Cranelift Backend | ✅ | ✅ | ✅ |
| LLVM Backend | ✅ | ✅ | ✅ |
| Singlepass Backend | [#347](https://github.com/wasmerio/wasmer/issues/347) | ✅ | ✅ |
| Singlepass Backend | ✅ | ✅ | [#347](https://github.com/wasmerio/wasmer/issues/347) |
| WASI | ✅ | ✅ | ✅* |
* `poll_fd` is not fully implemented for Windows yet

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-clif-backend"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer runtime Cranelift compiler backend"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -11,7 +11,7 @@ edition = "2018"
readme = "README.md"
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
cranelift-native = "0.44.0"
cranelift-codegen = "0.44.0"
cranelift-entity = "0.44.0"
@ -37,7 +37,7 @@ version = "0.0.7"
[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3", features = ["errhandlingapi", "minwindef", "minwinbase", "winnt"] }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.10.1" }
wasmer-win-exception-handler = { path = "../win-exception-handler", version = "0.10.2" }
[features]
debug = ["wasmer-runtime-core/debug"]

View File

@ -54,6 +54,10 @@ impl ModuleCodeGenerator<CraneliftFunctionCodeGenerator, Caller, CodegenError>
}
}
fn new_with_target(_: Option<String>, _: Option<String>, _: Option<String>) -> Self {
unimplemented!("cross compilation is not available for clif backend")
}
fn backend_id() -> Backend {
Backend::Cranelift
}

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-dev-utils"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer runtime core library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-emscripten-tests"
version = "0.10.1"
version = "0.10.2"
description = "Tests for our Emscripten implementation"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -9,15 +9,15 @@ publish = false
build = "build/mod.rs"
[dependencies]
wasmer-emscripten = { path = "../emscripten", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.1" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.1", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.1", optional = true }
wasmer-emscripten = { path = "../emscripten", version = "0.10.2" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.2" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.2", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.2", optional = true }
[dev-dependencies]
wabt = "0.9.1"
wasmer-dev-utils = { path = "../dev-utils", version = "0.10.1"}
wasmer-dev-utils = { path = "../dev-utils", version = "0.10.2"}
[build-dependencies]
glob = "0.3"

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-emscripten"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer runtime emscripten implementation library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -14,7 +14,7 @@ byteorder = "1.3"
lazy_static = "1.4"
libc = "0.2.60"
time = "0.1"
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
[target.'cfg(windows)'.dependencies]
getrandom = "0.1"

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-llvm-backend"
version = "0.10.1"
version = "0.10.2"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
repository = "https://github.com/wasmerio/wasmer"
@ -10,7 +10,7 @@ edition = "2018"
readme = "README.md"
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
wasmparser = "0.39.1"
smallvec = "0.6"
goblin = "0.0.24"

View File

@ -4469,6 +4469,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
4,
)?;
let result = builder.build_load(effective_address, &state.var_name());
result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4492,6 +4497,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
8,
)?;
let result = builder.build_load(effective_address, &state.var_name());
result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4515,6 +4525,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
4,
)?;
let result = builder.build_load(effective_address, &state.var_name());
result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4538,6 +4553,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
8,
)?;
let result = builder.build_load(effective_address, &state.var_name());
result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4561,6 +4581,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
16,
)?;
let result = builder.build_load(effective_address, &state.var_name());
result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4586,6 +4611,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
4,
)?;
let store = builder.build_store(effective_address, value);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::I64Store { ref memarg } => {
@ -4603,6 +4629,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
8,
)?;
let store = builder.build_store(effective_address, value);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::F32Store { ref memarg } => {
@ -4621,6 +4648,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
4,
)?;
let store = builder.build_store(effective_address, v);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::F64Store { ref memarg } => {
@ -4639,6 +4667,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
8,
)?;
let store = builder.build_store(effective_address, v);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::V128Store { ref memarg } => {
@ -4657,6 +4686,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
16,
)?;
let store = builder.build_store(effective_address, v);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::I32Load8S { ref memarg } => {
@ -4672,9 +4702,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
intrinsics.i8_ptr_ty,
1,
)?;
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4682,8 +4715,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
narrow_result.as_instruction_value().unwrap(),
Some(0),
);
let result =
builder.build_int_s_extend(narrow_result, intrinsics.i32_ty, &state.var_name());
let result = builder.build_int_s_extend(
narrow_result.into_int_value(),
intrinsics.i32_ty,
&state.var_name(),
);
state.push1(result);
}
Operator::I32Load16S { ref memarg } => {
@ -4700,6 +4736,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
2,
)?;
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4730,6 +4771,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4757,6 +4803,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4781,9 +4832,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
intrinsics.i32_ptr_ty,
4,
)?;
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4791,8 +4845,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
narrow_result.as_instruction_value().unwrap(),
Some(0),
);
let result =
builder.build_int_s_extend(narrow_result, intrinsics.i64_ty, &state.var_name());
let result = builder.build_int_s_extend(
narrow_result.into_int_value(),
intrinsics.i64_ty,
&state.var_name(),
);
state.push1(result);
}
@ -4809,9 +4866,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
intrinsics.i8_ptr_ty,
1,
)?;
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4819,8 +4879,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
narrow_result.as_instruction_value().unwrap(),
Some(0),
);
let result =
builder.build_int_z_extend(narrow_result, intrinsics.i32_ty, &state.var_name());
let result = builder.build_int_z_extend(
narrow_result.into_int_value(),
intrinsics.i32_ty,
&state.var_name(),
);
state.push1(result);
}
Operator::I32Load16U { ref memarg } => {
@ -4836,9 +4899,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
intrinsics.i16_ptr_ty,
2,
)?;
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4846,8 +4912,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
narrow_result.as_instruction_value().unwrap(),
Some(0),
);
let result =
builder.build_int_z_extend(narrow_result, intrinsics.i32_ty, &state.var_name());
let result = builder.build_int_z_extend(
narrow_result.into_int_value(),
intrinsics.i32_ty,
&state.var_name(),
);
state.push1(result);
}
Operator::I64Load8U { ref memarg } => {
@ -4863,9 +4932,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
intrinsics.i8_ptr_ty,
1,
)?;
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4873,8 +4945,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
narrow_result.as_instruction_value().unwrap(),
Some(0),
);
let result =
builder.build_int_z_extend(narrow_result, intrinsics.i64_ty, &state.var_name());
let result = builder.build_int_z_extend(
narrow_result.into_int_value(),
intrinsics.i64_ty,
&state.var_name(),
);
state.push1(result);
}
Operator::I64Load16U { ref memarg } => {
@ -4890,9 +4965,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
intrinsics.i16_ptr_ty,
2,
)?;
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4900,8 +4978,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
narrow_result.as_instruction_value().unwrap(),
Some(0),
);
let result =
builder.build_int_z_extend(narrow_result, intrinsics.i64_ty, &state.var_name());
let result = builder.build_int_z_extend(
narrow_result.into_int_value(),
intrinsics.i64_ty,
&state.var_name(),
);
state.push1(result);
}
Operator::I64Load32U { ref memarg } => {
@ -4917,9 +4998,12 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
intrinsics.i32_ptr_ty,
4,
)?;
let narrow_result = builder
.build_load(effective_address, &state.var_name())
.into_int_value();
let narrow_result = builder.build_load(effective_address, &state.var_name());
narrow_result
.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -4927,8 +5011,11 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
narrow_result.as_instruction_value().unwrap(),
Some(0),
);
let result =
builder.build_int_z_extend(narrow_result, intrinsics.i64_ty, &state.var_name());
let result = builder.build_int_z_extend(
narrow_result.into_int_value(),
intrinsics.i64_ty,
&state.var_name(),
);
state.push1(result);
}
@ -4949,6 +5036,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
let narrow_value =
builder.build_int_truncate(value, intrinsics.i8_ty, &state.var_name());
let store = builder.build_store(effective_address, narrow_value);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::I32Store16 { ref memarg } | Operator::I64Store16 { ref memarg } => {
@ -4968,6 +5056,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
let narrow_value =
builder.build_int_truncate(value, intrinsics.i16_ty, &state.var_name());
let store = builder.build_store(effective_address, narrow_value);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::I64Store32 { ref memarg } => {
@ -4987,6 +5076,7 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
let narrow_value =
builder.build_int_truncate(value, intrinsics.i32_ty, &state.var_name());
let store = builder.build_store(effective_address, narrow_value);
store.set_alignment(1).unwrap();
tbaa_label(self.module.clone(), intrinsics, "memory", store, Some(0));
}
Operator::I8x16Neg => {
@ -5291,6 +5381,10 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
1,
)?;
let elem = builder.build_load(effective_address, "");
elem.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -5322,6 +5416,10 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
2,
)?;
let elem = builder.build_load(effective_address, "");
elem.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -5353,6 +5451,10 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
4,
)?;
let elem = builder.build_load(effective_address, "");
elem.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -5384,6 +5486,10 @@ impl FunctionCodeGenerator<CodegenError> for LLVMFunctionCodeGenerator {
8,
)?;
let elem = builder.build_load(effective_address, "");
elem.as_instruction_value()
.unwrap()
.set_alignment(1)
.unwrap();
tbaa_label(
self.module.clone(),
intrinsics,
@ -7969,24 +8075,37 @@ impl ModuleCodeGenerator<LLVMFunctionCodeGenerator, LLVMBackend, CodegenError>
for LLVMModuleCodeGenerator
{
fn new() -> LLVMModuleCodeGenerator {
Self::new_with_target(None, None, None)
}
fn new_with_target(
triple: Option<String>,
cpu_name: Option<String>,
cpu_features: Option<String>,
) -> LLVMModuleCodeGenerator {
let context = Context::create();
let module = context.create_module("module");
Target::initialize_x86(&InitializationConfig {
asm_parser: true,
asm_printer: true,
base: true,
disassembler: true,
info: true,
machine_code: true,
});
let triple = TargetMachine::get_default_triple().to_string();
let triple = triple.unwrap_or(TargetMachine::get_default_triple().to_string());
match triple {
_ if triple.starts_with("x86") => Target::initialize_x86(&InitializationConfig {
asm_parser: true,
asm_printer: true,
base: true,
disassembler: true,
info: true,
machine_code: true,
}),
_ => unimplemented!("compile to target other than x86-64 is not supported"),
}
let target = Target::from_triple(&triple).unwrap();
let target_machine = target
.create_target_machine(
&triple,
&TargetMachine::get_host_cpu_name().to_string(),
&TargetMachine::get_host_cpu_features().to_string(),
&cpu_name.unwrap_or(TargetMachine::get_host_cpu_name().to_string()),
&cpu_features.unwrap_or(TargetMachine::get_host_cpu_features().to_string()),
OptimizationLevel::Aggressive,
RelocMode::Static,
CodeModel::Large,

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-middleware-common-tests"
version = "0.10.1"
version = "0.10.2"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
edition = "2018"
repository = "https://github.com/wasmerio/wasmer"
@ -8,11 +8,11 @@ license = "MIT"
publish = false
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-middleware-common = { path = "../middleware-common", version = "0.10.1" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.1" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.1", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.1", optional = true }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
wasmer-middleware-common = { path = "../middleware-common", version = "0.10.2" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.2" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.2", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.2", optional = true }
[features]
clif = []

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-middleware-common"
version = "0.10.1"
version = "0.10.2"
repository = "https://github.com/wasmerio/wasmer"
description = "Wasmer runtime common middlewares"
license = "MIT"
@ -10,4 +10,4 @@ categories = ["wasm"]
edition = "2018"
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-runtime-c-api"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer C API library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -19,17 +19,17 @@ libc = "0.2.60"
[dependencies.wasmer-runtime]
default-features = false
path = "../runtime"
version = "0.10.1"
version = "0.10.2"
[dependencies.wasmer-runtime-core]
default-features = false
path = "../runtime-core"
version = "0.10.1"
version = "0.10.2"
[dependencies.wasmer-wasi]
default-features = false
path = "../wasi"
version = "0.10.1"
version = "0.10.2"
optional = true
[features]

View File

@ -22,7 +22,7 @@ fn main() {
#endif
#endif
#if defined(GCC) || defined(__clang__)
#if defined(GCC) || defined(__GNUC__) || defined(__clang__)
#if defined(__x86_64__)
#define ARCH_X86_64
#endif

View File

@ -8,7 +8,7 @@
#endif
#endif
#if defined(GCC) || defined(__clang__)
#if defined(GCC) || defined(__GNUC__) || defined(__clang__)
#if defined(__x86_64__)
#define ARCH_X86_64
#endif

View File

@ -8,7 +8,7 @@
#endif
#endif
#if defined(GCC) || defined(__clang__)
#if defined(GCC) || defined(__GNUC__) || defined(__clang__)
#if defined(__x86_64__)
#define ARCH_X86_64
#endif

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-runtime-core-tests"
version = "0.10.1"
version = "0.10.2"
description = "Tests for the Wasmer runtime core crate"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -9,10 +9,10 @@ publish = false
[dependencies]
wabt = "0.9.1"
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.1", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.1", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.1", optional = true }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.2", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.2", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.2", optional = true }
[features]
default = ["backend-cranelift"]

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-runtime-core"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer runtime core library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]

View File

@ -129,6 +129,11 @@ pub struct CompilerConfig {
pub enforce_stack_check: bool,
pub track_state: bool,
pub features: Features,
// target info used by LLVM
pub triple: Option<String>,
pub cpu_name: Option<String>,
pub cpu_features: Option<String>,
}
pub trait Compiler {

View File

@ -74,6 +74,13 @@ pub trait ModuleCodeGenerator<FCG: FunctionCodeGenerator<E>, RM: RunnableModule,
/// Creates a new module code generator.
fn new() -> Self;
/// Creates a new module code generator for specified target.
fn new_with_target(
triple: Option<String>,
cpu_name: Option<String>,
cpu_features: Option<String>,
) -> Self;
/// Returns the backend id associated with this MCG.
fn backend_id() -> Backend;
@ -206,7 +213,14 @@ impl<
validate_with_features(wasm, &compiler_config.features)?;
}
let mut mcg = MCG::new();
let mut mcg = match MCG::backend_id() {
Backend::LLVM => MCG::new_with_target(
compiler_config.triple.clone(),
compiler_config.cpu_name.clone(),
compiler_config.cpu_features.clone(),
),
_ => MCG::new(),
};
let mut chain = (self.middleware_chain_generator)();
let info = crate::parse::read_module(
wasm,

View File

@ -343,87 +343,6 @@ impl WasmTypeList for Infallible {
}
}
impl<A> WasmTypeList for (A,)
where
A: WasmExternType,
{
type CStruct = S1<A>;
type RetArray = [u64; 1];
fn from_ret_array(array: Self::RetArray) -> Self {
(WasmExternType::from_native(NativeWasmType::from_binary(
array[0],
)),)
}
fn empty_ret_array() -> Self::RetArray {
[0u64]
}
fn from_c_struct(c_struct: Self::CStruct) -> Self {
let S1(a) = c_struct;
(WasmExternType::from_native(a),)
}
fn into_c_struct(self) -> Self::CStruct {
#[allow(unused_parens, non_snake_case)]
let (a,) = self;
S1(WasmExternType::to_native(a))
}
fn types() -> &'static [Type] {
&[A::Native::TYPE]
}
#[allow(non_snake_case)]
unsafe fn call<Rets>(
self,
f: NonNull<vm::Func>,
wasm: Wasm,
ctx: *mut vm::Ctx,
) -> Result<Rets, RuntimeError>
where
Rets: WasmTypeList,
{
let (a,) = self;
let args = [a.to_native().to_binary()];
let mut rets = Rets::empty_ret_array();
let mut trap = WasmTrapInfo::Unknown;
let mut user_error = None;
if (wasm.invoke)(
wasm.trampoline,
ctx,
f,
args.as_ptr(),
rets.as_mut().as_mut_ptr(),
&mut trap,
&mut user_error,
wasm.invoke_env,
) {
Ok(Rets::from_ret_array(rets))
} else {
if let Some(data) = user_error {
Err(RuntimeError::Error { data })
} else {
Err(RuntimeError::Trap {
msg: trap.to_string().into(),
})
}
}
}
}
impl<'a, A: WasmExternType, Rets> Func<'a, (A,), Rets, Wasm>
where
Rets: WasmTypeList,
{
/// Call wasm function and return results.
pub fn call(&self, a: A) -> Result<Rets, RuntimeError> {
unsafe { <A as WasmTypeList>::call(a, self.func, self.inner, self.vmctx) }
}
}
macro_rules! impl_traits {
( [$repr:ident] $struct_name:ident, $( $x:ident ),* ) => {
/// Struct for typed funcs.
@ -458,8 +377,8 @@ macro_rules! impl_traits {
( $( WasmExternType::from_native($x) ),* )
}
#[allow(unused_parens, non_snake_case)]
fn into_c_struct(self) -> Self::CStruct {
#[allow(unused_parens, non_snake_case)]
let ( $( $x ),* ) = self;
$struct_name ( $( WasmExternType::to_native($x) ),* )
@ -469,7 +388,7 @@ macro_rules! impl_traits {
&[$( $x::Native::TYPE ),*]
}
#[allow(non_snake_case)]
#[allow(unused_parens, non_snake_case)]
unsafe fn call<Rets>(
self,
f: NonNull<vm::Func>,
@ -479,7 +398,6 @@ macro_rules! impl_traits {
where
Rets: WasmTypeList
{
#[allow(unused_parens)]
let ( $( $x ),* ) = self;
let args = [ $( $x.to_native().to_binary()),* ];
let mut rets = Rets::empty_ret_array();
@ -819,8 +737,14 @@ mod tests {
vec![$($x),*].iter().sum()
}
let _func = Func::new(with_vmctx);
let _func = Func::new(without_vmctx);
let _ = Func::new(with_vmctx);
let _ = Func::new(without_vmctx);
let _ = Func::new(|_: &mut vm::Ctx, $($x: i32),*| -> i32 {
vec![$($x),*].iter().sum()
});
let _ = Func::new(|$($x: i32),*| -> i32 {
vec![$($x),*].iter().sum()
});
}
}
}
@ -837,6 +761,8 @@ mod tests {
let _ = Func::new(foo);
let _ = Func::new(bar);
let _ = Func::new(|_: &mut vm::Ctx| -> i32 { 0 });
let _ = Func::new(|| -> i32 { 0 });
}
test_func_arity_n!(test_func_arity_1, a);

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-runtime"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer runtime library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -11,17 +11,17 @@ edition = "2018"
readme = "README.md"
[dependencies]
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.1", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.2", optional = true }
lazy_static = "1.4"
memmap = "0.7"
[dependencies.wasmer-runtime-core]
path = "../runtime-core"
version = "0.10.1"
version = "0.10.2"
[dependencies.wasmer-clif-backend]
path = "../clif-backend"
version = "0.10.1"
version = "0.10.2"
optional = true
[dev-dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-singlepass-backend"
version = "0.10.1"
version = "0.10.2"
repository = "https://github.com/wasmerio/wasmer"
description = "Wasmer runtime single pass compiler backend"
license = "MIT"
@ -11,7 +11,7 @@ edition = "2018"
readme = "README.md"
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
dynasm = "0.3.2"
dynasmrt = "0.3.1"
lazy_static = "1.4"

View File

@ -370,6 +370,10 @@ impl ModuleCodeGenerator<X64FunctionCode, X64ExecutionContext, CodegenError>
}
}
fn new_with_target(_: Option<String>, _: Option<String>, _: Option<String>) -> Self {
unimplemented!("cross compilation is not available for singlepass backend")
}
fn backend_id() -> Backend {
Backend::Singlepass
}
@ -658,32 +662,34 @@ impl X64FunctionCode {
sz_dst: Size,
dst: Location,
) {
let tmp_src = m.acquire_temp_gpr().unwrap();
let tmp_dst = m.acquire_temp_gpr().unwrap();
match src {
Location::Imm32(_) | Location::Imm64(_) => {
a.emit_mov(Size::S64, src, Location::GPR(tmp_src));
src = Location::GPR(tmp_src);
}
Location::Memory(_, _) | Location::GPR(_) => {}
_ => unreachable!(),
}
match dst {
let inner = |m: &mut Machine, a: &mut Assembler, src: Location| match dst {
Location::Imm32(_) | Location::Imm64(_) => unreachable!(),
Location::Memory(_, _) => {
let tmp_dst = m.acquire_temp_gpr().unwrap();
op(a, sz_src, src, sz_dst, Location::GPR(tmp_dst));
a.emit_mov(Size::S64, Location::GPR(tmp_dst), dst);
m.release_temp_gpr(tmp_dst);
}
Location::GPR(_) => {
op(a, sz_src, src, sz_dst, dst);
}
_ => unreachable!(),
}
};
m.release_temp_gpr(tmp_dst);
m.release_temp_gpr(tmp_src);
match src {
Location::Imm32(_) | Location::Imm64(_) => {
let tmp_src = m.acquire_temp_gpr().unwrap();
a.emit_mov(Size::S64, src, Location::GPR(tmp_src));
src = Location::GPR(tmp_src);
inner(m, a, src);
m.release_temp_gpr(tmp_src);
}
Location::GPR(_) | Location::Memory(_, _) => inner(m, a, src),
_ => unreachable!(),
}
}
/// Moves `src` and `dst` to valid locations for generic instructions.
@ -2948,6 +2954,106 @@ impl FunctionCodeGenerator<CodegenError> for X64FunctionCode {
ret,
);
}
Operator::I32Extend8S => {
let loc =
get_location_released(a, &mut self.machine, self.value_stack.pop().unwrap());
let ret = self.machine.acquire_locations(
a,
&[(WpType::I32, MachineValue::WasmStack(self.value_stack.len()))],
false,
)[0];
self.value_stack.push(ret);
Self::emit_relaxed_zx_sx(
a,
&mut self.machine,
Assembler::emit_movsx,
Size::S8,
loc,
Size::S32,
ret,
);
}
Operator::I32Extend16S => {
let loc =
get_location_released(a, &mut self.machine, self.value_stack.pop().unwrap());
let ret = self.machine.acquire_locations(
a,
&[(WpType::I32, MachineValue::WasmStack(self.value_stack.len()))],
false,
)[0];
self.value_stack.push(ret);
Self::emit_relaxed_zx_sx(
a,
&mut self.machine,
Assembler::emit_movsx,
Size::S16,
loc,
Size::S32,
ret,
);
}
Operator::I64Extend8S => {
let loc =
get_location_released(a, &mut self.machine, self.value_stack.pop().unwrap());
let ret = self.machine.acquire_locations(
a,
&[(WpType::I64, MachineValue::WasmStack(self.value_stack.len()))],
false,
)[0];
self.value_stack.push(ret);
Self::emit_relaxed_zx_sx(
a,
&mut self.machine,
Assembler::emit_movsx,
Size::S8,
loc,
Size::S64,
ret,
);
}
Operator::I64Extend16S => {
let loc =
get_location_released(a, &mut self.machine, self.value_stack.pop().unwrap());
let ret = self.machine.acquire_locations(
a,
&[(WpType::I64, MachineValue::WasmStack(self.value_stack.len()))],
false,
)[0];
self.value_stack.push(ret);
Self::emit_relaxed_zx_sx(
a,
&mut self.machine,
Assembler::emit_movsx,
Size::S16,
loc,
Size::S64,
ret,
);
}
Operator::I64Extend32S => {
let loc =
get_location_released(a, &mut self.machine, self.value_stack.pop().unwrap());
let ret = self.machine.acquire_locations(
a,
&[(WpType::I64, MachineValue::WasmStack(self.value_stack.len()))],
false,
)[0];
self.value_stack.push(ret);
Self::emit_relaxed_zx_sx(
a,
&mut self.machine,
Assembler::emit_movsx,
Size::S32,
loc,
Size::S64,
ret,
);
}
Operator::I32WrapI64 => {
let loc =
get_location_released(a, &mut self.machine, self.value_stack.pop().unwrap());

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-spectests"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer spectests library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -9,10 +9,10 @@ edition = "2018"
[dependencies]
glob = "0.3"
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.1" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.1", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.1", optional = true }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.2" }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.2", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.2", optional = true }
[build-dependencies]
wabt = "0.9.1"

View File

@ -1,6 +1,11 @@
(module
(func (export "i64.extend_i32_s") (param $x i32) (result i64) (i64.extend_i32_s (local.get $x)))
(func (export "i64.extend_i32_u") (param $x i32) (result i64) (i64.extend_i32_u (local.get $x)))
(func (export "i64.extend32_s") (param $x i64) (result i64) (i64.extend32_s (local.get $x)))
(func (export "i64.extend16_s") (param $x i64) (result i64) (i64.extend16_s (local.get $x)))
(func (export "i64.extend8_s") (param $x i64) (result i64) (i64.extend8_s (local.get $x)))
(func (export "i32.extend16_s") (param $x i32) (result i32) (i32.extend16_s (local.get $x)))
(func (export "i32.extend8_s") (param $x i32) (result i32) (i32.extend8_s (local.get $x)))
(func (export "i32.wrap_i64") (param $x i64) (result i32) (i32.wrap_i64 (local.get $x)))
(func (export "i32.trunc_f32_s") (param $x f32) (result i32) (i32.trunc_f32_s (local.get $x)))
(func (export "i32.trunc_f32_u") (param $x f32) (result i32) (i32.trunc_f32_u (local.get $x)))
@ -497,3 +502,46 @@
(assert_invalid (module (func (result f64) (f64.convert_i64_u (i32.const 0)))) "type mismatch")
(assert_invalid (module (func (result f64) (f64.promote_f32 (i32.const 0)))) "type mismatch")
(assert_invalid (module (func (result f64) (f64.reinterpret_i64 (i32.const 0)))) "type mismatch")
(assert_return (invoke "i32.extend8_s" (i32.const 0)) (i32.const 0))
(assert_return (invoke "i32.extend8_s" (i32.const 0x7f)) (i32.const 127))
(assert_return (invoke "i32.extend8_s" (i32.const 0x80)) (i32.const -128))
(assert_return (invoke "i32.extend8_s" (i32.const 0xff)) (i32.const -1))
(assert_return (invoke "i32.extend8_s" (i32.const 0x012345_00)) (i32.const 0))
(assert_return (invoke "i32.extend8_s" (i32.const 0xfedcba_80)) (i32.const -0x80))
(assert_return (invoke "i32.extend8_s" (i32.const -1)) (i32.const -1))
(assert_return (invoke "i32.extend16_s" (i32.const 0)) (i32.const 0))
(assert_return (invoke "i32.extend16_s" (i32.const 0x7fff)) (i32.const 32767))
(assert_return (invoke "i32.extend16_s" (i32.const 0x8000)) (i32.const -32768))
(assert_return (invoke "i32.extend16_s" (i32.const 0xffff)) (i32.const -1))
(assert_return (invoke "i32.extend16_s" (i32.const 0x0123_0000)) (i32.const 0))
(assert_return (invoke "i32.extend16_s" (i32.const 0xfedc_8000)) (i32.const -0x8000))
(assert_return (invoke "i32.extend16_s" (i32.const -1)) (i32.const -1))
(assert_return (invoke "i64.extend8_s" (i64.const 0)) (i64.const 0))
(assert_return (invoke "i64.extend8_s" (i64.const 0x7f)) (i64.const 127))
(assert_return (invoke "i64.extend8_s" (i64.const 0x80)) (i64.const -128))
(assert_return (invoke "i64.extend8_s" (i64.const 0xff)) (i64.const -1))
(assert_return (invoke "i64.extend8_s" (i64.const 0x01234567_89abcd_00)) (i64.const 0))
(assert_return (invoke "i64.extend8_s" (i64.const 0xfedcba98_765432_80)) (i64.const -0x80))
(assert_return (invoke "i64.extend8_s" (i64.const -1)) (i64.const -1))
(assert_return (invoke "i64.extend16_s" (i64.const 0)) (i64.const 0))
(assert_return (invoke "i64.extend16_s" (i64.const 0x7fff)) (i64.const 32767))
(assert_return (invoke "i64.extend16_s" (i64.const 0x8000)) (i64.const -32768))
(assert_return (invoke "i64.extend16_s" (i64.const 0xffff)) (i64.const -1))
(assert_return (invoke "i64.extend16_s" (i64.const 0x12345678_9abc_0000)) (i64.const 0))
(assert_return (invoke "i64.extend16_s" (i64.const 0xfedcba98_7654_8000)) (i64.const -0x8000))
(assert_return (invoke "i64.extend16_s" (i64.const -1)) (i64.const -1))
(assert_return (invoke "i64.extend32_s" (i64.const 0)) (i64.const 0))
(assert_return (invoke "i64.extend32_s" (i64.const 0x7fff)) (i64.const 32767))
(assert_return (invoke "i64.extend32_s" (i64.const 0x8000)) (i64.const 32768))
(assert_return (invoke "i64.extend32_s" (i64.const 0xffff)) (i64.const 65535))
(assert_return (invoke "i64.extend32_s" (i64.const 0x7fffffff)) (i64.const 0x7fffffff))
(assert_return (invoke "i64.extend32_s" (i64.const 0x80000000)) (i64.const -0x80000000))
(assert_return (invoke "i64.extend32_s" (i64.const 0xffffffff)) (i64.const -1))
(assert_return (invoke "i64.extend32_s" (i64.const 0x01234567_00000000)) (i64.const 0))
(assert_return (invoke "i64.extend32_s" (i64.const 0xfedcba98_80000000)) (i64.const -0x80000000))
(assert_return (invoke "i64.extend32_s" (i64.const -1)) (i64.const -1))

View File

@ -12,10 +12,12 @@
# Star line allows skipping an entire wast file
# clif:skip:simd.wast:*
#
# Excludes can also contain platform
# Excludes can also contain target family
# clif:skip:data.wast:172:windows
# clif:skip:data.wast:172:unix
#
# Or target arch
# singlepass:skip:atomic.wast:*:*:aarch64
# Cranelift
clif:skip:atomic.wast:* # Threads not implemented
@ -396,73 +398,73 @@ singlepass:fail:call_indirect.wast:493 # AssertTrap - expected trap, got Runtime
singlepass:fail:call_indirect.wast:494 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:call_indirect.wast:500 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:call_indirect.wast:501 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:70 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:71 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:72 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:73 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:74 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:75 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:76 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:77 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:92 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:93 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:94 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:95 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:96 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:78 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:79 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:80 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:81 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:82 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:97 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:98 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:99 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:115 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:116 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:117 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:118 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:119 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:100 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:101 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:102 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:103 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:104 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:120 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:121 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:122 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:138 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:139 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:140 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:141 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:142 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:123 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:124 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:125 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:126 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:127 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:143 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:144 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:145 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:146 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:147 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:148 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:166 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:167 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:168 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:169 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:170 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:149 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:150 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:151 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:152 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:153 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:171 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:172 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:173 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:186 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:187 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:188 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:189 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:190 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:174 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:175 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:176 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:177 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:178 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:191 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:192 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:193 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:211 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:212 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:213 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:214 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:215 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:194 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:195 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:196 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:197 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:198 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:216 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:217 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:218 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:235 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:236 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:237 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:238 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:239 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:219 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:220 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:221 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:222 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:223 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:240 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:241 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:242 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:243 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:244 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:245 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:246 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:conversions.wast:247 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:elem.wast:353 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:func_ptrs.wast:78 # AssertTrap - expected trap, got Runtime:Error unknown error
singlepass:fail:func_ptrs.wast:79 # AssertTrap - expected trap, got Runtime:Error unknown error

View File

@ -18,6 +18,7 @@ mod tests {
// TODO Files could be run with multiple threads
// TODO Allow running WAST &str directly (E.g. for use outside of spectests)
use std::collections::HashSet;
use std::sync::{Arc, Mutex};
struct SpecFailure {
@ -46,15 +47,14 @@ mod tests {
pub fn add_failure(
&mut self,
failure: SpecFailure,
testkey: &str,
excludes: &HashMap<String, Exclude>,
_testkey: &str,
excludes: &Vec<Exclude>,
line: u64,
) {
if excludes.contains_key(testkey) {
self.allowed_failure += 1;
return;
}
let platform_key = format!("{}:{}", testkey, get_platform());
if excludes.contains_key(&platform_key) {
if excludes
.iter()
.any(|e| e.line_matches(line) && e.exclude_kind == ExcludeKind::Fail)
{
self.allowed_failure += 1;
return;
}
@ -104,15 +104,113 @@ mod tests {
}
#[cfg(unix)]
fn get_platform() -> &'static str {
fn get_target_family() -> &'static str {
"unix"
}
#[cfg(windows)]
fn get_platform() -> &'static str {
fn get_target_family() -> &'static str {
"windows"
}
fn get_target_arch() -> &'static str {
if cfg!(target_arch = "x86_64") {
"x86_64"
} else if cfg!(target_arch = "aarch64") {
"aarch64"
} else if cfg!(target_arch = "x86") {
"x86"
} else if cfg!(target_arch = "mips") {
"mips"
} else if cfg!(target_arch = "powerpc") {
"powerpc"
} else if cfg!(target_arch = "powerpc64") {
"powerpc64"
} else if cfg!(target_arch = "arm") {
"arm"
} else {
panic!("unknown target arch")
}
}
// clif:skip:data.wast:172:unix:x86
#[allow(dead_code)]
struct Exclude {
backend: Option<String>,
exclude_kind: ExcludeKind,
file: String,
line: Option<u64>,
target_family: Option<String>,
target_arch: Option<String>,
}
impl Exclude {
fn line_matches(&self, value: u64) -> bool {
self.line.is_none() || self.line.unwrap() == value
}
fn line_exact_match(&self, value: u64) -> bool {
self.line.is_some() && self.line.unwrap() == value
}
fn matches_backend(&self, value: &str) -> bool {
self.backend.is_none() || self.backend.as_ref().unwrap() == value
}
fn matches_target_family(&self, value: &str) -> bool {
self.target_family.is_none() || self.target_family.as_ref().unwrap() == value
}
fn matches_target_arch(&self, value: &str) -> bool {
self.target_arch.is_none() || self.target_arch.as_ref().unwrap() == value
}
fn from(
backend: &str,
exclude_kind: &str,
file: &str,
line: &str,
target_family: &str,
target_arch: &str,
) -> Exclude {
let backend: Option<String> = match backend {
"*" => None,
"clif" => Some("clif".to_string()),
"singlepass" => Some("singlepass".to_string()),
"llvm" => Some("llvm".to_string()),
_ => panic!("backend {:?} not recognized", backend),
};
let exclude_kind = match exclude_kind {
"skip" => ExcludeKind::Skip,
"fail" => ExcludeKind::Fail,
_ => panic!("exclude kind {:?} not recognized", exclude_kind),
};
let line = match line {
"*" => None,
_ => Some(
line.parse::<u64>()
.expect(&format!("expected * or int: {:?}", line)),
),
};
let target_family = match target_family {
"*" => None,
_ => Some(target_family.to_string()),
};
let target_arch = match target_arch {
"*" => None,
_ => Some(target_arch.to_string()),
};
Exclude {
backend,
exclude_kind,
file: file.to_string(),
line,
target_family,
target_arch,
}
}
}
#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))]
fn get_compiler_name() -> &'static str {
panic!("compiler not specified, activate a compiler via features");
@ -160,7 +258,8 @@ mod tests {
fn parse_and_run(
path: &PathBuf,
excludes: &HashMap<String, Exclude>,
file_excludes: &HashSet<String>,
excludes: &HashMap<String, Vec<Exclude>>,
) -> Result<TestReport, String> {
let mut test_report = TestReport {
failures: vec![],
@ -171,21 +270,16 @@ mod tests {
let filename = path.file_name().unwrap().to_str().unwrap();
let source = fs::read(&path).unwrap();
let backend = get_compiler_name();
let platform = get_platform();
let star_key = format!("{}:{}:*", backend, filename);
let platform_star_key = format!("{}:{}:*:{}", backend, filename, platform);
if (excludes.contains_key(&star_key) && *excludes.get(&star_key).unwrap() == Exclude::Skip)
|| (excludes.contains_key(&platform_star_key)
&& *excludes.get(&platform_star_key).unwrap() == Exclude::Skip)
{
// Entire file is excluded by line * and skip
if file_excludes.contains(filename) {
return Ok(test_report);
}
let mut features = wabt::Features::new();
features.enable_simd();
features.enable_threads();
features.enable_sign_extension();
let mut parser: ScriptParser =
ScriptParser::from_source_and_name_with_features(&source, filename, features)
.expect(&format!("Failed to parse script {}", &filename));
@ -197,21 +291,27 @@ mod tests {
let mut registered_modules: HashMap<String, Arc<Mutex<Instance>>> = HashMap::new();
//
let empty_excludes = vec![];
let excludes = if excludes.contains_key(filename) {
excludes.get(filename).unwrap()
} else {
&empty_excludes
};
let backend = get_compiler_name();
while let Some(Command { kind, line }) =
parser.next().map_err(|e| format!("Parse err: {:?}", e))?
{
let test_key = format!("{}:{}:{}", backend, filename, line);
let test_platform_key = format!("{}:{}:{}:{}", backend, filename, line, platform);
// Use this line to debug which test is running
println!("Running test: {}", test_key);
if (excludes.contains_key(&test_key)
&& *excludes.get(&test_key).unwrap() == Exclude::Skip)
|| (excludes.contains_key(&test_platform_key)
&& *excludes.get(&test_platform_key).unwrap() == Exclude::Skip)
// Skip tests that match this line
if excludes
.iter()
.any(|e| e.line_exact_match(line) && e.exclude_kind == ExcludeKind::Skip)
{
// println!("Skipping test: {}", test_key);
continue;
}
@ -250,6 +350,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
instance = None;
}
@ -289,6 +390,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
} else {
let call_result = maybe_call_result.unwrap();
@ -303,6 +405,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
Ok(values) => {
@ -319,7 +422,7 @@ mod tests {
"result {:?} ({:?}) does not match expected {:?} ({:?})",
v, to_hex(v.clone()), expected_value, to_hex(expected_value.clone())
),
}, &test_key, excludes);
}, &test_key, excludes, line);
} else {
test_report.count_passed();
}
@ -349,6 +452,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
} else {
let export: Export = maybe_call_result.unwrap();
@ -372,6 +476,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -385,6 +490,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -415,6 +521,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
} else {
let call_result = maybe_call_result.unwrap();
@ -429,6 +536,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
Ok(values) => {
@ -452,6 +560,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -483,6 +592,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
} else {
let call_result = maybe_call_result.unwrap();
@ -497,6 +607,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
Ok(values) => {
@ -520,6 +631,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -551,6 +663,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
} else {
let call_result = maybe_call_result.unwrap();
@ -568,6 +681,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
CallError::Runtime(r) => {
@ -589,6 +703,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -605,6 +720,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -648,6 +764,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -661,6 +778,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -703,6 +821,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -716,6 +835,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -754,6 +874,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
};
@ -785,6 +906,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
} else {
let call_result = maybe_call_result.unwrap();
@ -806,6 +928,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -844,6 +967,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
Ok(result) => match result {
@ -859,6 +983,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
Err(e) => match e {
@ -875,6 +1000,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
},
@ -908,6 +1034,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
}
@ -933,6 +1060,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
} else {
let call_result = maybe_call_result.unwrap();
@ -947,6 +1075,7 @@ mod tests {
},
&test_key,
excludes,
line,
);
}
Ok(_values) => {
@ -1104,7 +1233,7 @@ mod tests {
}
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
enum Exclude {
enum ExcludeKind {
Skip,
Fail,
}
@ -1114,13 +1243,18 @@ mod tests {
use std::io::{BufRead, BufReader};
/// Reads the excludes.txt file into a hash map
fn read_excludes() -> HashMap<String, Exclude> {
fn read_excludes() -> (HashMap<String, Vec<Exclude>>, HashSet<String>) {
let mut excludes_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
excludes_path.push("tests");
excludes_path.push("excludes.txt");
let input = File::open(excludes_path).unwrap();
let buffered = BufReader::new(input);
let mut result = HashMap::new();
let mut file_excludes = HashSet::new();
let current_backend = get_compiler_name();
let current_target_family = get_target_family();
let current_target_arch = get_target_arch();
for line in buffered.lines() {
let mut line = line.unwrap();
if line.trim().is_empty() || line.starts_with("#") {
@ -1135,26 +1269,53 @@ mod tests {
// <backend>:<exclude-kind>:<test-file-name>:<test-file-line>
let split: Vec<&str> = line.trim().split(':').collect();
let kind = match *split.get(1).unwrap() {
"skip" => Exclude::Skip,
"fail" => Exclude::Fail,
_ => panic!("unknown exclude kind"),
let file = *split.get(2).unwrap();
let exclude = match split.len() {
0..=3 => panic!("expected at least 4 exclude conditions"),
4 => Exclude::from(
*split.get(0).unwrap(),
*split.get(1).unwrap(),
*split.get(2).unwrap(),
*split.get(3).unwrap(),
"*",
"*",
),
5 => Exclude::from(
*split.get(0).unwrap(),
*split.get(1).unwrap(),
*split.get(2).unwrap(),
*split.get(3).unwrap(),
*split.get(4).unwrap(),
"*",
),
6 => Exclude::from(
*split.get(0).unwrap(),
*split.get(1).unwrap(),
*split.get(2).unwrap(),
*split.get(3).unwrap(),
*split.get(4).unwrap(),
*split.get(5).unwrap(),
),
_ => panic!("too many exclude conditions {}", split.len()),
};
let has_platform = split.len() > 4;
let backend = split.get(0).unwrap();
let testfile = split.get(2).unwrap();
let line = split.get(3).unwrap();
let key = if has_platform {
let platform = split.get(4).unwrap();
format!("{}:{}:{}:{}", backend, testfile, line, platform)
} else {
format!("{}:{}:{}", backend, testfile, line)
};
result.insert(key, kind);
if exclude.matches_backend(current_backend)
&& exclude.matches_target_family(current_target_family)
&& exclude.matches_target_arch(current_target_arch)
{
// Skip the whole file for line * and skip
if exclude.line.is_none() && exclude.exclude_kind == ExcludeKind::Skip {
file_excludes.insert(file.to_string());
}
if !result.contains_key(file) {
result.insert(file.to_string(), vec![]);
}
result.get_mut(file).unwrap().push(exclude);
}
}
}
result
(result, file_excludes)
}
#[test]
@ -1162,7 +1323,7 @@ mod tests {
let mut success = true;
let mut test_reports = vec![];
let excludes = read_excludes();
let (excludes, file_excludes) = read_excludes();
let mut glob_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
glob_path.push("spectests");
@ -1172,7 +1333,7 @@ mod tests {
for entry in glob(glob_str).expect("Failed to read glob pattern") {
match entry {
Ok(wast_path) => {
let result = parse_and_run(&wast_path, &excludes);
let result = parse_and_run(&wast_path, &file_excludes, &excludes);
match result {
Ok(test_report) => {
if test_report.has_failures() {

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-wasi-tests"
version = "0.10.1"
version = "0.10.2"
description = "Tests for our WASI implementation"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -9,20 +9,20 @@ publish = false
build = "build/mod.rs"
[dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime = { path = "../runtime", version = "0.10.1" }
wasmer-wasi = { path = "../wasi", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
wasmer-runtime = { path = "../runtime", version = "0.10.2" }
wasmer-wasi = { path = "../wasi", version = "0.10.2" }
# hack to get tests to work
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.1", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.1", optional = true }
wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.10.2", optional = true }
wasmer-llvm-backend = { path = "../llvm-backend", version = "0.10.2", optional = true }
[build-dependencies]
glob = "0.3"
[dev-dependencies]
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.1" }
wasmer-dev-utils = { path = "../dev-utils", version = "0.10.1"}
wasmer-clif-backend = { path = "../clif-backend", version = "0.10.2" }
wasmer-dev-utils = { path = "../dev-utils", version = "0.10.2"}
[features]
clif = []

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-wasi"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer runtime WASI implementation library"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -19,7 +19,7 @@ getrandom = "0.1"
time = "0.1"
typetag = "0.1"
serde = { version = "1", features = ["derive"] }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
[target.'cfg(windows)'.dependencies]
winapi = "0.3"

View File

@ -1,6 +1,6 @@
[package]
name = "wasmer-win-exception-handler"
version = "0.10.1"
version = "0.10.2"
description = "Wasmer runtime exception handling for Windows"
license = "MIT"
authors = ["The Wasmer Engineering Team <engineering@wasmer.io>"]
@ -8,7 +8,7 @@ repository = "https://github.com/wasmerio/wasmer"
edition = "2018"
[target.'cfg(windows)'.dependencies]
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.1" }
wasmer-runtime-core = { path = "../runtime-core", version = "0.10.2" }
winapi = { version = "0.3.8", features = ["winbase", "errhandlingapi", "minwindef", "minwinbase", "winnt"] }
libc = "0.2.60"

View File

@ -1,5 +1,5 @@
PREVIOUS_VERSION='0.10.0'
NEXT_VERSION='0.10.1'
PREVIOUS_VERSION='0.10.1'
NEXT_VERSION='0.10.2'
# quick hack
fd Cargo.toml --exec sed -i '' "s/version = \"$PREVIOUS_VERSION\"/version = \"$NEXT_VERSION\"/"

View File

@ -63,6 +63,7 @@ fn handle_client(mut stream: UnixStream) {
enforce_stack_check: true,
track_state: false,
features: Default::default(),
..Default::default()
},
&SinglePassCompiler::new(),
)

View File

@ -96,6 +96,29 @@ struct PrestandardFeatures {
all: bool,
}
impl PrestandardFeatures {
/// Generate [`wabt::Features`] struct from CLI options
pub fn into_wabt_features(&self) -> wabt::Features {
let mut features = wabt::Features::new();
if self.simd || self.all {
features.enable_simd();
}
if self.threads || self.all {
features.enable_threads();
}
features.enable_sign_extension();
features
}
/// Generate [`Features`] struct from CLI options
pub fn into_backend_features(&self) -> Features {
Features {
simd: self.simd || self.all,
threads: self.threads || self.all,
}
}
}
#[cfg(feature = "backend-llvm")]
#[derive(Debug, StructOpt, Clone)]
/// LLVM backend flags.
@ -393,13 +416,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
}
if !utils::is_wasm_binary(&wasm_binary) {
let mut features = wabt::Features::new();
if options.features.simd || options.features.all {
features.enable_simd();
}
if options.features.threads || options.features.all {
features.enable_threads();
}
let features = options.features.into_wabt_features();
wasm_binary = wabt::wat2wasm_with_features(wasm_binary, features)
.map_err(|e| format!("Can't convert from wast to wasm: {:?}", e))?;
}
@ -443,10 +460,8 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
memory_bound_check_mode: MemoryBoundCheckMode::Disable,
enforce_stack_check: true,
track_state,
features: Features {
simd: options.features.simd || options.features.all,
threads: options.features.threads || options.features.all,
},
features: options.features.into_backend_features(),
..Default::default()
},
&*compiler,
)
@ -457,10 +472,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
CompilerConfig {
symbol_map: em_symbol_map.clone(),
track_state,
features: Features {
simd: options.features.simd || options.features.all,
threads: options.features.threads || options.features.all,
},
features: options.features.into_backend_features(),
..Default::default()
},
&*compiler,
@ -505,10 +517,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
CompilerConfig {
symbol_map: em_symbol_map.clone(),
track_state,
features: Features {
simd: options.features.simd || options.features.all,
threads: options.features.threads || options.features.all,
},
features: options.features.into_backend_features(),
..Default::default()
},
&*compiler,
@ -806,10 +815,7 @@ fn validate_wasm(validate: Validate) -> Result<(), String> {
wasmer_runtime_core::validate_and_report_errors_with_features(
&wasm_binary,
Features {
simd: validate.features.simd || validate.features.all,
threads: validate.features.threads || validate.features.all,
},
validate.features.into_backend_features(),
)
.map_err(|err| format!("Validation failed: {}", err))?;

View File

@ -1,6 +1,6 @@
[Setup]
AppName=Wasmer
AppVersion=0.10.1
AppVersion=0.10.2
DefaultDirName={pf}\Wasmer
DefaultGroupName=Wasmer
Compression=lzma2