Fixed linting

This commit is contained in:
Syrus
2020-06-18 13:08:44 -07:00
parent 5273fa0cae
commit e604d6db49
15 changed files with 24 additions and 50 deletions

View File

@@ -8,7 +8,7 @@ use thiserror::Error;
use wasmer_compiler::CompileError; use wasmer_compiler::CompileError;
#[cfg(feature = "wat")] #[cfg(feature = "wat")]
use wasmer_compiler::WasmError; use wasmer_compiler::WasmError;
use wasmer_engine::{Artifact, DeserializeError, Resolver, SerializeError, Tunables as _}; use wasmer_engine::{Artifact, DeserializeError, Resolver, SerializeError};
use wasmer_runtime::{ExportsIterator, ImportsIterator, InstanceHandle, ModuleInfo}; use wasmer_runtime::{ExportsIterator, ImportsIterator, InstanceHandle, ModuleInfo};
#[derive(Error, Debug)] #[derive(Error, Debug)]

View File

@@ -4,7 +4,7 @@ use crate::{MemoryType, Pages, TableType};
use more_asserts::assert_ge; use more_asserts::assert_ge;
use std::cmp::min; use std::cmp::min;
use std::sync::Arc; use std::sync::Arc;
use target_lexicon::{OperatingSystem, PointerWidth, Triple, HOST}; use target_lexicon::{OperatingSystem, PointerWidth};
use wasmer_compiler::Target; use wasmer_compiler::Target;
use wasmer_engine::Tunables as BaseTunables; use wasmer_engine::Tunables as BaseTunables;
use wasmer_runtime::MemoryError; use wasmer_runtime::MemoryError;

View File

@@ -7,15 +7,13 @@ use std::ptr::{self, NonNull};
use std::slice; use std::slice;
use std::sync::Arc; use std::sync::Arc;
#[cfg(feature = "engine")]
use wasmer::Tunables;
use wasmer::{ use wasmer::{
Engine, ExportType, Extern, ExternType, Features, Function, FunctionType, Global, GlobalType, Engine, ExportType, Extern, ExternType, Function, FunctionType, Global, GlobalType, Instance,
Instance, Memory, MemoryType, Module, Mutability, OrderedResolver, Pages, RuntimeError, Store, Memory, MemoryType, Module, Mutability, OrderedResolver, Pages, RuntimeError, Store, Table,
Table, TableType, Val, ValType, TableType, Val, ValType,
}; };
#[cfg(feature = "jit")] #[cfg(feature = "jit")]
use wasmer_engine_jit::JITEngine; use wasmer_engine_jit::JIT;
use crate::error::update_last_error; use crate::error::update_last_error;
@@ -48,7 +46,7 @@ pub extern "C" fn wasm_config_new() -> *mut wasm_config_t {
#[repr(C)] #[repr(C)]
pub struct wasm_engine_t { pub struct wasm_engine_t {
pub(crate) inner: Box<dyn Engine + Send + Sync>, pub(crate) inner: Arc<dyn Engine + Send + Sync>,
} }
cfg_if! { cfg_if! {
@@ -72,9 +70,7 @@ cfg_if! {
#[no_mangle] #[no_mangle]
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> { pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
let compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config(); let compiler_config: Box<dyn CompilerConfig> = get_default_compiler_config();
let tunables = Tunables::default(); let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::new(&*compiler_config).engine());
let features = Features::default();
let engine: Box<dyn Engine + Send + Sync> = Box::new(JITEngine::new(compiler_config, tunables, features));
Box::new(wasm_engine_t { inner: engine }) Box::new(wasm_engine_t { inner: engine })
} }
} }
@@ -82,8 +78,7 @@ cfg_if! {
// Headless JIT // Headless JIT
#[no_mangle] #[no_mangle]
pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> { pub extern "C" fn wasm_engine_new() -> Box<wasm_engine_t> {
let tunables = Tunables::default(); let engine: Arc<dyn Engine + Send + Sync> = Arc::new(JIT::headless().engine());
let engine: Box<dyn Engine + Send + Sync> = Arc::new(JITEngine::headless(tunables));
Box::new(wasm_engine_t { inner: engine }) Box::new(wasm_engine_t { inner: engine })
} }
} }

View File

