Merge branch 'master' into deterministic

This commit is contained in:
Mark McCaskey
2019-12-05 11:50:16 -08:00
committed by GitHub
189 changed files with 14826 additions and 4724 deletions

View File

@ -1,3 +1,7 @@
//! The cache module provides the common data structures used by compiler backends to allow
//! serializing compiled wasm code to a binary format. The binary format can be persisted,
//! and loaded to allow skipping compilation and fast startup.
use crate::Module;
use memmap::Mmap;
use std::{
@ -125,7 +129,7 @@ impl Cache for FileSystemCache {
}
}
#[cfg(all(test, not(feature = "singlepass")))]
#[cfg(test)]
mod tests {
use super::*;

View File

@ -1,5 +1,6 @@
#![deny(
dead_code,
missing_docs,
nonstandard_style,
unused_imports,
unused_mut,
@ -86,12 +87,13 @@
//! [`wasmer-clif-backend`]: https://crates.io/crates/wasmer-clif-backend
//! [`compile_with`]: fn.compile_with.html
pub use wasmer_runtime_core::backend::Backend;
pub use wasmer_runtime_core::backend::{Backend, Features};
pub use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler};
pub use wasmer_runtime_core::export::Export;
pub use wasmer_runtime_core::global::Global;
pub use wasmer_runtime_core::import::ImportObject;
pub use wasmer_runtime_core::import::{ImportObject, LikeNamespace};
pub use wasmer_runtime_core::instance::{DynFunc, Instance};
pub use wasmer_runtime_core::memory::ptr::{Array, Item, WasmPtr};
pub use wasmer_runtime_core::memory::Memory;
pub use wasmer_runtime_core::module::Module;
pub use wasmer_runtime_core::table::Table;
@ -103,6 +105,8 @@ pub use wasmer_runtime_core::{compile_with, validate};
pub use wasmer_runtime_core::{func, imports};
pub mod memory {
//! The memory module contains the implementation data structures and helper functions used to
//! manipulate and access wasm memory.
pub use wasmer_runtime_core::memory::{Atomically, Memory, MemoryView};
}
@ -116,6 +120,8 @@ pub mod wasm {
}
pub mod error {
//! The error module contains the data structures and helper functions used to implement errors that
//! are produced and returned from the wasmer runtime.
pub use wasmer_runtime_core::cache::Error as CacheError;
pub use wasmer_runtime_core::error::*;
}
@ -125,9 +131,14 @@ pub mod units {
pub use wasmer_runtime_core::units::{Bytes, Pages};
}
pub mod types {
//! Various types.
pub use wasmer_runtime_core::types::*;
}
pub mod cache;
use wasmer_runtime_core::backend::{Compiler, CompilerConfig};
pub use wasmer_runtime_core::backend::{Compiler, CompilerConfig};
/// Compile WebAssembly binary code into a [`Module`].
/// This function is useful if it is necessary to
@ -197,6 +208,7 @@ pub fn default_compiler() -> impl Compiler {
#[cfg(any(
all(
feature = "default-backend-llvm",
not(feature = "docs"),
any(
feature = "default-backend-cranelift",
feature = "default-backend-singlepass",
@ -204,6 +216,7 @@ pub fn default_compiler() -> impl Compiler {
)
),
all(
not(feature = "docs"),
feature = "default-backend-cranelift",
any(
feature = "default-backend-singlepass",
@ -219,16 +232,16 @@ pub fn default_compiler() -> impl Compiler {
"The `default-backend-X` features are mutually exclusive. Please choose just one"
);
#[cfg(feature = "default-backend-llvm")]
#[cfg(all(feature = "default-backend-llvm", not(feature = "docs")))]
use wasmer_llvm_backend::LLVMCompiler as DefaultCompiler;
#[cfg(any(
#[cfg(all(any(
feature = "default-backend-singlepass",
feature = "deterministic-execution"
))]
all(feature = "deterministic-execution", feature = "singlepass")
), not(feature = "docs")))]
use wasmer_singlepass_backend::SinglePassCompiler as DefaultCompiler;
#[cfg(feature = "default-backend-cranelift")]
#[cfg(any(feature = "default-backend-cranelift", feature = "docs"))]
use wasmer_clif_backend::CraneliftCompiler as DefaultCompiler;
DefaultCompiler::new()
@ -252,12 +265,11 @@ pub fn compiler_for_backend(backend: Backend) -> Option<Box<dyn Compiler>> {
#[cfg(feature = "llvm")]
Backend::LLVM => Some(Box::new(wasmer_llvm_backend::LLVMCompiler::new())),
#[cfg(any(
not(feature = "llvm"),
not(feature = "singlepass"),
not(feature = "cranelift"),
not(feature = "deterministic-execution"),
))]
#[cfg(not(all(
feature = "llvm",
any(feature = "singlepass", feature = "deterministic-execution"),
feature = "cranelift",
)))]
_ => None,
}
}