Merge branch 'master' into feature/reference-types

This commit is contained in:
Mark McCaskey
2021-03-23 09:42:34 -07:00
97 changed files with 1111 additions and 178 deletions

View File

@@ -22,6 +22,7 @@ libc = { version = "^0.2", default-features = false }
byteorder = "1"
itertools = "0.10"
rayon = "1.5"
loupe = "0.1"
[dependencies.inkwell]
version = "=0.1.0-beta.2"

View File

@@ -7,6 +7,7 @@ use inkwell::memory_buffer::MemoryBuffer;
use inkwell::module::{Linkage, Module};
use inkwell::targets::FileType;
use inkwell::DLLStorageClass;
use loupe::MemoryUsage;
use rayon::iter::ParallelBridge;
use rayon::prelude::{IntoParallelIterator, IntoParallelRefIterator, ParallelIterator};
use std::sync::Arc;
@@ -22,6 +23,7 @@ use wasmer_types::{FunctionIndex, LocalFunctionIndex, SignatureIndex};
/// A compiler that compiles a WebAssembly module with LLVM, translating the Wasm to LLVM IR,
/// optimizing it and then translating to assembly.
#[derive(MemoryUsage)]
pub struct LLVMCompiler {
config: LLVM,
}

View File

@@ -5,6 +5,7 @@ use inkwell::targets::{
};
pub use inkwell::OptimizationLevel as LLVMOptLevel;
use itertools::Itertools;
use loupe::MemoryUsage;
use std::fmt::Debug;
use std::sync::Arc;
use target_lexicon::Architecture;
@@ -37,12 +38,14 @@ pub trait LLVMCallbacks: Debug + Send + Sync {
fn obj_memory_buffer(&self, function: &CompiledKind, memory_buffer: &InkwellMemoryBuffer);
}
#[derive(Debug, Clone)]
#[derive(Debug, Clone, MemoryUsage)]
pub struct LLVM {
pub(crate) enable_nan_canonicalization: bool,
pub(crate) enable_verifier: bool,
#[loupe(skip)]
pub(crate) opt_level: LLVMOptLevel,
is_pic: bool,
#[loupe(skip)]
pub(crate) callbacks: Option<Arc<dyn LLVMCallbacks>>,
/// The middleware chain.
pub(crate) middlewares: Vec<Arc<dyn ModuleMiddleware>>,