From 12b9b93a098c48a3c64a0a23e1122de13fc74d70 Mon Sep 17 00:00:00 2001 From: Ratin Kumar Date: Sun, 23 Jan 2022 00:15:42 +0400 Subject: [PATCH 1/4] Updated doc links for C/C++ and Python --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7071e16b66c..7c8c6a5b954 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ languages**, so you can use WebAssembly _anywhere_. [c logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/c.svg [c integration]: https://github.com/wasmerio/wasmer/tree/master/lib/c-api [`wasmer.h` header]: https://github.com/wasmerio/wasmer/blob/master/lib/c-api/wasmer.h -[c docs]: https://docs.rs/wasmer-c-api/*/wasmer_c_api/wasm_c_api/index.html +[c docs]: https://docs.rs/wasmer-c-api/*/wasmer/wasm_c_api/index.html [c# logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/csharp.svg [c# integration]: https://github.com/migueldeicaza/WasmerSharp @@ -164,7 +164,7 @@ languages**, so you can use WebAssembly _anywhere_. [python logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/python.svg [python integration]: https://github.com/wasmerio/wasmer-python [`wasmer` pypi package]: https://pypi.org/project/wasmer/ -[python docs]: https://wasmerio.github.io/wasmer-python/api/wasmer/ +[python docs]: https://wasmerio.github.io/wasmer-python/api/wasmer [go logo]: https://raw.githubusercontent.com/wasmerio/wasmer/master/assets/languages/go.svg [go integration]: https://github.com/wasmerio/wasmer-go From 13a926adc6e68443df3d1447d6c2c270d709b721 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Mon, 24 Jan 2022 15:39:19 +0200 Subject: [PATCH 2/4] regression test for GPR exhaustion during calls --- tests/compilers/issues.rs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/tests/compilers/issues.rs b/tests/compilers/issues.rs index a07d9a82bd9..8a23405baff 100644 --- a/tests/compilers/issues.rs +++ b/tests/compilers/issues.rs @@ -225,3 +225,42 @@ fn call_with_static_data_pointers(mut config: crate::Config) -> Result<()> { instance.exports.get_function("repro")?.call(&[])?; Ok(()) } + +/// Exhaustion of GPRs when calling a function with many floating point arguments +/// +/// Note: this one is specific to Singlepass, but we want to test in all +/// available compilers. +#[compiler_test(issues)] +fn regression_gpr_exhaustion_for_calls(mut config: crate::Config) -> Result<()> { + let store = config.store(); + let wat = r#" + (module + (type (;0;) (func (param f64) (result i32))) + (type (;1;) (func (param f64 f64 f64 f64 f64 f64))) + (func (;0;) (type 0) (param f64) (result i32) + local.get 0 + local.get 0 + local.get 0 + local.get 0 + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + f64.const 0 + i32.const 0 + call_indirect (type 0) + call_indirect (type 1) + drop + drop + drop + drop + i32.const 0) + (table (;0;) 1 1 funcref)) + "#; + let module = Module::new(&store, wat)?; + let imports: ImportObject = imports! {}; + let instance = Instance::new(&module, &imports)?; + Ok(()) +} From a358e847412401a6dd89bfe1c86a8e9a4ccc639c Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Mon, 24 Jan 2022 15:54:17 +0200 Subject: [PATCH 3/4] x64: fix assert when calling a function --- lib/compiler-singlepass/src/machine_x64.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/lib/compiler-singlepass/src/machine_x64.rs b/lib/compiler-singlepass/src/machine_x64.rs index 3f428fe19fe..e2e13a4c7d3 100644 --- a/lib/compiler-singlepass/src/machine_x64.rs +++ b/lib/compiler-singlepass/src/machine_x64.rs @@ -1807,16 +1807,22 @@ impl Machine for MachineX86_64 { fn push_location_for_native(&mut self, loc: Location) { match loc { Location::Imm64(_) => { - // Push R9 value slot to be exchange with `mov`. + // x86_64 does not support `mov imm64, mem`. We must first place the immdiate value + // into a register and then write the register to the memory. Now the problem is + // that there might not be any registers available to clobber. In order to make + // this work out we spill a register thus retaining both the original value of the + // register and producing the required data at the top of the stack. + // + // FIXME(#2723): figure out how to not require spilling a register here. It should + // definitely be possible to `pick_gpr`/`pick_temp_gpr` to grab an otherwise unused + // register and just clobber its value here. self.assembler.emit_push(Size::S64, Location::GPR(GPR::R9)); - self.reserve_unused_temp_gpr(GPR::R9); self.move_location(Size::S64, loc, Location::GPR(GPR::R9)); self.assembler.emit_xchg( Size::S64, Location::GPR(GPR::R9), Location::Memory(GPR::RSP, 0), ); - self.release_gpr(GPR::R9); } Location::SIMD(_) => { // Dummy value slot to be filled with `mov`. From 900df5ec4a7e5a29dbcbb6d2a0414d5df6179a3d Mon Sep 17 00:00:00 2001 From: Syrus Akbary Date: Tue, 25 Jan 2022 14:02:40 -0800 Subject: [PATCH 4/4] Update dependencies --- Cargo.lock | 66 +++++++++++++++++++++++++++--------------------------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa9208220b9..888d264c5f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.52" +version = "1.0.53" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84450d0b4a8bd1ba4144ce8ce718fbc5d071358b1e5384bace6536b3d1f2d5b3" +checksum = "94a45b455c14666b85fc40a019e8ab9eb75e3a124e05494f5397122bc9eb06e0" [[package]] name = "arbitrary" @@ -171,9 +171,9 @@ checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" [[package]] name = "blake3" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "882e99e4a0cb2ae6cb6e442102e8e6b7131718d94110e64c3e6a34ea9b106f37" +checksum = "a08e53fc5a564bb15bfe6fae56bd71522205f1f91893f9c0116edad6496c183f" dependencies = [ "arrayref", "arrayvec", @@ -483,9 +483,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "738c290dfaea84fc1ca15ad9c168d083b05a714e1efddd8edaab678dc28d2836" +checksum = "a2209c310e29876f7f0b2721e7e26b84aff178aa3da5d091f9bfbf47669e60e3" dependencies = [ "cfg-if 1.0.0", ] @@ -835,9 +835,9 @@ dependencies = [ [[package]] name = "erased-serde" -version = "0.3.17" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44a5d80251b806a14cd3e4e1a582e912d5cbf6904ab19fdefbd7a56adca088e1" +checksum = "56047058e1ab118075ca22f9ecd737bcc961aa3566a3019cb71388afa280bd8a" dependencies = [ "serde", ] @@ -850,9 +850,9 @@ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" [[package]] name = "fastrand" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "779d043b6a0b90cc4c0ed7ee380a6504394cee7efd7db050e3774eee387324b2" +checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf" dependencies = [ "instant", ] @@ -1148,9 +1148,9 @@ dependencies = [ [[package]] name = "inventory" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa2f6fdbc5fd6457ae78e0313ba2eb5cb509655bbcfe8c577096cdbae8ff621c" +checksum = "ce6b5d8c669bfbad811d95ddd7a1c6cf9cfdbf2777e59928b6f3fa8ff54f72a0" dependencies = [ "ctor", "ghost", @@ -1206,9 +1206,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.112" +version = "0.2.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125" +checksum = "b0005d08a8f7b65fb8073cb697aa0b12b631ed251ce73d862ce50eeb52ce3b50" [[package]] name = "libfuzzer-sys" @@ -1233,9 +1233,9 @@ dependencies = [ [[package]] name = "llvm-sys" -version = "120.2.1" +version = "120.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a810627ac62b396f5fd2214ba9bbd8748d4d6efdc4d2c1c1303ea7a75763ce" +checksum = "4897352ffc39e1b2b3f7078b632222939044b76d3a99d36666c1c47203c104cc" dependencies = [ "cc", "lazy_static", @@ -1696,9 +1696,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47aa80447ce4daf1717500037052af176af5d38cc3e571d9ec1c7353fc10c87d" +checksum = "864d3e96a899863136fc6e99f3d7cae289dafe43bf2c5ac19b70df7210c0a145" dependencies = [ "proc-macro2", ] @@ -2063,9 +2063,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" +checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" dependencies = [ "serde_derive", ] @@ -2091,9 +2091,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.133" +version = "1.0.136" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" +checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9" dependencies = [ "proc-macro2", "quote", @@ -2102,9 +2102,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.75" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c059c05b48c5c0067d4b4b2b4f0732dd65feb52daf7e0ea09cd87e7dadc1af79" +checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" dependencies = [ "itoa 1.0.1", "ryu", @@ -2283,9 +2283,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.85" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a684ac3dcd8913827e18cd09a68384ee66c1de24157e3c556c9ab16d85695fb7" +checksum = "8a65b3f4ffa0092e9887669db0eae07941f023991ab58ea44da8fe8e2d511c6b" dependencies = [ "proc-macro2", "quote", @@ -2418,9 +2418,9 @@ dependencies = [ [[package]] name = "thread_local" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd" +checksum = "5516c27b78311c50bf42c071425c560ac799b11c30b31f87e3081965fe5e0180" dependencies = [ "once_cell", ] @@ -2517,9 +2517,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77be66445c4eeebb934a7340f227bfe7b338173d3f8c00a60a5a58005c9faecf" +checksum = "5312f325fe3588e277415f5a6cca1f4ccad0f248c4cd5a4bd33032d7286abc22" dependencies = [ "lazy_static", "matchers", @@ -3081,7 +3081,7 @@ dependencies = [ "wasmer-object", "wasmer-types", "wasmer-vm", - "which 4.2.2", + "which 4.2.4", ] [[package]] @@ -3446,9 +3446,9 @@ dependencies = [ [[package]] name = "which" -version = "4.2.2" +version = "4.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +checksum = "2a5a7e487e921cf220206864a94a89b6c6905bfc19f1057fa26a4cb360e5c1d2" dependencies = [ "either", "lazy_static",