diff --git a/Cargo.lock b/Cargo.lock index da9a3565fd..01553a79ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -126,7 +126,7 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "440d600bca1c3b3982dd2533518e15ba73d051b532768804aa3c06ae52f4ce44" dependencies = [ - "bindgen 0.52.0", + "bindgen", "cc", "cmake", "heck", @@ -143,29 +143,6 @@ dependencies = [ "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]] name = "bindgen" version = "0.52.0" @@ -364,18 +341,18 @@ dependencies = [ [[package]] name = "cranelift-bforest" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56aa72ef104c5d634f2f9e84ef2c47e116c1d185fae13f196b97ca84b0a514f1" +checksum = "3b065d5992ea22903200c56dd2b3a7062a1311b49739ffd2be9215f882204f73" dependencies = [ "cranelift-entity", ] [[package]] name = "cranelift-codegen" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "460b9d20793543599308d22f5a1172c196e63a780c4e9aacb0b3f4f63d63ffe1" +checksum = "6ae646133a3dda0af636eb4e2928d282a976c836392e0de57a5750ca9eb132e1" dependencies = [ "byteorder", "cranelift-bforest", @@ -391,9 +368,9 @@ dependencies = [ [[package]] name = "cranelift-codegen-meta" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc70e4e8ccebd53a4f925147def857c9e9f7fe0fdbef4bb645a420473e012f50" +checksum = "883a636641a34034d16d1986557fdf815245140c4bb9e6561a6cb8ebacd7b9d4" dependencies = [ "cranelift-codegen-shared", "cranelift-entity", @@ -401,24 +378,24 @@ dependencies = [ [[package]] name = "cranelift-codegen-shared" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3992000be4d18df0fe332b7c42c120de896e8ec54cd7b6cfa050910a8c9f6e2f" +checksum = "a3467bb48aa1b6a4c0da0fa0b5fea7f78f96bbf4bbf054eeb053b5e2e8794387" [[package]] name = "cranelift-entity" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "722957e05064d97a3157bf0976deed0f3e8ee4f8a4ce167a7c724ca63a4e8bd9" +checksum = "03578fa46b2009c4575494b0ecf8319a79bc913a6c1be3a2cb55ee7089c59989" dependencies = [ "serde", ] [[package]] name = "cranelift-frontend" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13051964302dc7948e8869735de42591559ea55e319b9b92da5b38f8e6a75cb7" +checksum = "54859b486e505c03d5d8982216509eb99782ef5a3f7f8cbe86cd73967975c49b" dependencies = [ "cranelift-codegen", "log", @@ -428,9 +405,9 @@ dependencies = [ [[package]] name = "cranelift-native" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21398a0bc6ba389ea86964ac4a495426dd61080f2ddd306184777a8560fe9976" +checksum = "b245d7376b7200a5dcce955761f4f7396019beda4a788d9cbe555308f1869cd2" dependencies = [ "cranelift-codegen", "raw-cpuid", @@ -439,9 +416,9 @@ dependencies = [ [[package]] name = "cranelift-wasm" -version = "0.52.0" +version = "0.53.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b72b7b10c09f70a604122fab76e6c4411255cf35403b68c3285566cc9d21c486" +checksum = "115e207912c5841c3932b366be979b34a62ee32c839c2ddbc1c81877cd8ec03c" dependencies = [ "cranelift-codegen", "cranelift-entity", @@ -637,9 +614,9 @@ dependencies = [ [[package]] name = "faerie" -version = "0.13.0" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f902f2af041f6c7177a2a04f805687cdc71e69c7cbef059a2755d8923f4cd7a8" +checksum = "74b9ed6159e4a6212c61d9c6a86bee01876b192a64accecf58d5b5ae3b667b52" dependencies = [ "anyhow", "goblin", @@ -953,7 +930,7 @@ dependencies = [ "smallvec", "thiserror", "typemap", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "wat", ] @@ -1030,9 +1007,9 @@ dependencies = [ [[package]] name = "num" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4825417e1e1406b3782a8ce92f4d53f26ec055e3622e1881ca8e9f5f9e08db" +checksum = "b8536030f9fea7127f841b45bb6243b27255787fb4eb83958aa1ef9d2fdc0c36" dependencies = [ "num-complex", "num-integer", @@ -1043,11 +1020,11 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb0cf31fb3ff77e6d2a6ebd6800df7fdcd106f2ad89113c9130bcd07f93dffc" +checksum = "b6b19411a9719e753aff12e5187b74d60d3dc449ec3f4dc21e3989c3f554bc95" dependencies = [ - "autocfg 0.1.7", + "autocfg 1.0.0", "num-traits", ] @@ -1074,11 +1051,11 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2885278d5fe2adc2f75ced642d52d879bffaceb5a2e0b1d4309ffdfb239b454" +checksum = "da4dc79f9e6c81bef96148c8f6b8e72ad4541caa4a24373e900a36da07de03a3" dependencies = [ - "autocfg 0.1.7", + "autocfg 1.0.0", "num-integer", "num-traits", ] @@ -1710,9 +1687,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f4c118a7a38378f305a9e111fcb2f7f838c0be324bfb31a77ea04f7f6e684b4" +checksum = "ab0e7238dcc7b40a7be719a25365910f6807bd864f4cce6b2e6b873658e2b19d" [[package]] name = "tempfile" @@ -1993,6 +1970,12 @@ version = "0.45.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b4eab1d9971d0803729cba3617b56eb04fcb4bd25361cb63880ed41a42f20d5" +[[package]] +name = "wasmparser" +version = "0.47.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add8db5a53a2f64f13418b241982c4ab533d7a9e1e8a5dcadccce633d8d393b" + [[package]] name = "wasmprinter" version = "0.2.0" @@ -2016,7 +1999,7 @@ dependencies = [ "region", "target-lexicon", "wasi-common", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "wasmtime-environ", "wasmtime-jit", "wasmtime-runtime", @@ -2063,7 +2046,7 @@ dependencies = [ "more-asserts", "target-lexicon", "thiserror", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "wasmtime-environ", ] @@ -2097,7 +2080,7 @@ dependencies = [ "tempfile", "thiserror", "toml", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "winapi", "zstd", ] @@ -2124,7 +2107,7 @@ dependencies = [ "binaryen", "env_logger 0.7.1", "log", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "wasmprinter", "wasmtime", "wasmtime-environ", @@ -2139,7 +2122,7 @@ dependencies = [ "anyhow", "walrus", "wasm-webidl-bindings", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "wasmtime", "wasmtime-environ", "wasmtime-jit", @@ -2161,7 +2144,7 @@ dependencies = [ "region", "target-lexicon", "thiserror", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "wasmtime-debug", "wasmtime-environ", "wasmtime-runtime", @@ -2186,7 +2169,7 @@ dependencies = [ "pyo3", "region", "target-lexicon", - "wasmparser 0.45.2", + "wasmparser 0.47.0", "wasmtime", "wasmtime-environ", "wasmtime-interface-types", @@ -2252,7 +2235,7 @@ dependencies = [ name = "wasmtime-wasi-c" version = "0.9.0" dependencies = [ - "bindgen 0.51.1", + "bindgen", "cmake", "cranelift-codegen", "cranelift-entity", @@ -2272,7 +2255,7 @@ version = "0.9.0" dependencies = [ "anyhow", "wasmtime", - "wast 5.0.1", + "wast 6.0.0", ] [[package]] @@ -2284,15 +2267,6 @@ dependencies = [ "leb128", ] -[[package]] -name = "wast" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d1de68310854a9840d39487701a8c1acccb5c9f9f2650d5fce3cdfe6650c372" -dependencies = [ - "leb128", -] - [[package]] name = "wast" version = "6.0.0" diff --git a/Cargo.toml b/Cargo.toml index 9eaba429dd..378189e3c2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,9 +29,9 @@ wasmtime-wasi = { path = "crates/wasi" } wasmtime-wasi-c = { path = "crates/wasi-c", optional = true } wasi-common = { path = "crates/wasi-common" } structopt = { version = "0.3.5", features = ["color", "suggestions"] } -faerie = "0.13.0" +faerie = "0.14.0" 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" file-per-thread-logger = "0.1.1" wat = "1.0.2" diff --git a/build.rs b/build.rs index 44428b3e3c..3e5598926e 100644 --- a/build.rs +++ b/build.rs @@ -166,6 +166,8 @@ fn ignore(testsuite: &str, testname: &str, strategy: &str) -> bool { "Lightbeam" => match (testsuite, testname) { (_, _) if testname.starts_with("simd") => 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) { diff --git a/crates/api/Cargo.toml b/crates/api/Cargo.toml index b441217640..67961e0299 100644 --- a/crates/api/Cargo.toml +++ b/crates/api/Cargo.toml @@ -16,8 +16,8 @@ crate-type = ["lib", "staticlib", "cdylib"] wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" } -wasmparser = { version = "0.45.1", default-features = false } -target-lexicon = { version = "0.9.0", default-features = false } +wasmparser = { version = "0.47.0", default-features = false } +target-lexicon = { version = "0.10.0", default-features = false } anyhow = "1.0.19" region = "2.0.0" libc = "0.2" diff --git a/crates/api/c-examples/wasm-c-api b/crates/api/c-examples/wasm-c-api index 8782d5b456..d9a80099d4 160000 --- a/crates/api/c-examples/wasm-c-api +++ b/crates/api/c-examples/wasm-c-api @@ -1 +1 @@ -Subproject commit 8782d5b456f39e5ebf86bbbfa88d0ac13743edfa +Subproject commit d9a80099d496b5cdba6f3fe8fc77586e0e505ddc diff --git a/crates/debug/Cargo.toml b/crates/debug/Cargo.toml index a85387c326..f7ac2cc8c0 100644 --- a/crates/debug/Cargo.toml +++ b/crates/debug/Cargo.toml @@ -13,10 +13,10 @@ edition = "2018" [dependencies] gimli = "0.19.0" -wasmparser = "0.45.1" -faerie = "0.13.0" +wasmparser = "0.47.0" +faerie = "0.14.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" thiserror = "1.0.4" more-asserts = "0.2.1" diff --git a/crates/environ/Cargo.toml b/crates/environ/Cargo.toml index 260b8a468f..596a413db1 100644 --- a/crates/environ/Cargo.toml +++ b/crates/environ/Cargo.toml @@ -13,10 +13,10 @@ edition = "2018" [dependencies] anyhow = "1.0" -cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } -cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } -cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } -wasmparser = "0.45.1" +cranelift-codegen = { version = "0.53", features = ["enable-serde"] } +cranelift-entity = { version = "0.53", features = ["enable-serde"] } +cranelift-wasm = { version = "0.53", features = ["enable-serde"] } +wasmparser = "0.47.0" lightbeam = { path = "../lightbeam", optional = true, version = "0.9.0" } indexmap = "1.0.2" rayon = "1.2.1" @@ -43,10 +43,10 @@ errno = "0.2.4" [dev-dependencies] 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" 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" [badges] diff --git a/crates/environ/src/func_environ.rs b/crates/environ/src/func_environ.rs index 6daa016b69..b218641877 100644 --- a/crates/environ/src/func_environ.rs +++ b/crates/environ/src/func_environ.rs @@ -362,6 +362,10 @@ impl<'module_environment> TargetEnvironment for FuncEnvironment<'module_environm } 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 { let pointer_type = self.pointer_type(); diff --git a/crates/fuzzing/Cargo.toml b/crates/fuzzing/Cargo.toml index 76d65fc05e..e6eefeafe7 100644 --- a/crates/fuzzing/Cargo.toml +++ b/crates/fuzzing/Cargo.toml @@ -14,7 +14,7 @@ arbitrary = "0.2.0" binaryen = "0.8.2" env_logger = { version = "0.7.1", optional = true } log = "0.4.8" -wasmparser = "0.45.1" +wasmparser = "0.47.0" wasmprinter = "0.2.0" wasmtime = { path = "../api", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" } diff --git a/crates/interface-types/Cargo.toml b/crates/interface-types/Cargo.toml index 72572c59b0..380d466766 100644 --- a/crates/interface-types/Cargo.toml +++ b/crates/interface-types/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" [dependencies] anyhow = "1.0.19" walrus = "0.13" -wasmparser = { version = "0.45.1", default-features = false } +wasmparser = { version = "0.47.0", default-features = false } wasm-webidl-bindings = "0.6" wasmtime = { path = "../api", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" } diff --git a/crates/jit/Cargo.toml b/crates/jit/Cargo.toml index a4a1c59a4c..950c714988 100644 --- a/crates/jit/Cargo.toml +++ b/crates/jit/Cargo.toml @@ -11,18 +11,18 @@ readme = "README.md" edition = "2018" [dependencies] -cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } -cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } -cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } -cranelift-native = "0.52.0" -cranelift-frontend = "0.52.0" +cranelift-codegen = { version = "0.53", features = ["enable-serde"] } +cranelift-entity = { version = "0.53", features = ["enable-serde"] } +cranelift-wasm = { version = "0.53", features = ["enable-serde"] } +cranelift-native = "0.53" +cranelift-frontend = "0.53" wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-debug = { path = "../debug", version = "0.9.0" } region = "2.0.0" thiserror = "1.0.4" -target-lexicon = { version = "0.9.0", default-features = false } -wasmparser = { version = "0.45.1", default-features = false } +target-lexicon = { version = "0.10.0", default-features = false } +wasmparser = { version = "0.47.0", default-features = false } more-asserts = "0.2.1" anyhow = "1.0" diff --git a/crates/lightbeam/Cargo.toml b/crates/lightbeam/Cargo.toml index b5af145c84..51fb19ed5c 100644 --- a/crates/lightbeam/Cargo.toml +++ b/crates/lightbeam/Cargo.toml @@ -14,12 +14,12 @@ edition = "2018" smallvec = "1.0.0" dynasm = "0.5.2" dynasmrt = "0.5.2" -wasmparser = "0.45.1" +wasmparser = "0.47.0" memoffset = "0.5.3" itertools = "0.8.2" capstone = "0.6.0" thiserror = "1.0.9" -cranelift-codegen = "0.52.0" +cranelift-codegen = "0.53" multi_mut = "0.1" either = "1.5" typemap = "0.3" diff --git a/crates/misc/py/Cargo.toml b/crates/misc/py/Cargo.toml index 335e843794..633cab3adb 100644 --- a/crates/misc/py/Cargo.toml +++ b/crates/misc/py/Cargo.toml @@ -22,10 +22,10 @@ wasmtime-environ = { path = "../../environ", version = "0.9.0" } wasmtime-interface-types = { path = "../../interface-types", version = "0.9.0" } wasmtime-runtime = { path = "../../runtime", 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" region = "2.0.0" -wasmparser = "0.45.1" +wasmparser = "0.47.0" pyo3 = { version = "0.8.0", features = ["extension-module"] } [badges] diff --git a/crates/obj/Cargo.toml b/crates/obj/Cargo.toml index 15056b8245..66843b6cbc 100644 --- a/crates/obj/Cargo.toml +++ b/crates/obj/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" [dependencies] anyhow = "1.0" wasmtime-environ = { path = "../environ", version = "0.9.0" } -faerie = "0.13.0" +faerie = "0.14.0" more-asserts = "0.2.1" [badges] diff --git a/crates/test-programs/Cargo.toml b/crates/test-programs/Cargo.toml index 50f2254757..28833c37ab 100644 --- a/crates/test-programs/Cargo.toml +++ b/crates/test-programs/Cargo.toml @@ -16,7 +16,7 @@ wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" } wasmtime-wasi = { path = "../wasi", 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" tempfile = "3.1.0" os_pipe = "0.9" diff --git a/crates/wasi-c/Cargo.toml b/crates/wasi-c/Cargo.toml index 423fb4d346..560edb2a23 100644 --- a/crates/wasi-c/Cargo.toml +++ b/crates/wasi-c/Cargo.toml @@ -14,17 +14,17 @@ edition = "2018" wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" } -cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } -cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } -cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } -target-lexicon = "0.9.0" +cranelift-codegen = { version = "0.53", features = ["enable-serde"] } +cranelift-entity = { version = "0.53", features = ["enable-serde"] } +cranelift-wasm = { version = "0.53", features = ["enable-serde"] } +target-lexicon = "0.10.0" log = { version = "0.4.8", default-features = false } libc = "0.2.60" more-asserts = "0.2.1" [build-dependencies] cmake = "0.1.35" -bindgen = "0.51.0" +bindgen = "0.52.0" [badges] maintenance = { status = "actively-developed" } diff --git a/crates/wasi-common/wig/WASI b/crates/wasi-common/wig/WASI index 9150e66a34..04d4eba571 160000 --- a/crates/wasi-common/wig/WASI +++ b/crates/wasi-common/wig/WASI @@ -1 +1 @@ -Subproject commit 9150e66a349dff6215b0290ee8f66794fbfa5ea8 +Subproject commit 04d4eba571dc1d6fe9ab129ea9343911bcc256dc diff --git a/crates/wasi/Cargo.toml b/crates/wasi/Cargo.toml index fa3607dfc5..c35a3464ff 100644 --- a/crates/wasi/Cargo.toml +++ b/crates/wasi/Cargo.toml @@ -16,10 +16,10 @@ wasmtime-runtime = { path = "../runtime", version = "0.9.0" } wasmtime-environ = { path = "../environ", version = "0.9.0" } wasmtime-jit = { path = "../jit", version = "0.9.0" } wasi-common = { path = "../wasi-common", version = "0.9.0" } -cranelift-codegen = { version = "0.52.0", features = ["enable-serde"] } -cranelift-entity = { version = "0.52.0", features = ["enable-serde"] } -cranelift-wasm = { version = "0.52.0", features = ["enable-serde"] } -target-lexicon = "0.9.0" +cranelift-codegen = { version = "0.53", features = ["enable-serde"] } +cranelift-entity = { version = "0.53", features = ["enable-serde"] } +cranelift-wasm = { version = "0.53", features = ["enable-serde"] } +target-lexicon = "0.10.0" log = { version = "0.4.8", default-features = false } wig = { path = "../wasi-common/wig", version = "0.9.2" } diff --git a/crates/wast/Cargo.toml b/crates/wast/Cargo.toml index f3baca6e2e..3213febf42 100644 --- a/crates/wast/Cargo.toml +++ b/crates/wast/Cargo.toml @@ -13,7 +13,7 @@ edition = "2018" [dependencies] anyhow = "1.0.19" wasmtime = { path = "../api", version = "0.9.0" } -wast = "5.0.1" +wast = "6.0.0" [badges] maintenance = { status = "actively-developed" } diff --git a/crates/wast/src/wast.rs b/crates/wast/src/wast.rs index 480e64fce5..2564bac34e 100644 --- a/crates/wast/src/wast.rs +++ b/crates/wast/src/wast.rs @@ -191,10 +191,10 @@ impl WastContext { 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()?; for (v, e) in values.iter().zip(results) { - if values_equal(v, e)? { + if val_matches(v, e)? { continue; } bail!("expected {:?}, got {:?}", e, v) @@ -263,10 +263,6 @@ impl WastContext { exec, results, } => { - let results = results - .iter() - .map(runtime_value) - .collect::>>()?; let result = self.perform_execute(exec)?; self.assert_return(result, &results)?; } @@ -286,92 +282,6 @@ impl WastContext { let result = self.perform_invoke(call)?; 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 { span: _, mut module, @@ -449,12 +359,20 @@ impl WastContext { } } -fn extract_lane_as_u32(bytes: u128, lane: usize) -> Result { - Ok((bytes >> (lane * 32)) as u32) +fn extract_lane_as_i8(bytes: u128, lane: usize) -> i8 { + (bytes >> (lane * 8)) as i8 } -fn extract_lane_as_u64(bytes: u128, lane: usize) -> Result { - Ok((bytes >> (lane * 64)) as u64) +fn extract_lane_as_i16(bytes: u128, lane: usize) -> i16 { + (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 { @@ -475,15 +393,64 @@ fn is_arithmetic_f64_nan(bits: u64) -> bool { (bits & AF64_NAN) == AF64_NAN } -fn values_equal(v1: &Val, v2: &Val) -> Result { - Ok(match (v1, v2) { - (Val::I32(a), Val::I32(b)) => a == b, - (Val::I64(a), Val::I64(b)) => a == b, +fn val_matches(actual: &Val, expected: &wast::AssertExpression) -> Result { + Ok(match (actual, expected) { + (Val::I32(a), wast::AssertExpression::I32(b)) => a == b, + (Val::I64(a), wast::AssertExpression::I64(b)) => a == b, // Note that these float comparisons are comparing bits, not float // values, so we're testing for bit-for-bit equivalence - (Val::F32(a), Val::F32(b)) => a == b, - (Val::F64(a), Val::F64(b)) => a == b, - (Val::V128(a), Val::V128(b)) => a == b, - _ => bail!("don't know how to compare {:?} and {:?} yet", v1, v2), + (Val::F32(a), wast::AssertExpression::F32(b)) => f32_matches(*a, b), + (Val::F64(a), wast::AssertExpression::F64(b)) => f64_matches(*a, b), + (Val::V128(a), wast::AssertExpression::V128(b)) => v128_matches(*a, b), + _ => bail!( + "don't know how to compare {:?} and {:?} yet", + actual, + expected + ), }) } + +fn f32_matches(actual: u32, expected: &wast::NanPattern) -> 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) -> 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) + }), + } +} diff --git a/scripts/cranelift-version.sh b/scripts/cranelift-version.sh index db34f24b8b..7af91d26cd 100755 --- a/scripts/cranelift-version.sh +++ b/scripts/cranelift-version.sh @@ -9,16 +9,16 @@ topdir=$(dirname "$0")/.. cd "$topdir" # All the cranelift-* crates have the same version number -version="0.49" +version="0.53" # Update all of the Cargo.toml files. 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. sed -i.bk -e "/^cranelift-/s/\"[^\"]*\"/\"$version\"/" \ - "$crate/Cargo.toml" + "$toml" # Update the required version number of any cranelift* dependencies. sed -i.bk -e "/^cranelift-/s/version = \"[^\"]*\"/version = \"$version\"/" \ - "$crate/Cargo.toml" + "$toml" done diff --git a/tests/spec_testsuite b/tests/spec_testsuite index ab59e3a7cb..c70c3c8b13 160000 --- a/tests/spec_testsuite +++ b/tests/spec_testsuite @@ -1 +1 @@ -Subproject commit ab59e3a7cb039f9a50d4e24da7634dd4dd472ce3 +Subproject commit c70c3c8b136e5e7193135d40ec3960f4ef1cb20a