Update to the latest spec_testsuite and dependencies. (#803)

* Update to the latest spec_testsuite and dependencies.

Update to target-lexicon 0.10, cranelift 0.54, wast 0.6, faerie 0.14,
and the latest spec_testsuite.

For wast and cranelift-wasm, update the code for API changes.

* Factor out the code for matching f32, f64, and v128.

This takes the idea from #802 to split out `f32_matches`, `f64_matches`,
and `v128_matches` functions, which better factor out the matching
functionality between scalar and vector.
This commit is contained in:
Dan Gohman
2020-01-10 13:57:38 -08:00
committed by GitHub
parent 28a938a62f
commit ef2177ed3a
22 changed files with 167 additions and 220 deletions

116
Cargo.lock generated
View File

@@ -126,7 +126,7 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "440d600bca1c3b3982dd2533518e15ba73d051b532768804aa3c06ae52f4ce44" checksum = "440d600bca1c3b3982dd2533518e15ba73d051b532768804aa3c06ae52f4ce44"
dependencies = [ dependencies = [
"bindgen 0.52.0", "bindgen",
"cc", "cc",
"cmake", "cmake",
"heck", "heck",
@@ -143,29 +143,6 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "bindgen"
version = "0.51.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ebd71393f1ec0509b553aa012b9b58e81dadbdff7130bd3b8cba576e69b32f75"
dependencies = [
"bitflags",
"cexpr",
"cfg-if",
"clang-sys",
"clap",
"env_logger 0.6.2",
"lazy_static",
"log",
"peeking_take_while",
"proc-macro2",
"quote",
"regex",
"rustc-hash",
"shlex",
"which",
]
[[package]] [[package]]
name = "bindgen" name = "bindgen"
version = "0.52.0" version = "0.52.0"
@@ -364,18 +341,18 @@ dependencies = [
[[package]] [[package]]
name = "cranelift-bforest" name = "cranelift-bforest"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56aa72ef104c5d634f2f9e84ef2c47e116c1d185fae13f196b97ca84b0a514f1" checksum = "3b065d5992ea22903200c56dd2b3a7062a1311b49739ffd2be9215f882204f73"
dependencies = [ dependencies = [
"cranelift-entity", "cranelift-entity",
] ]
[[package]] [[package]]
name = "cranelift-codegen" name = "cranelift-codegen"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "460b9d20793543599308d22f5a1172c196e63a780c4e9aacb0b3f4f63d63ffe1" checksum = "6ae646133a3dda0af636eb4e2928d282a976c836392e0de57a5750ca9eb132e1"
dependencies = [ dependencies = [
"byteorder", "byteorder",
"cranelift-bforest", "cranelift-bforest",
@@ -391,9 +368,9 @@ dependencies = [
[[package]] [[package]]
name = "cranelift-codegen-meta" name = "cranelift-codegen-meta"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cc70e4e8ccebd53a4f925147def857c9e9f7fe0fdbef4bb645a420473e012f50" checksum = "883a636641a34034d16d1986557fdf815245140c4bb9e6561a6cb8ebacd7b9d4"
dependencies = [ dependencies = [
"cranelift-codegen-shared", "cranelift-codegen-shared",
"cranelift-entity", "cranelift-entity",
@@ -401,24 +378,24 @@ dependencies = [
[[package]] [[package]]
name = "cranelift-codegen-shared" name = "cranelift-codegen-shared"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3992000be4d18df0fe332b7c42c120de896e8ec54cd7b6cfa050910a8c9f6e2f" checksum = "a3467bb48aa1b6a4c0da0fa0b5fea7f78f96bbf4bbf054eeb053b5e2e8794387"
[[package]] [[package]]
name = "cranelift-entity" name = "cranelift-entity"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "722957e05064d97a3157bf0976deed0f3e8ee4f8a4ce167a7c724ca63a4e8bd9" checksum = "03578fa46b2009c4575494b0ecf8319a79bc913a6c1be3a2cb55ee7089c59989"
dependencies = [ dependencies = [
"serde", "serde",
] ]
[[package]] [[package]]
name = "cranelift-frontend" name = "cranelift-frontend"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13051964302dc7948e8869735de42591559ea55e319b9b92da5b38f8e6a75cb7" checksum = "54859b486e505c03d5d8982216509eb99782ef5a3f7f8cbe86cd73967975c49b"
dependencies = [ dependencies = [
"cranelift-codegen", "cranelift-codegen",
"log", "log",
@@ -428,9 +405,9 @@ dependencies = [
[[package]] [[package]]
name = "cranelift-native" name = "cranelift-native"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "21398a0bc6ba389ea86964ac4a495426dd61080f2ddd306184777a8560fe9976" checksum = "b245d7376b7200a5dcce955761f4f7396019beda4a788d9cbe555308f1869cd2"
dependencies = [ dependencies = [
"cranelift-codegen", "cranelift-codegen",
"raw-cpuid", "raw-cpuid",
@@ -439,9 +416,9 @@ dependencies = [
[[package]] [[package]]
name = "cranelift-wasm" name = "cranelift-wasm"
version = "0.52.0" version = "0.53.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b72b7b10c09f70a604122fab76e6c4411255cf35403b68c3285566cc9d21c486" checksum = "115e207912c5841c3932b366be979b34a62ee32c839c2ddbc1c81877cd8ec03c"
dependencies = [ dependencies = [
"cranelift-codegen", "cranelift-codegen",
"cranelift-entity", "cranelift-entity",
@@ -637,9 +614,9 @@ dependencies = [
[[package]] [[package]]
name = "faerie" name = "faerie"
version = "0.13.0" version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f902f2af041f6c7177a2a04f805687cdc71e69c7cbef059a2755d8923f4cd7a8" checksum = "74b9ed6159e4a6212c61d9c6a86bee01876b192a64accecf58d5b5ae3b667b52"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"goblin", "goblin",
@@ -953,7 +930,7 @@ dependencies = [
"smallvec", "smallvec",
"thiserror", "thiserror",
"typemap", "typemap",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"wat", "wat",
] ]
@@ -1030,9 +1007,9 @@ dependencies = [
[[package]] [[package]]
name = "num" name = "num"
version = "0.2.0" version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36"
dependencies = [ dependencies = [
"num-complex", "num-complex",
"num-integer", "num-integer",
@@ -1043,11 +1020,11 @@ dependencies = [
[[package]] [[package]]
name = "num-complex" name = "num-complex"
version = "0.2.3" version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc" checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95"
dependencies = [ dependencies = [
"autocfg 0.1.7", "autocfg 1.0.0",
"num-traits", "num-traits",
] ]
@@ -1074,11 +1051,11 @@ dependencies = [
[[package]] [[package]]
name = "num-rational" name = "num-rational"
version = "0.2.2" version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2885278d5fe2adc2f75ced642d52d879bffaceb5a2e0b1d4309ffdfb239b454" checksum = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3"
dependencies = [ dependencies = [
"autocfg 0.1.7", "autocfg 1.0.0",
"num-integer", "num-integer",
"num-traits", "num-traits",
] ]
@@ -1710,9 +1687,9 @@ dependencies = [
[[package]] [[package]]
name = "target-lexicon" name = "target-lexicon"
version = "0.9.0" version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6f4c118a7a38378f305a9e111fcb2f7f838c0be324bfb31a77ea04f7f6e684b4" checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d"
[[package]] [[package]]
name = "tempfile" name = "tempfile"
@@ -1993,6 +1970,12 @@ version = "0.45.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8b4eab1d9971d0803729cba3617b56eb04fcb4bd25361cb63880ed41a42f20d5" checksum = "8b4eab1d9971d0803729cba3617b56eb04fcb4bd25361cb63880ed41a42f20d5"
[[package]]
name = "wasmparser"
version = "0.47.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1add8db5a53a2f64f13418b241982c4ab533d7a9e1e8a5dcadccce633d8d393b"
[[package]] [[package]]
name = "wasmprinter" name = "wasmprinter"
version = "0.2.0" version = "0.2.0"
@@ -2016,7 +1999,7 @@ dependencies = [
"region", "region",
"target-lexicon", "target-lexicon",
"wasi-common", "wasi-common",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"wasmtime-environ", "wasmtime-environ",
"wasmtime-jit", "wasmtime-jit",
"wasmtime-runtime", "wasmtime-runtime",
@@ -2063,7 +2046,7 @@ dependencies = [
"more-asserts", "more-asserts",
"target-lexicon", "target-lexicon",
"thiserror", "thiserror",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"wasmtime-environ", "wasmtime-environ",
] ]
@@ -2097,7 +2080,7 @@ dependencies = [
"tempfile", "tempfile",
"thiserror", "thiserror",
"toml", "toml",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"winapi", "winapi",
"zstd", "zstd",
] ]
@@ -2124,7 +2107,7 @@ dependencies = [
"binaryen", "binaryen",
"env_logger 0.7.1", "env_logger 0.7.1",
"log", "log",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"wasmprinter", "wasmprinter",
"wasmtime", "wasmtime",
"wasmtime-environ", "wasmtime-environ",
@@ -2139,7 +2122,7 @@ dependencies = [
"anyhow", "anyhow",
"walrus", "walrus",
"wasm-webidl-bindings", "wasm-webidl-bindings",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"wasmtime", "wasmtime",
"wasmtime-environ", "wasmtime-environ",
"wasmtime-jit", "wasmtime-jit",
@@ -2161,7 +2144,7 @@ dependencies = [
"region", "region",
"target-lexicon", "target-lexicon",
"thiserror", "thiserror",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"wasmtime-debug", "wasmtime-debug",
"wasmtime-environ", "wasmtime-environ",
"wasmtime-runtime", "wasmtime-runtime",
@@ -2186,7 +2169,7 @@ dependencies = [
"pyo3", "pyo3",
"region", "region",
"target-lexicon", "target-lexicon",
"wasmparser 0.45.2", "wasmparser 0.47.0",
"wasmtime", "wasmtime",
"wasmtime-environ", "wasmtime-environ",
"wasmtime-interface-types", "wasmtime-interface-types",
@@ -2252,7 +2235,7 @@ dependencies = [
name = "wasmtime-wasi-c" name = "wasmtime-wasi-c"
version = "0.9.0" version = "0.9.0"
dependencies = [ dependencies = [
"bindgen 0.51.1", "bindgen",
"cmake", "cmake",
"cranelift-codegen", "cranelift-codegen",
"cranelift-entity", "cranelift-entity",
@@ -2272,7 +2255,7 @@ version = "0.9.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"wasmtime", "wasmtime",
"wast 5.0.1", "wast 6.0.0",
] ]
[[package]] [[package]]
@@ -2284,15 +2267,6 @@ dependencies = [
"leb128", "leb128",
] ]
[[package]]
name = "wast"
version = "5.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8d1de68310854a9840d39487701a8c1acccb5c9f9f2650d5fce3cdfe6650c372"
dependencies = [
"leb128",
]
[[package]] [[package]]
name = "wast" name = "wast"
version = "6.0.0" version = "6.0.0"

View File

@@ -29,9 +29,9 @@ wasmtime-wasi = { path = "crates/wasi" }
wasmtime-wasi-c = { path = "crates/wasi-c", optional = true } wasmtime-wasi-c = { path = "crates/wasi-c", optional = true }
wasi-common = { path = "crates/wasi-common" } wasi-common = { path = "crates/wasi-common" }
structopt = { version = "0.3.5", features = ["color", "suggestions"] } structopt = { version = "0.3.5", features = ["color", "suggestions"] }
faerie = "0.13.0" faerie = "0.14.0"
anyhow = "1.0.19" anyhow = "1.0.19"
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.10.0", default-features = false }
pretty_env_logger = "0.3.0" pretty_env_logger = "0.3.0"
file-per-thread-logger = "0.1.1" file-per-thread-logger = "0.1.1"
wat = "1.0.2" wat = "1.0.2"

View File

@@ -166,6 +166,8 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool {
"Lightbeam" => match (testsuite, testname) { "Lightbeam" => match (testsuite, testname) {
(_, _) if testname.starts_with("simd") => return true, (_, _) if testname.starts_with("simd") => return true,
(_, _) if testsuite.ends_with("multi_value") => return true, (_, _) if testsuite.ends_with("multi_value") => return true,
// Lightbeam doesn't support float arguments on the stack.
("spec_testsuite", "call.wast") => return true,
_ => (), _ => (),
}, },
"Cranelift" => match (testsuite, testname) { "Cranelift" => match (testsuite, testname) {

View File

@@ -16,8 +16,8 @@ crate-type = ["lib", "staticlib", "cdylib"]
wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-runtime = { path = "../runtime", version = "0.9.0" }
wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" }
wasmtime-jit = { path = "../jit", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" }
wasmparser = { version = "0.45.1", default-features = false } wasmparser = { version = "0.47.0", default-features = false }
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.10.0", default-features = false }
anyhow = "1.0.19" anyhow = "1.0.19"
region = "2.0.0" region = "2.0.0"
libc = "0.2" libc = "0.2"

View File

@@ -13,10 +13,10 @@ edition = "2018"
[dependencies] [dependencies]
gimli = "0.19.0" gimli = "0.19.0"
wasmparser = "0.45.1" wasmparser = "0.47.0"
faerie = "0.13.0" faerie = "0.14.0"
wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" }
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.10.0", default-features = false }
anyhow = "1.0" anyhow = "1.0"
thiserror = "1.0.4" thiserror = "1.0.4"
more-asserts = "0.2.1" more-asserts = "0.2.1"

View File

@@ -13,10 +13,10 @@ edition = "2018"
[dependencies] [dependencies]
anyhow = "1.0" anyhow = "1.0"
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } cranelift-codegen = { version = "0.53", features = ["enable-serde"] }
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } cranelift-entity = { version = "0.53", features = ["enable-serde"] }
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } cranelift-wasm = { version = "0.53", features = ["enable-serde"] }
wasmparser = "0.45.1" wasmparser = "0.47.0"
lightbeam = { path = "../lightbeam", optional = true, version = "0.9.0" } lightbeam = { path = "../lightbeam", optional = true, version = "0.9.0" }
indexmap = "1.0.2" indexmap = "1.0.2"
rayon = "1.2.1" rayon = "1.2.1"
@@ -43,10 +43,10 @@ errno = "0.2.4"
[dev-dependencies] [dev-dependencies]
tempfile = "3" tempfile = "3"
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.10.0", default-features = false }
pretty_env_logger = "0.3.0" pretty_env_logger = "0.3.0"
rand = { version = "0.7.0", default-features = false, features = ["small_rng"] } rand = { version = "0.7.0", default-features = false, features = ["small_rng"] }
cranelift-codegen = { version = "0.52.0", features = ["enable-serde", "all-arch"] } cranelift-codegen = { version = "0.53", features = ["enable-serde", "all-arch"] }
filetime = "0.2.7" filetime = "0.2.7"
[badges] [badges]

View File

@@ -362,6 +362,10 @@ impl<'module_environment> TargetEnvironment for FuncEnvironment<'module_environm
} }
impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'module_environment> { impl<'module_environment> cranelift_wasm::FuncEnvironment for FuncEnvironment<'module_environment> {
fn is_wasm_parameter(&self, func: &ir::Function, index: usize) -> bool {
func.signature.params[index].purpose == ir::ArgumentPurpose::Normal
}
fn make_table(&mut self, func: &mut ir::Function, index: TableIndex) -> WasmResult<ir::Table> { fn make_table(&mut self, func: &mut ir::Function, index: TableIndex) -> WasmResult<ir::Table> {
let pointer_type = self.pointer_type(); let pointer_type = self.pointer_type();

View File

@@ -14,7 +14,7 @@ arbitrary = "0.2.0"
binaryen = "0.8.2" binaryen = "0.8.2"
env_logger = { version = "0.7.1", optional = true } env_logger = { version = "0.7.1", optional = true }
log = "0.4.8" log = "0.4.8"
wasmparser = "0.45.1" wasmparser = "0.47.0"
wasmprinter = "0.2.0" wasmprinter = "0.2.0"
wasmtime = { path = "../api", version = "0.9.0" } wasmtime = { path = "../api", version = "0.9.0" }
wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" }

View File

@@ -13,7 +13,7 @@ edition = "2018"
[dependencies] [dependencies]
anyhow = "1.0.19" anyhow = "1.0.19"
walrus = "0.13" walrus = "0.13"
wasmparser = { version = "0.45.1", default-features = false } wasmparser = { version = "0.47.0", default-features = false }
wasm-webidl-bindings = "0.6" wasm-webidl-bindings = "0.6"
wasmtime = { path = "../api", version = "0.9.0" } wasmtime = { path = "../api", version = "0.9.0" }
wasmtime-jit = { path = "../jit", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" }

View File

@@ -11,18 +11,18 @@ readme = "README.md"
edition = "2018" edition = "2018"
[dependencies] [dependencies]
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } cranelift-codegen = { version = "0.53", features = ["enable-serde"] }
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } cranelift-entity = { version = "0.53", features = ["enable-serde"] }
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } cranelift-wasm = { version = "0.53", features = ["enable-serde"] }
cranelift-native = "0.52.0" cranelift-native = "0.53"
cranelift-frontend = "0.52.0" cranelift-frontend = "0.53"
wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" }
wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-runtime = { path = "../runtime", version = "0.9.0" }
wasmtime-debug = { path = "../debug", version = "0.9.0" } wasmtime-debug = { path = "../debug", version = "0.9.0" }
region = "2.0.0" region = "2.0.0"
thiserror = "1.0.4" thiserror = "1.0.4"
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.10.0", default-features = false }
wasmparser = { version = "0.45.1", default-features = false } wasmparser = { version = "0.47.0", default-features = false }
more-asserts = "0.2.1" more-asserts = "0.2.1"
anyhow = "1.0" anyhow = "1.0"

View File

@@ -14,12 +14,12 @@ edition = "2018"
smallvec = "1.0.0" smallvec = "1.0.0"
dynasm = "0.5.2" dynasm = "0.5.2"
dynasmrt = "0.5.2" dynasmrt = "0.5.2"
wasmparser = "0.45.1" wasmparser = "0.47.0"
memoffset = "0.5.3" memoffset = "0.5.3"
itertools = "0.8.2" itertools = "0.8.2"
capstone = "0.6.0" capstone = "0.6.0"
thiserror = "1.0.9" thiserror = "1.0.9"
cranelift-codegen = "0.52.0" cranelift-codegen = "0.53"
multi_mut = "0.1" multi_mut = "0.1"
either = "1.5" either = "1.5"
typemap = "0.3" typemap = "0.3"

View File

@@ -22,10 +22,10 @@ wasmtime-environ = { path = "../../environ", version = "0.9.0" }
wasmtime-interface-types = { path = "../../interface-types", version = "0.9.0" } wasmtime-interface-types = { path = "../../interface-types", version = "0.9.0" }
wasmtime-runtime = { path = "../../runtime", version = "0.9.0" } wasmtime-runtime = { path = "../../runtime", version = "0.9.0" }
wasmtime-wasi = { path = "../../wasi", version = "0.9.0" } wasmtime-wasi = { path = "../../wasi", version = "0.9.0" }
target-lexicon = { version = "0.9.0", default-features = false } target-lexicon = { version = "0.10.0", default-features = false }
anyhow = "1.0.19" anyhow = "1.0.19"
region = "2.0.0" region = "2.0.0"
wasmparser = "0.45.1" wasmparser = "0.47.0"
pyo3 = { version = "0.8.0", features = ["extension-module"] } pyo3 = { version = "0.8.0", features = ["extension-module"] }
[badges] [badges]

View File

@@ -13,7 +13,7 @@ edition = "2018"
[dependencies] [dependencies]
anyhow = "1.0" anyhow = "1.0"
wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" }
faerie = "0.13.0" faerie = "0.14.0"
more-asserts = "0.2.1" more-asserts = "0.2.1"
[badges] [badges]

View File

@@ -16,7 +16,7 @@ wasmtime-environ = { path = "../environ", version = "0.9.0" }
wasmtime-jit = { path = "../jit", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" }
wasmtime-wasi = { path = "../wasi", version = "0.9.0" } wasmtime-wasi = { path = "../wasi", version = "0.9.0" }
wasmtime = { path = "../api", version = "0.9.0" } wasmtime = { path = "../api", version = "0.9.0" }
target-lexicon = "0.9.0" target-lexicon = "0.10.0"
pretty_env_logger = "0.3.0" pretty_env_logger = "0.3.0"
tempfile = "3.1.0" tempfile = "3.1.0"
os_pipe = "0.9" os_pipe = "0.9"

View File

@@ -14,17 +14,17 @@ edition = "2018"
wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-runtime = { path = "../runtime", version = "0.9.0" }
wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" }
wasmtime-jit = { path = "../jit", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" }
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } cranelift-codegen = { version = "0.53", features = ["enable-serde"] }
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } cranelift-entity = { version = "0.53", features = ["enable-serde"] }
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } cranelift-wasm = { version = "0.53", features = ["enable-serde"] }
target-lexicon = "0.9.0" target-lexicon = "0.10.0"
log = { version = "0.4.8", default-features = false } log = { version = "0.4.8", default-features = false }
libc = "0.2.60" libc = "0.2.60"
more-asserts = "0.2.1" more-asserts = "0.2.1"
[build-dependencies] [build-dependencies]
cmake = "0.1.35" cmake = "0.1.35"
bindgen = "0.51.0" bindgen = "0.52.0"
[badges] [badges]
maintenance = { status = "actively-developed" } maintenance = { status = "actively-developed" }

View File

@@ -16,10 +16,10 @@ wasmtime-runtime = { path = "../runtime", version = "0.9.0" }
wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" }
wasmtime-jit = { path = "../jit", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" }
wasi-common = { path = "../wasi-common", version = "0.9.0" } wasi-common = { path = "../wasi-common", version = "0.9.0" }
cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } cranelift-codegen = { version = "0.53", features = ["enable-serde"] }
cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } cranelift-entity = { version = "0.53", features = ["enable-serde"] }
cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } cranelift-wasm = { version = "0.53", features = ["enable-serde"] }
target-lexicon = "0.9.0" target-lexicon = "0.10.0"
log = { version = "0.4.8", default-features = false } log = { version = "0.4.8", default-features = false }
wig = { path = "../wasi-common/wig", version = "0.9.2" } wig = { path = "../wasi-common/wig", version = "0.9.2" }

View File

@@ -13,7 +13,7 @@ edition = "2018"
[dependencies] [dependencies]
anyhow = "1.0.19" anyhow = "1.0.19"
wasmtime = { path = "../api", version = "0.9.0" } wasmtime = { path = "../api", version = "0.9.0" }
wast = "5.0.1" wast = "6.0.0"
[badges] [badges]
maintenance = { status = "actively-developed" } maintenance = { status = "actively-developed" }

View File

@@ -191,10 +191,10 @@ impl WastContext {
Ok(Outcome::Ok(vec![global.get()])) Ok(Outcome::Ok(vec![global.get()]))
} }
fn assert_return(&self, result: Outcome, results: &[Val]) -> Result<()> { fn assert_return(&self, result: Outcome, results: &[wast::AssertExpression]) -> Result<()> {
let values = result.into_result()?; let values = result.into_result()?;
for (v, e) in values.iter().zip(results) { for (v, e) in values.iter().zip(results) {
if values_equal(v, e)? { if val_matches(v, e)? {
continue; continue;
} }
bail!("expected {:?}, got {:?}", e, v) bail!("expected {:?}, got {:?}", e, v)
@@ -263,10 +263,6 @@ impl WastContext {
exec, exec,
results, results,
} => { } => {
let results = results
.iter()
.map(runtime_value)
.collect::<Result<Vec<_>>>()?;
let result = self.perform_execute(exec)?; let result = self.perform_execute(exec)?;
self.assert_return(result, &results)?; self.assert_return(result, &results)?;
} }
@@ -286,92 +282,6 @@ impl WastContext {
let result = self.perform_invoke(call)?; let result = self.perform_invoke(call)?;
self.assert_trap(result, message)?; self.assert_trap(result, message)?;
} }
AssertReturnCanonicalNan { span: _, invoke } => {
for v in self.perform_invoke(invoke)?.into_result()? {
match v {
Val::F32(x) => {
if !is_canonical_f32_nan(x) {
bail!("expected canonical NaN");
}
}
Val::F64(x) => {
if !is_canonical_f64_nan(x) {
bail!("expected canonical NaN");
}
}
other => bail!("expected float, got {:?}", other),
};
}
}
AssertReturnCanonicalNanF32x4 { span: _, invoke } => {
for v in self.perform_invoke(invoke)?.into_result()? {
let val = match v {
Val::V128(x) => x,
other => bail!("expected v128, got {:?}", other),
};
for l in 0..4 {
if !is_canonical_f32_nan(extract_lane_as_u32(val, l)?) {
bail!("expected f32x4 canonical NaN in lane {}", l)
}
}
}
}
AssertReturnCanonicalNanF64x2 { span: _, invoke } => {
for v in self.perform_invoke(invoke)?.into_result()? {
let val = match v {
Val::V128(x) => x,
other => bail!("expected v128, got {:?}", other),
};
for l in 0..4 {
if !is_canonical_f64_nan(extract_lane_as_u64(val, l)?) {
bail!("expected f64x2 canonical NaN in lane {}", l)
}
}
}
}
AssertReturnArithmeticNan { span: _, invoke } => {
for v in self.perform_invoke(invoke)?.into_result()? {
match v {
Val::F32(x) => {
if !is_arithmetic_f32_nan(x) {
bail!("expected arithmetic NaN");
}
}
Val::F64(x) => {
if !is_arithmetic_f64_nan(x) {
bail!("expected arithmetic NaN");
}
}
other => bail!("expected float, got {:?}", other),
}
}
}
AssertReturnArithmeticNanF32x4 { span: _, invoke } => {
for v in self.perform_invoke(invoke)?.into_result()? {
let val = match v {
Val::V128(x) => x,
other => bail!("expected v128, got {:?}", other),
};
for l in 0..4 {
if !is_arithmetic_f32_nan(extract_lane_as_u32(val, l)?) {
bail!("expected f32x4 arithmetic NaN in lane {}", l)
}
}
}
}
AssertReturnArithmeticNanF64x2 { span: _, invoke } => {
for v in self.perform_invoke(invoke)?.into_result()? {
let val = match v {
Val::V128(x) => x,
other => bail!("expected v128, got {:?}", other),
};
for l in 0..4 {
if !is_arithmetic_f64_nan(extract_lane_as_u64(val, l)?) {
bail!("expected f64x2 arithmetic NaN in lane {}", l)
}
}
}
}
AssertInvalid { AssertInvalid {
span: _, span: _,
mut module, mut module,
@@ -449,12 +359,20 @@ impl WastContext {
} }
} }
fn extract_lane_as_u32(bytes: u128, lane: usize) -> Result<u32> { fn extract_lane_as_i8(bytes: u128, lane: usize) -> i8 {
Ok((bytes >> (lane * 32)) as u32) (bytes >> (lane * 8)) as i8
} }
fn extract_lane_as_u64(bytes: u128, lane: usize) -> Result<u64> { fn extract_lane_as_i16(bytes: u128, lane: usize) -> i16 {
Ok((bytes >> (lane * 64)) as u64) (bytes >> (lane * 16)) as i16
}
fn extract_lane_as_i32(bytes: u128, lane: usize) -> i32 {
(bytes >> (lane * 32)) as i32
}
fn extract_lane_as_i64(bytes: u128, lane: usize) -> i64 {
(bytes >> (lane * 64)) as i64
} }
fn is_canonical_f32_nan(bits: u32) -> bool { fn is_canonical_f32_nan(bits: u32) -> bool {
@@ -475,15 +393,64 @@ fn is_arithmetic_f64_nan(bits: u64) -> bool {
(bits & AF64_NAN) == AF64_NAN (bits & AF64_NAN) == AF64_NAN
} }
fn values_equal(v1: &Val, v2: &Val) -> Result<bool> { fn val_matches(actual: &Val, expected: &wast::AssertExpression) -> Result<bool> {
Ok(match (v1, v2) { Ok(match (actual, expected) {
(Val::I32(a), Val::I32(b)) => a == b, (Val::I32(a), wast::AssertExpression::I32(b)) => a == b,
(Val::I64(a), Val::I64(b)) => a == b, (Val::I64(a), wast::AssertExpression::I64(b)) => a == b,
// Note that these float comparisons are comparing bits, not float // Note that these float comparisons are comparing bits, not float
// values, so we're testing for bit-for-bit equivalence // values, so we're testing for bit-for-bit equivalence
(Val::F32(a), Val::F32(b)) => a == b, (Val::F32(a), wast::AssertExpression::F32(b)) => f32_matches(*a, b),
(Val::F64(a), Val::F64(b)) => a == b, (Val::F64(a), wast::AssertExpression::F64(b)) => f64_matches(*a, b),
(Val::V128(a), Val::V128(b)) => a == b, (Val::V128(a), wast::AssertExpression::V128(b)) => v128_matches(*a, b),
_ => bail!("don't know how to compare {:?} and {:?} yet", v1, v2), _ => bail!(
"don't know how to compare {:?} and {:?} yet",
actual,
expected
),
}) })
} }
fn f32_matches(actual: u32, expected: &wast::NanPattern<wast::Float32>) -> bool {
match expected {
wast::NanPattern::CanonicalNan => is_canonical_f32_nan(actual),
wast::NanPattern::ArithmeticNan => is_arithmetic_f32_nan(actual),
wast::NanPattern::Value(expected_value) => actual == expected_value.bits,
}
}
fn f64_matches(actual: u64, expected: &wast::NanPattern<wast::Float64>) -> bool {
match expected {
wast::NanPattern::CanonicalNan => is_canonical_f64_nan(actual),
wast::NanPattern::ArithmeticNan => is_arithmetic_f64_nan(actual),
wast::NanPattern::Value(expected_value) => actual == expected_value.bits,
}
}
fn v128_matches(actual: u128, expected: &wast::V128Pattern) -> bool {
match expected {
wast::V128Pattern::I8x16(b) => b
.iter()
.enumerate()
.all(|(i, b)| *b == extract_lane_as_i8(actual, i)),
wast::V128Pattern::I16x8(b) => b
.iter()
.enumerate()
.all(|(i, b)| *b == extract_lane_as_i16(actual, i)),
wast::V128Pattern::I32x4(b) => b
.iter()
.enumerate()
.all(|(i, b)| *b == extract_lane_as_i32(actual, i)),
wast::V128Pattern::I64x2(b) => b
.iter()
.enumerate()
.all(|(i, b)| *b == extract_lane_as_i64(actual, i)),
wast::V128Pattern::F32x4(b) => b.iter().enumerate().all(|(i, b)| {
let a = extract_lane_as_i32(actual, i) as u32;
f32_matches(a, b)
}),
wast::V128Pattern::F64x2(b) => b.iter().enumerate().all(|(i, b)| {
let a = extract_lane_as_i64(actual, i) as u64;
f64_matches(a, b)
}),
}
}

View File

@@ -9,16 +9,16 @@ topdir=$(dirname "$0")/..
cd "$topdir" cd "$topdir"
# All the cranelift-* crates have the same version number # All the cranelift-* crates have the same version number
version="0.49" version="0.53"
# Update all of the Cargo.toml files. # Update all of the Cargo.toml files.
echo "Updating crate versions to $version" echo "Updating crate versions to $version"
for crate in . crates/* crates/misc/* fuzz; do for toml in Cargo.toml crates/*/Cargo.toml crates/misc/*/Cargo.toml fuzz/Cargo.toml; do
# Update the version number of this crate to $version. # Update the version number of this crate to $version.
sed -i.bk -e "/^cranelift-/s/\"[^\"]*\"/\"$version\"/" \ sed -i.bk -e "/^cranelift-/s/\"[^\"]*\"/\"$version\"/" \
"$crate/Cargo.toml" "$toml"
# Update the required version number of any cranelift* dependencies. # Update the required version number of any cranelift* dependencies.
sed -i.bk -e "/^cranelift-/s/version = \"[^\"]*\"/version = \"$version\"/" \ sed -i.bk -e "/^cranelift-/s/version = \"[^\"]*\"/version = \"$version\"/" \
"$crate/Cargo.toml" "$toml"
done done