@@ -15,16 +15,14 @@ use crate::translator::{
}; };
use cranelift_codegen::ir; use cranelift_codegen::ir;
use cranelift_codegen::print_errors::pretty_error; use cranelift_codegen::print_errors::pretty_error;
use cranelift_codegen::{binemit, isa, Context}; use cranelift_codegen::{binemit, Context};
#[cfg(feature = "unwind")] #[cfg(feature = "unwind")]
use gimli::write::{Address, EhFrame, FrameTable}; use gimli::write::{Address, EhFrame, FrameTable};
use rayon::prelude::{IntoParallelRefIterator, ParallelIterator}; use rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use wasm_common::entity::{EntityRef, PrimaryMap}; use wasm_common::entity::{EntityRef, PrimaryMap};
use wasm_common::{ use wasm_common::{FunctionIndex, LocalFunctionIndex, SignatureIndex};
Features, FunctionIndex, LocalFunctionIndex, MemoryIndex, SignatureIndex, TableIndex,
};
use wasmer_compiler::CompileError; use wasmer_compiler::CompileError;
use wasmer_compiler::{CallingConvention, CompilerConfig, ModuleTranslationState, Target}; use wasmer_compiler::{CallingConvention, ModuleTranslationState, Target};
use wasmer_compiler::{ use wasmer_compiler::{
Compilation, CompileModuleInfo, CompiledFunction, CompiledFunctionFrameInfo, Compilation, CompileModuleInfo, CompiledFunction, CompiledFunctionFrameInfo,
CompiledFunctionUnwindInfo, Compiler, Dwarf, FunctionBody, FunctionBodyData, SectionIndex, CompiledFunctionUnwindInfo, Compiler, Dwarf, FunctionBody, FunctionBodyData, SectionIndex,

View File

@@ -46,7 +46,7 @@ impl Compiler for SinglepassCompiler {
/// associated relocations. /// associated relocations.
fn compile_module( fn compile_module(
&self, &self,
target: &Target, _target: &Target,
compile_info: &CompileModuleInfo, compile_info: &CompileModuleInfo,
_module_translation: &ModuleTranslationState, _module_translation: &ModuleTranslationState,
function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'_>>, function_body_inputs: PrimaryMap<LocalFunctionIndex, FunctionBodyData<'_>>,

View File

@@ -59,7 +59,7 @@ impl CompilerConfig for Singlepass {
} }
/// Gets the default features for this compiler in the given target /// Gets the default features for this compiler in the given target
fn default_features_for_target(&self, target: &Target) -> Features { fn default_features_for_target(&self, _target: &Target) -> Features {
let mut features = Features::default(); let mut features = Features::default();
features.multi_value(false); features.multi_value(false);
features features

View File

@@ -11,9 +11,7 @@ use crate::translator::FunctionMiddlewareGenerator;
use crate::FunctionBodyData; use crate::FunctionBodyData;
use crate::ModuleTranslationState; use crate::ModuleTranslationState;
use wasm_common::entity::PrimaryMap; use wasm_common::entity::PrimaryMap;
use wasm_common::{Features, LocalFunctionIndex, MemoryIndex, TableIndex}; use wasm_common::{Features, LocalFunctionIndex};
use wasmer_runtime::ModuleInfo;
use wasmer_runtime::{MemoryPlan, TablePlan};
use wasmparser::{validate, OperatorValidatorConfig, ValidatingParserConfig}; use wasmparser::{validate, OperatorValidatorConfig, ValidatingParserConfig};
/// The compiler configuration options. /// The compiler configuration options.

View File

@@ -1,6 +1,5 @@
use crate::JITEngine; use crate::JITEngine;
use std::sync::Arc; use wasmer_compiler::{CompilerConfig, Features, Target};
use wasmer_compiler::{Compiler, CompilerConfig, Features, Target};
/// The JIT builder /// The JIT builder
pub struct JIT<'a> { pub struct JIT<'a> {

View File

@@ -7,11 +7,11 @@ use std::sync::{Arc, Mutex};
use wasm_common::entity::PrimaryMap; use wasm_common::entity::PrimaryMap;
use wasm_common::Features; use wasm_common::Features;
use wasm_common::{FunctionIndex, FunctionType, LocalFunctionIndex, SignatureIndex}; use wasm_common::{FunctionIndex, FunctionType, LocalFunctionIndex, SignatureIndex};
#[cfg(feature = "compiler")]
use wasmer_compiler::Compiler;
use wasmer_compiler::{ use wasmer_compiler::{
CompileError, CustomSection, CustomSectionProtection, FunctionBody, SectionIndex, Target, CompileError, CustomSection, CustomSectionProtection, FunctionBody, SectionIndex, Target,
}; };
#[cfg(feature = "compiler")]
use wasmer_compiler::{Compiler, CompilerConfig};
use wasmer_engine::{Artifact, DeserializeError, Engine, EngineId, Tunables}; use wasmer_engine::{Artifact, DeserializeError, Engine, EngineId, Tunables};
use wasmer_runtime::{ use wasmer_runtime::{
ModuleInfo, SignatureRegistry, VMFunctionBody, VMSharedSignatureIndex, VMTrampoline, ModuleInfo, SignatureRegistry, VMFunctionBody, VMSharedSignatureIndex, VMTrampoline,

View File

@@ -1,17 +1,11 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::Arc;
use wasm_common::entity::PrimaryMap; use wasm_common::entity::PrimaryMap;
use wasm_common::{ use wasm_common::{FunctionIndex, LocalFunctionIndex, OwnedDataInitializer, SignatureIndex};
Features, FunctionIndex, LocalFunctionIndex, MemoryIndex, OwnedDataInitializer, SignatureIndex,
TableIndex,
};
use wasmer_compiler::{ use wasmer_compiler::{
CompileModuleInfo, CustomSection, Dwarf, FunctionBody, JumpTableOffsets, Relocation, CompileModuleInfo, CustomSection, Dwarf, FunctionBody, JumpTableOffsets, Relocation,
SectionIndex, SectionIndex,
}; };
use wasmer_engine::SerializableFunctionFrameInfo; use wasmer_engine::SerializableFunctionFrameInfo;
use wasmer_runtime::ModuleInfo;
use wasmer_runtime::{MemoryPlan, TablePlan};
// /// The serializable function data // /// The serializable function data
// #[derive(Serialize, Deserialize)] // #[derive(Serialize, Deserialize)]

View File

@@ -1,11 +1,9 @@
use crate::NativeEngine; use crate::NativeEngine;
use std::sync::Arc; use wasmer_compiler::{CompilerConfig, Features, Target};
use wasmer_compiler::{Compiler, CompilerConfig, Features, Target};
use wasmer_engine::Tunables;
/// The Native builder /// The Native builder
pub struct Native<'a> { pub struct Native<'a> {
compiler_config: Option<&'a CompilerConfig>, compiler_config: Option<&'a dyn CompilerConfig>,
target: Option<Target>, target: Option<Target>,
features: Option<Features>, features: Option<Features>,
} }

View File

@@ -6,9 +6,9 @@ use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
use std::sync::Mutex; use std::sync::Mutex;
use wasm_common::{Features, FunctionType}; use wasm_common::{Features, FunctionType};
use wasmer_compiler::{CompileError, Target};
#[cfg(feature = "compiler")] #[cfg(feature = "compiler")]
use wasmer_compiler::{Compiler, CompilerConfig}; use wasmer_compiler::Compiler;
use wasmer_compiler::{CompileError, Target};
use wasmer_engine::{Artifact, DeserializeError, Engine, EngineId, Tunables}; use wasmer_engine::{Artifact, DeserializeError, Engine, EngineId, Tunables};
use wasmer_runtime::{SignatureRegistry, VMSharedSignatureIndex, VMTrampoline}; use wasmer_runtime::{SignatureRegistry, VMSharedSignatureIndex, VMTrampoline};

View File

@@ -1,13 +1,7 @@
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::sync::Arc;
use wasm_common::entity::{EntityRef, PrimaryMap}; use wasm_common::entity::{EntityRef, PrimaryMap};
use wasm_common::{ use wasm_common::{FunctionIndex, LocalFunctionIndex, OwnedDataInitializer, SignatureIndex};
Features, FunctionIndex, LocalFunctionIndex, MemoryIndex, OwnedDataInitializer, SignatureIndex,
TableIndex,
};
use wasmer_compiler::{CompileModuleInfo, SectionIndex}; use wasmer_compiler::{CompileModuleInfo, SectionIndex};
use wasmer_runtime::ModuleInfo;
use wasmer_runtime::{MemoryPlan, TablePlan};
/// Serializable struct that represents the compiled metadata. /// Serializable struct that represents the compiled metadata.
#[derive(Serialize, Deserialize, Debug)] #[derive(Serialize, Deserialize, Debug)]

View File

@@ -5,7 +5,6 @@ use wasm_common::{
LocalGlobalIndex, LocalMemoryIndex, LocalTableIndex, MemoryIndex, MemoryType, TableIndex, LocalGlobalIndex, LocalMemoryIndex, LocalTableIndex, MemoryIndex, MemoryType, TableIndex,
TableType, TableType,
}; };
use wasmer_compiler::Target;
use wasmer_runtime::MemoryError; use wasmer_runtime::MemoryError;
use wasmer_runtime::{Memory, ModuleInfo, Table, VMGlobalDefinition}; use wasmer_runtime::{Memory, ModuleInfo, Table, VMGlobalDefinition};
use wasmer_runtime::{MemoryPlan, TablePlan}; use wasmer_runtime::{MemoryPlan, TablePlan};

View File

@@ -5,7 +5,6 @@ use crate::warning;
use anyhow::{anyhow, Context, Result}; use anyhow::{anyhow, Context, Result};
use std::path::PathBuf; use std::path::PathBuf;
use std::str::FromStr; use std::str::FromStr;
use std::sync::Arc;
use wasmer::*; use wasmer::*;
#[cfg(feature = "cache")] #[cfg(feature = "cache")]
use wasmer_cache::{Cache, FileSystemCache, WasmHash}; use wasmer_cache::{Cache, FileSystemCache, WasmHash};