From 073e4e7f1f4ce1acc4888b5da5887a5b3189af3e Mon Sep 17 00:00:00 2001 From: Arkadiy Paronyan Date: Tue, 8 Jan 2019 18:16:49 +0300 Subject: [PATCH 1/3] Fixed documentation for used_size (#156) --- src/memory.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/memory.rs b/src/memory.rs index 63c60b9..62e51b6 100644 --- a/src/memory.rs +++ b/src/memory.rs @@ -184,7 +184,7 @@ impl MemoryInstance { } /// Returns current used memory size in bytes. - /// This is the highest memory address that had been written to. + /// This is one more than the highest memory address that had been written to. pub fn used_size(&self) -> Bytes { Bytes(self.buffer.borrow().len()) } From ad14d82bcec2f6ed26d7e018f926b780d10def8b Mon Sep 17 00:00:00 2001 From: Leonardo Yvens Date: Thu, 17 Jan 2019 21:27:56 -0200 Subject: [PATCH 2/3] Expose globals to host (#158) * Make `global_by_index` pub, add `globals` getter * simplify access to globals --- src/module.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/module.rs b/src/module.rs index e755c4b..bbce6de 100644 --- a/src/module.rs +++ b/src/module.rs @@ -11,6 +11,7 @@ use hashmap_core::HashMap; use std::collections::HashMap; use common::{DEFAULT_MEMORY_INDEX, DEFAULT_TABLE_INDEX}; +use core::cell::Ref; use func::{FuncBody, FuncInstance, FuncRef}; use global::{GlobalInstance, GlobalRef}; use host::Externals; @@ -215,6 +216,12 @@ impl ModuleInstance { self.globals.borrow_mut().push(global) } + /// Access all globals. This is a non-standard API so it's unlikely to be + /// portable to other engines. + pub fn globals<'a>(&self) -> Ref> { + self.globals.borrow() + } + fn insert_export>(&self, name: N, extern_val: ExternVal) { self.exports.borrow_mut().insert(name.into(), extern_val); } From 23b054c0e5139f0266b6189deb4279749b8058d5 Mon Sep 17 00:00:00 2001 From: Elichai Turkel Date: Sun, 20 Jan 2019 18:59:26 +0200 Subject: [PATCH 3/3] Replaced hashmap_core with hashbrown (#161) --- Cargo.toml | 6 +++--- src/imports.rs | 2 +- src/lib.rs | 2 +- src/module.rs | 2 +- src/validation/mod.rs | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8681c3d..e9c291a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,13 +15,13 @@ default = ["std"] # Disable for no_std support std = ["parity-wasm/std", "byteorder/std"] # Enable for no_std support -# hashmap_core only works on no_std -core = ["hashmap_core", "libm"] +# hashbrown only works on no_std +core = ["hashbrown", "libm"] [dependencies] parity-wasm = { version = "0.31", default-features = false } byteorder = { version = "1.0", default-features = false } -hashmap_core = { version = "0.1.9", optional = true } +hashbrown = { version = "0.1.8", optional = true } memory_units = "0.3.0" libm = { version = "0.1.2", optional = true } diff --git a/src/imports.rs b/src/imports.rs index c0c7852..44866a7 100644 --- a/src/imports.rs +++ b/src/imports.rs @@ -2,7 +2,7 @@ use alloc::prelude::*; #[cfg(not(feature = "std"))] -use hashmap_core::HashMap; +use hashbrown::HashMap; #[cfg(feature = "std")] use std::collections::HashMap; diff --git a/src/lib.rs b/src/lib.rs index f92c4d3..342b0a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -117,7 +117,7 @@ extern crate assert_matches; extern crate byteorder; #[cfg(not(feature = "std"))] -extern crate hashmap_core; +extern crate hashbrown; extern crate memory_units as memory_units_crate; extern crate parity_wasm; diff --git a/src/module.rs b/src/module.rs index bbce6de..eff2151 100644 --- a/src/module.rs +++ b/src/module.rs @@ -6,7 +6,7 @@ use core::fmt; use Trap; #[cfg(not(feature = "std"))] -use hashmap_core::HashMap; +use hashbrown::HashMap; #[cfg(feature = "std")] use std::collections::HashMap; diff --git a/src/validation/mod.rs b/src/validation/mod.rs index 40f9edc..01b583a 100644 --- a/src/validation/mod.rs +++ b/src/validation/mod.rs @@ -5,7 +5,7 @@ use core::fmt; use std::error; #[cfg(not(feature = "std"))] -use hashmap_core::HashSet; +use hashbrown::HashSet; #[cfg(feature = "std")] use std::collections::HashSet;