Merge branch 'feature/vm_refactor' into feature/vm_refactor_errors

This commit is contained in:
Lachlan Sneff
2019-01-18 09:20:55 -08:00
committed by GitHub
39 changed files with 1809 additions and 1387 deletions

View File

@ -142,6 +142,7 @@ impl LocalBacking {
tables.into_boxed_map()
}
#[allow(clippy::cast_ptr_alignment)]
fn finalize_tables(
module: &ModuleInner,
imports: &ImportBacking,

View File

@ -25,7 +25,7 @@ pub(crate) struct InstanceInner {
}
pub struct Instance {
pub(crate) module: Rc<ModuleInner>,
pub module: Rc<ModuleInner>,
inner: Box<InstanceInner>,
#[allow(dead_code)]
imports: Box<Imports>,
@ -351,7 +351,7 @@ impl Namespace for Instance {
// TODO Remove this later, only needed for compilation till emscripten is updated
impl Instance {
pub fn memory_offset_addr(&self, _index: usize, _offset: usize) -> *const usize {
unimplemented!("TODO replace this emscripten stub")
pub fn memory_offset_addr(&self, index: usize, offset: usize) -> *const u8 {
unimplemented!()
}
}

View File

@ -3,14 +3,14 @@
extern crate field_offset;
#[macro_use]
mod macros;
pub mod macros;
#[doc(hidden)]
pub mod backend;
mod backing;
pub mod error;
pub mod export;
pub mod import;
mod instance;
pub mod instance;
pub mod memory;
mod mmap;
pub mod module;

View File

@ -1,3 +1,4 @@
#[macro_export]
macro_rules! debug {
($fmt:expr) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt), line!()) });
($fmt:expr, $($arg:tt)*) => (if cfg!(any(debug_assertions, feature="debug")) { println!(concat!("wasmer-runtime(:{})::", $fmt, "\n"), line!(), $($arg)*) });

View File

@ -40,7 +40,7 @@ pub struct ModuleInner {
pub sig_registry: SigRegistry,
}
pub struct Module(Rc<ModuleInner>);
pub struct Module(pub Rc<ModuleInner>);
impl Module {
pub(crate) fn new(inner: Rc<ModuleInner>) -> Self {

View File

@ -84,6 +84,7 @@ impl Ctx {
}
}
#[allow(clippy::erasing_op)] // TODO
pub fn offset_memories() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -131,6 +132,7 @@ pub struct ImportedFunc {
}
impl ImportedFunc {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_func() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -157,6 +159,7 @@ pub struct LocalTable {
}
impl LocalTable {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_base() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -180,6 +183,7 @@ pub struct ImportedTable {
}
impl ImportedTable {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_table() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -206,6 +210,7 @@ pub struct LocalMemory {
}
impl LocalMemory {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_base() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -228,6 +233,7 @@ pub struct ImportedMemory {
}
impl ImportedMemory {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_memory() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -249,6 +255,7 @@ pub struct LocalGlobal {
}
impl LocalGlobal {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_data() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -269,6 +276,7 @@ pub struct ImportedGlobal {
}
impl ImportedGlobal {
#[allow(clippy::erasing_op)] // TODO
pub fn offset_global() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}
@ -301,6 +309,7 @@ impl Anyfunc {
}
}
#[allow(clippy::erasing_op)] // TODO
pub fn offset_func() -> u8 {
0 * (mem::size_of::<usize>() as u8)
}