Merge remote-tracking branch 'origin/master' into derive

# Conflicts:
#	Cargo.toml
#	wasmi/tests/spec/testsuite
This commit is contained in:
Sergey Pepyakin 2019-01-25 13:07:37 +01:00
commit 05027e617e
6 changed files with 13 additions and 6 deletions

View File

@ -22,7 +22,7 @@ derive = ["wasmi-derive"]
[dependencies] [dependencies]
parity-wasm = { version = "0.31", default-features = false } parity-wasm = { version = "0.31", default-features = false }
byteorder = { version = "1.0", 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" memory_units = "0.3.0"
libm = { version = "0.1.2", optional = true } libm = { version = "0.1.2", optional = true }
wasmi-derive = { version = "0.1", path = "../derive", optional = true } wasmi-derive = { version = "0.1", path = "../derive", optional = true }

View File

@ -2,7 +2,7 @@
use alloc::prelude::*; use alloc::prelude::*;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
use hashmap_core::HashMap; use hashbrown::HashMap;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use std::collections::HashMap; use std::collections::HashMap;

View File

@ -117,7 +117,7 @@ extern crate assert_matches;
extern crate byteorder; extern crate byteorder;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
extern crate hashmap_core; extern crate hashbrown;
extern crate memory_units as memory_units_crate; extern crate memory_units as memory_units_crate;
extern crate parity_wasm; extern crate parity_wasm;

View File

@ -184,7 +184,7 @@ impl MemoryInstance {
} }
/// Returns current used memory size in bytes. /// 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 { pub fn used_size(&self) -> Bytes {
Bytes(self.buffer.borrow().len()) Bytes(self.buffer.borrow().len())
} }

View File

@ -6,11 +6,12 @@ use core::fmt;
use Trap; use Trap;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
use hashmap_core::HashMap; use hashbrown::HashMap;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use std::collections::HashMap; use std::collections::HashMap;
use common::{DEFAULT_MEMORY_INDEX, DEFAULT_TABLE_INDEX}; use common::{DEFAULT_MEMORY_INDEX, DEFAULT_TABLE_INDEX};
use core::cell::Ref;
use func::{FuncBody, FuncInstance, FuncRef}; use func::{FuncBody, FuncInstance, FuncRef};
use global::{GlobalInstance, GlobalRef}; use global::{GlobalInstance, GlobalRef};
use host::Externals; use host::Externals;
@ -215,6 +216,12 @@ impl ModuleInstance {
self.globals.borrow_mut().push(global) 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<Vec<GlobalRef>> {
self.globals.borrow()
}
fn insert_export<N: Into<String>>(&self, name: N, extern_val: ExternVal) { fn insert_export<N: Into<String>>(&self, name: N, extern_val: ExternVal) {
self.exports.borrow_mut().insert(name.into(), extern_val); self.exports.borrow_mut().insert(name.into(), extern_val);
} }

View File

@ -5,7 +5,7 @@ use core::fmt;
use std::error; use std::error;
#[cfg(not(feature = "std"))] #[cfg(not(feature = "std"))]
use hashmap_core::HashSet; use hashbrown::HashSet;
#[cfg(feature = "std")] #[cfg(feature = "std")]
use std::collections::HashSet; use std::collections::HashSet;