From c660aa9fce1a15b62d12ac59738c3d030a804b4f Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Tue, 17 Sep 2019 17:42:06 +0200 Subject: [PATCH 01/11] fix 653 panic in memoryDescriptor --- lib/emscripten/src/lib.rs | 6 +----- lib/runtime-core/src/memory/mod.rs | 2 +- lib/runtime-core/src/parse.rs | 23 +++++++++++++---------- lib/runtime-core/src/types.rs | 24 +++++++++++++++++++----- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/lib/emscripten/src/lib.rs b/lib/emscripten/src/lib.rs index ba25b4be8..0d30c0b0b 100644 --- a/lib/emscripten/src/lib.rs +++ b/lib/emscripten/src/lib.rs @@ -473,11 +473,7 @@ impl EmscriptenGlobals { let (memory_min, memory_max, shared) = get_emscripten_memory_size(&module)?; // Memory initialization - let memory_type = MemoryDescriptor { - minimum: memory_min, - maximum: memory_max, - shared: shared, - }; + let memory_type = MemoryDescriptor::new(memory_min, memory_max, shared)?; let memory = Memory::new(memory_type).unwrap(); let table_type = TableDescriptor { diff --git a/lib/runtime-core/src/memory/mod.rs b/lib/runtime-core/src/memory/mod.rs index 75e9ea007..6f6af5c65 100644 --- a/lib/runtime-core/src/memory/mod.rs +++ b/lib/runtime-core/src/memory/mod.rs @@ -177,7 +177,7 @@ impl fmt::Debug for Memory { } } -#[derive(Debug, Clone, Copy, PartialEq, Eq)] +#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq, Hash)] pub enum MemoryType { Dynamic, Static, diff --git a/lib/runtime-core/src/parse.rs b/lib/runtime-core/src/parse.rs index 259a628dd..9162c5169 100644 --- a/lib/runtime-core/src/parse.rs +++ b/lib/runtime-core/src/parse.rs @@ -136,11 +136,13 @@ pub fn read_module< .push((import_name, table_desc)); } ImportSectionEntryType::Memory(memory_ty) => { - let mem_desc = MemoryDescriptor { - minimum: Pages(memory_ty.limits.initial), - maximum: memory_ty.limits.maximum.map(|max| Pages(max)), - shared: memory_ty.shared, - }; + let mem_desc = MemoryDescriptor::new( + Pages(memory_ty.limits.initial), + memory_ty.limits.maximum.map(|max| Pages(max)), + memory_ty.shared, + ) + .map_err(|x| LoadError::Codegen(format!("{:?}", x)))?; + info.write() .unwrap() .imported_memories @@ -172,11 +174,12 @@ pub fn read_module< info.write().unwrap().tables.push(table_desc); } ParserState::MemorySectionEntry(memory_ty) => { - let mem_desc = MemoryDescriptor { - minimum: Pages(memory_ty.limits.initial), - maximum: memory_ty.limits.maximum.map(|max| Pages(max)), - shared: memory_ty.shared, - }; + let mem_desc = MemoryDescriptor::new( + Pages(memory_ty.limits.initial), + memory_ty.limits.maximum.map(|max| Pages(max)), + memory_ty.shared, + ) + .map_err(|x| LoadError::Codegen(format!("{:?}", x)))?; info.write().unwrap().memories.push(mem_desc); } diff --git a/lib/runtime-core/src/types.rs b/lib/runtime-core/src/types.rs index ab7c023a8..bea89ffe3 100644 --- a/lib/runtime-core/src/types.rs +++ b/lib/runtime-core/src/types.rs @@ -326,7 +326,7 @@ pub struct GlobalInit { pub init: Initializer, } -/// A wasm memory. +/// A wasm memory descriptor. #[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)] pub struct MemoryDescriptor { /// The minimum number of allowed pages. @@ -335,16 +335,30 @@ pub struct MemoryDescriptor { pub maximum: Option, /// This memory can be shared between wasm threads. pub shared: bool, + /// The type of the memory + pub memory_type: MemoryType, } impl MemoryDescriptor { - pub fn memory_type(self) -> MemoryType { - match (self.maximum.is_some(), self.shared) { + pub fn new(minimum: Pages, maximum: Option, shared: bool) -> Result { + let memory_type = match (maximum.is_some(), shared) { (true, true) => MemoryType::SharedStatic, (true, false) => MemoryType::Static, (false, false) => MemoryType::Dynamic, - (false, true) => panic!("shared memory without a max is not allowed"), - } + (false, true) => { + return Err("Max number of pages is required for shared memory".to_string()); + } + }; + Ok(MemoryDescriptor { + minimum, + maximum, + shared, + memory_type, + }) + } + + pub fn memory_type(&self) -> MemoryType { + self.memory_type } pub(crate) fn fits_in_imported(&self, imported: MemoryDescriptor) -> bool { From 374f81972a131fc41bcf1ccc1b94bdc9573971e6 Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Tue, 17 Sep 2019 17:46:36 +0200 Subject: [PATCH 02/11] remove panic from UnsharedMemory --- lib/runtime-core/src/memory/mod.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/runtime-core/src/memory/mod.rs b/lib/runtime-core/src/memory/mod.rs index 6f6af5c65..bc82d2f82 100644 --- a/lib/runtime-core/src/memory/mod.rs +++ b/lib/runtime-core/src/memory/mod.rs @@ -231,7 +231,11 @@ impl UnsharedMemory { MemoryType::Static => { UnsharedMemoryStorage::Static(StaticMemory::new(desc, &mut local)?) } - MemoryType::SharedStatic => panic!("attempting to create shared unshared memory"), + MemoryType::SharedStatic => { + return Err(CreationError::InvalidDescriptor( + "attempting to create shared unshared memory".to_string(), + )); + } }; Ok(Self { From ca409f78c564c10aa5382e23e59d370d5afc87eb Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Fri, 20 Sep 2019 18:54:05 +0200 Subject: [PATCH 03/11] fix spectest --- lib/spectests/examples/simple/main.rs | 8 ++------ lib/spectests/tests/spectest.rs | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/spectests/examples/simple/main.rs b/lib/spectests/examples/simple/main.rs index 357adb5f7..d7165fe0b 100644 --- a/lib/spectests/examples/simple/main.rs +++ b/lib/spectests/examples/simple/main.rs @@ -42,12 +42,8 @@ fn main() -> error::Result<()> { let inner_module = wasmer_runtime_core::compile_with(&wasm_binary, &get_compiler())?; - let memory = Memory::new(MemoryDescriptor { - minimum: Pages(1), - maximum: Some(Pages(1)), - shared: false, - }) - .unwrap(); + let memory_desc = MemoryDescriptor::new(Pages(1),Some(Pages(1)),false).unwrap(); + let memory = Memory::new(memory_desc).unwrap(); let global = Global::new(Value::I32(42)); diff --git a/lib/spectests/tests/spectest.rs b/lib/spectests/tests/spectest.rs index 9cd18d636..22bef6ff2 100644 --- a/lib/spectests/tests/spectest.rs +++ b/lib/spectests/tests/spectest.rs @@ -1056,12 +1056,8 @@ mod tests { fn get_spectest_import_object( registered_modules: &HashMap>, ) -> ImportObject { - let memory = Memory::new(MemoryDescriptor { - minimum: Pages(1), - maximum: Some(Pages(2)), - shared: false, - }) - .unwrap(); + let memory_desc = MemoryDescriptor::new(Pages(1),Some(Pages(2)),false).unwrap(); + let memory = Memory::new(memory_desc).unwrap(); let global_i32 = Global::new(wasmer_runtime_core::types::Value::I32(666)); let global_f32 = Global::new(wasmer_runtime_core::types::Value::F32(666.0)); From 7deed3160b1a49b5b8e5462ae2f5b9c0b0c8a9d6 Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Fri, 20 Sep 2019 18:59:36 +0200 Subject: [PATCH 04/11] cargo fmt --- lib/spectests/examples/simple/main.rs | 2 +- lib/spectests/tests/spectest.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/spectests/examples/simple/main.rs b/lib/spectests/examples/simple/main.rs index d7165fe0b..e9309c3c2 100644 --- a/lib/spectests/examples/simple/main.rs +++ b/lib/spectests/examples/simple/main.rs @@ -42,7 +42,7 @@ fn main() -> error::Result<()> { let inner_module = wasmer_runtime_core::compile_with(&wasm_binary, &get_compiler())?; - let memory_desc = MemoryDescriptor::new(Pages(1),Some(Pages(1)),false).unwrap(); + let memory_desc = MemoryDescriptor::new(Pages(1), Some(Pages(1)), false).unwrap(); let memory = Memory::new(memory_desc).unwrap(); let global = Global::new(Value::I32(42)); diff --git a/lib/spectests/tests/spectest.rs b/lib/spectests/tests/spectest.rs index 22bef6ff2..58f312398 100644 --- a/lib/spectests/tests/spectest.rs +++ b/lib/spectests/tests/spectest.rs @@ -1056,7 +1056,7 @@ mod tests { fn get_spectest_import_object( registered_modules: &HashMap>, ) -> ImportObject { - let memory_desc = MemoryDescriptor::new(Pages(1),Some(Pages(2)),false).unwrap(); + let memory_desc = MemoryDescriptor::new(Pages(1), Some(Pages(2)), false).unwrap(); let memory = Memory::new(memory_desc).unwrap(); let global_i32 = Global::new(wasmer_runtime_core::types::Value::I32(666)); From 5ace7a0af3f0cb1b5e91164b41b8c2ecb3f4d0b1 Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Mon, 23 Sep 2019 11:17:02 +0200 Subject: [PATCH 05/11] fix failing test --- lib/runtime-core/src/memory/mod.rs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/lib/runtime-core/src/memory/mod.rs b/lib/runtime-core/src/memory/mod.rs index bc82d2f82..e78c6af84 100644 --- a/lib/runtime-core/src/memory/mod.rs +++ b/lib/runtime-core/src/memory/mod.rs @@ -53,16 +53,12 @@ impl Memory { /// # use wasmer_runtime_core::memory::Memory; /// # use wasmer_runtime_core::error::Result; /// # use wasmer_runtime_core::units::Pages; - /// # fn create_memory() -> Result<()> { - /// let descriptor = MemoryDescriptor { - /// minimum: Pages(10), - /// maximum: None, - /// shared: false, - /// }; + /// fn create_memory() -> Result<()> { + /// let descriptor = MemoryDescriptor::new(Pages(10), None, false).unwrap(); /// - /// let memory = Memory::new(descriptor)?; - /// # Ok(()) - /// # } + /// let memory = Memory::new(descriptor)?; + /// Ok(()) + /// } /// ``` pub fn new(desc: MemoryDescriptor) -> Result { if let Some(max) = desc.maximum { @@ -346,24 +342,16 @@ mod memory_tests { #[test] fn test_initial_memory_size() { - let unshared_memory = Memory::new(MemoryDescriptor { - minimum: Pages(10), - maximum: Some(Pages(20)), - shared: false, - }) - .unwrap(); + let memory_desc = MemoryDescriptor::new(Pages(10), Some(Pages(20)), false).unwrap(); + let unshared_memory = Memory::new(memory_desc).unwrap(); assert_eq!(unshared_memory.size(), Pages(10)); } #[test] fn test_invalid_descriptor_returns_error() { - let result = Memory::new(MemoryDescriptor { - minimum: Pages(10), - maximum: None, - shared: true, - }); + let memory_desc = MemoryDescriptor::new(Pages(10), None, true); assert!( - result.is_err(), + memory_desc.is_err(), "Max number of pages is required for shared memory" ) } From ebb7618341b9bd39c8726ec9a0d80bcd749052ba Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2019 21:48:18 +0000 Subject: [PATCH 06/11] Bump serde_derive from 1.0.100 to 1.0.101 Bumps [serde_derive](https://github.com/serde-rs/serde) from 1.0.100 to 1.0.101. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.100...v1.0.101) Signed-off-by: dependabot-preview[bot] --- Cargo.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3d8c85a48..44934a87b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -157,7 +157,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -310,7 +310,7 @@ dependencies = [ "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1132,7 +1132,7 @@ name = "serde" version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1154,7 +1154,7 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1422,7 +1422,7 @@ version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "wabt-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1493,7 +1493,7 @@ dependencies = [ "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", "serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "target-lexicon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-clif-fork-frontend 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-clif-fork-wasm 0.33.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1656,7 +1656,7 @@ dependencies = [ "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", "serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)", "wasmparser 0.35.3 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1926,7 +1926,7 @@ dependencies = [ "checksum serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "f4473e8506b213730ff2061073b48fa51dcc66349219e2e7c5608f0296a1d95a" "checksum serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd" "checksum serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45af0182ff64abaeea290235eb67da3825a576c5d53e642c4d5b652e12e6effc" -"checksum serde_derive 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "11e410fde43e157d789fc290d26bc940778ad0fdd47836426fbac36573710dbb" +"checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e" "checksum serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)" = "051c49229f282f7c6f3813f8286cc1e3323e8051823fce42c7ea80fe13521704" "checksum shlex 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" From 2af031148777f688cde9c5bc7fac42c0664698a5 Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2019 22:13:04 +0000 Subject: [PATCH 07/11] Bump serde from 1.0.100 to 1.0.101 Bumps [serde](https://github.com/serde-rs/serde) from 1.0.100 to 1.0.101. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.100...v1.0.101) Signed-off-by: dependabot-preview[bot] --- Cargo.lock | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44934a87b..095bec64b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -70,7 +70,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "autocfg 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -118,7 +118,7 @@ dependencies = [ "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "regex-automata 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -156,7 +156,7 @@ name = "cargo_toml" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -175,7 +175,7 @@ dependencies = [ "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "quote 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "tempfile 3.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -309,7 +309,7 @@ dependencies = [ "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon-core 1.6.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -374,7 +374,7 @@ dependencies = [ "csv-core 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -457,7 +457,7 @@ name = "erased-serde" version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -528,7 +528,7 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -605,7 +605,7 @@ name = "indexmap" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1129,7 +1129,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "serde" -version = "1.0.100" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1141,7 +1141,7 @@ version = "0.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1149,7 +1149,7 @@ name = "serde_bytes" version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1169,7 +1169,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", "ryu 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1329,7 +1329,7 @@ name = "tinytemplate" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1338,7 +1338,7 @@ name = "toml" version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1346,7 +1346,7 @@ name = "toml" version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1362,7 +1362,7 @@ dependencies = [ "erased-serde 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", "inventory 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "typetag-impl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1421,7 +1421,7 @@ name = "wabt" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.40 (registry+https://github.com/rust-lang/crates.io-index)", "wabt-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1460,7 +1460,7 @@ dependencies = [ "errno 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "structopt 0.3.1 (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)", @@ -1490,7 +1490,7 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.15.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1653,7 +1653,7 @@ dependencies = [ "page_size 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", "serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1699,7 +1699,7 @@ dependencies = [ "libc 0.2.62 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)", - "serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)", + "serde 1.0.101 (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.7.0", @@ -1923,7 +1923,7 @@ dependencies = [ "checksum scroll_derive 0.9.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8f1aa96c45e7f5a91cb7fabe7b279f02fea7126239fc40b732316e8b6a2d0fcb" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" -"checksum serde 1.0.100 (registry+https://github.com/rust-lang/crates.io-index)" = "f4473e8506b213730ff2061073b48fa51dcc66349219e2e7c5608f0296a1d95a" +"checksum serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "9796c9b7ba2ffe7a9ce53c2287dfc48080f4b2b362fcc245a259b3a7201119dd" "checksum serde-bench 0.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "d733da87e79faaac25616e33d26299a41143fd4cd42746cbb0e91d8feea243fd" "checksum serde_bytes 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "45af0182ff64abaeea290235eb67da3825a576c5d53e642c4d5b652e12e6effc" "checksum serde_derive 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)" = "4b133a43a1ecd55d4086bd5b4dc6c1751c68b1bfbeba7a5040442022c7e7c02e" From 5fde93dcbd34c349597b1fc21290df25569dd98a Mon Sep 17 00:00:00 2001 From: "dependabot-preview[bot]" <27856297+dependabot-preview[bot]@users.noreply.github.com> Date: Mon, 23 Sep 2019 22:32:22 +0000 Subject: [PATCH 08/11] Bump structopt from 0.3.1 to 0.3.2 Bumps [structopt](https://github.com/TeXitoi/structopt) from 0.3.1 to 0.3.2. - [Release notes](https://github.com/TeXitoi/structopt/releases) - [Changelog](https://github.com/TeXitoi/structopt/blob/master/CHANGELOG.md) - [Commits](https://github.com/TeXitoi/structopt/compare/v0.3.1...v0.3.2) Signed-off-by: dependabot-preview[bot] --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 095bec64b..223ef76ac 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,16 +1194,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "structopt" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt-derive 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt-derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "structopt-derive" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1461,7 +1461,7 @@ dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.101 (registry+https://github.com/rust-lang/crates.io-index)", - "structopt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "structopt 0.3.2 (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.7.0", @@ -1932,8 +1932,8 @@ dependencies = [ "checksum smallvec 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ab606a9c5e214920bb66c458cd7be8ef094f813f20fe77a54cc7dbfff220d4b7" "checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8" "checksum strsim 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" -"checksum structopt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ac9d6e93dd792b217bf89cda5c14566e3043960c6f9da890c2ba5d09d07804c" -"checksum structopt-derive 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2ae9e5165d463a0dea76967d021f8d0f9316057bf5163aa2a4843790e842ff37" +"checksum structopt 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3fe8d3289b63ef2f196d89e7701f986583c0895e764b78f052a55b9b5d34d84a" +"checksum structopt-derive 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f3add731f5b4fb85931d362a3c92deb1ad7113649a8d51701fb257673705f122" "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 0.15.44 (registry+https://github.com/rust-lang/crates.io-index)" = "9ca4b3b69a77cbe1ffc9e198781b7acb0c7365a883670e8f1c1bc66fba79a5c5" "checksum syn 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "66850e97125af79138385e9b88339cbcd037e3f28ceab8c5ad98e64f0f1f80bf" From 91cd88fde60582e180259d6b7a50b5a9799476d3 Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Mon, 23 Sep 2019 16:33:29 -0700 Subject: [PATCH 09/11] Fix bench targets in makefile --- Makefile | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 905b54190..89210b9b0 100644 --- a/Makefile +++ b/Makefile @@ -140,11 +140,15 @@ install: # Checks check-bench-singlepass: - cargo bench --all --no-run --no-default-features --features "backend-singlepass" + cargo bench --all --no-run --no-default-features --features "backend-singlepass" \ + --exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader check-bench-clif: - cargo bench --all --no-run --no-default-features --features "backend-cranelift" + cargo bench --all --no-run --no-default-features --features "backend-cranelift" \ + --exclude wasmer-singlepass-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader \ + --exclude wasmer-middleware-common-tests check-bench-llvm: - cargo bench --all --no-run --no-default-features --features "backend-llvm" + cargo bench --all --no-run --no-default-features --features "backend-llvm" \ + --exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-kernel-loader check-bench: check-bench-singlepass check-bench-llvm @@ -168,11 +172,15 @@ release-llvm: cargo build --release --features backend-llvm bench-singlepass: - cargo bench --all --no-default-features --features "backend-singlepass" + cargo bench --all --no-default-features --features "backend-singlepass" \ + --exclude wasmer-clif-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader bench-clif: - cargo bench --all --no-default-features --features "backend-cranelift" + cargo bench --all --no-default-features --features "backend-cranelift" \ + --exclude wasmer-singlepass-backend --exclude wasmer-llvm-backend --exclude wasmer-kernel-loader \ + --exclude wasmer-middleware-common-tests bench-llvm: - cargo bench --all --no-default-features --features "backend-llvm" + cargo bench --all --no-default-features --features "backend-llvm" \ + --exclude wasmer-singlepass-backend --exclude wasmer-clif-backend --exclude wasmer-kernel-loader # Build utils build-install: From 57b8947d6adaf1be85c961a6ed360e0e67867b7c Mon Sep 17 00:00:00 2001 From: Mark McCaskey Date: Mon, 23 Sep 2019 16:53:53 -0700 Subject: [PATCH 10/11] Add bench fix to changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 20432fe83..d42122a61 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ Blocks of changes will separated by version increments. ## **[Unreleased]** +- [#829](https://github.com/wasmerio/wasmer/pull/829) Fix deps on `make bench-*` commands; benchmarks don't compile other backends now - [#807](https://github.com/wasmerio/wasmer/pull/807) Implement Send for `Instance`, breaking change on `ImportObject`, remove method `get_namespace` replaced with `with_namespace` and `maybe_with_namespace` - [#817](https://github.com/wasmerio/wasmer/pull/817) Add document for tracking features across backends and language integrations, [docs/feature_matrix.md] - [#823](https://github.com/wasmerio/wasmer/issues/823) Improved Emscripten / WASI integration From 79ff3709ccd6cf4c890c0d1b2ccf96c0e0c5b749 Mon Sep 17 00:00:00 2001 From: Patrick Ventuzelo Date: Tue, 24 Sep 2019 09:08:55 +0200 Subject: [PATCH 11/11] fix cargo check fail build --- lib/runtime-c-api/src/memory.rs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/runtime-c-api/src/memory.rs b/lib/runtime-c-api/src/memory.rs index 4628d8baa..21f14bbf7 100644 --- a/lib/runtime-c-api/src/memory.rs +++ b/lib/runtime-c-api/src/memory.rs @@ -1,6 +1,6 @@ //! Create, read, write, grow, destroy memory of an instance. -use crate::{error::update_last_error, wasmer_limits_t, wasmer_result_t}; +use crate::{error::update_last_error, error::CApiError, wasmer_limits_t, wasmer_result_t}; use std::cell::Cell; use wasmer_runtime::Memory; use wasmer_runtime_core::{ @@ -31,12 +31,17 @@ pub unsafe extern "C" fn wasmer_memory_new( } else { None }; - let desc = MemoryDescriptor { - minimum: Pages(limits.min), - maximum: max, - shared: false, + let desc = MemoryDescriptor::new(Pages(limits.min), max, false); + let new_desc = match desc { + Ok(desc) => desc, + Err(error) => { + update_last_error(CApiError { + msg: error.to_string(), + }); + return wasmer_result_t::WASMER_ERROR; + } }; - let result = Memory::new(desc); + let result = Memory::new(new_desc); let new_memory = match result { Ok(memory) => memory, Err(error) => {