Fix warnings.

This commit is contained in:
losfair
2019-03-17 10:54:50 +08:00
parent f8fe999015
commit d8d39c309c
6 changed files with 143 additions and 207 deletions

View File

@ -1,9 +1,7 @@
use std::sync::Arc;
use wasmer_runtime_core::{ use wasmer_runtime_core::{
backend::{ProtectedCaller, FuncResolver}, backend::{ProtectedCaller, FuncResolver},
structures::Map, structures::Map,
types::{FuncIndex, FuncSig, SigIndex}, types::{FuncIndex, FuncSig, SigIndex},
units::Pages,
module::ModuleInfo, module::ModuleInfo,
}; };
use wasmparser::{Operator, Type as WpType}; use wasmparser::{Operator, Type as WpType};

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,6 @@
)))] )))]
compile_error!("This crate doesn't yet support compiling on operating systems other than linux and macos and architectures other than x86_64"); compile_error!("This crate doesn't yet support compiling on operating systems other than linux and macos and architectures other than x86_64");
#[macro_use]
extern crate dynasmrt; extern crate dynasmrt;
#[macro_use] #[macro_use]
@ -27,23 +26,21 @@ use crate::codegen::{CodegenError, ModuleCodeGenerator};
use crate::parse::LoadError; use crate::parse::LoadError;
use std::ptr::NonNull; use std::ptr::NonNull;
use wasmer_runtime_core::{ use wasmer_runtime_core::{
backend::{sys::Memory, Backend, CacheGen, Compiler, FuncResolver, ProtectedCaller, Token, UserTrapper}, backend::{sys::Memory, Backend, CacheGen, Compiler, FuncResolver, Token},
cache::{Artifact, Error as CacheError}, cache::{Artifact, Error as CacheError},
error::{CompileError, CompileResult, RuntimeResult}, error::{CompileError, CompileResult},
module::{ModuleInfo, ModuleInner, StringTable}, module::{ModuleInfo, ModuleInner},
structures::{Map, TypedIndex},
types::{ types::{
FuncIndex, FuncSig, GlobalIndex, LocalFuncIndex, MemoryIndex, SigIndex, TableIndex, Type, LocalFuncIndex,
Value,
}, },
vm::{self, ImportBacking}, vm,
}; };
struct Placeholder; struct Placeholder;
impl CacheGen for Placeholder { impl CacheGen for Placeholder {
fn generate_cache( fn generate_cache(
&self, &self,
module: &ModuleInner, _module: &ModuleInner,
) -> Result<(Box<ModuleInfo>, Box<[u8]>, Memory), CacheError> { ) -> Result<(Box<ModuleInfo>, Box<[u8]>, Memory), CacheError> {
// unimplemented!() // unimplemented!()
Err(CacheError::Unknown("the dynasm backend doesn't support caching yet".to_string())) Err(CacheError::Unknown("the dynasm backend doesn't support caching yet".to_string()))

View File

@ -1,5 +1,4 @@
use crate::codegen::{CodegenError, FunctionCodeGenerator, ModuleCodeGenerator}; use crate::codegen::{CodegenError, FunctionCodeGenerator, ModuleCodeGenerator};
use std::sync::Arc;
use wasmer_runtime_core::{ use wasmer_runtime_core::{
backend::{Backend, ProtectedCaller, FuncResolver}, backend::{Backend, ProtectedCaller, FuncResolver},
module::{ module::{
@ -15,7 +14,7 @@ use wasmer_runtime_core::{
units::Pages, units::Pages,
}; };
use wasmparser::{ use wasmparser::{
BinaryReaderError, CodeSectionReader, Data, DataKind, Element, ElementKind, Export, BinaryReaderError, Data, DataKind, Element, ElementKind, Export,
ExternalKind, FuncType, Import, ImportSectionEntryType, InitExpr, ModuleReader, Operator, ExternalKind, FuncType, Import, ImportSectionEntryType, InitExpr, ModuleReader, Operator,
SectionCode, Type as WpType, SectionCode, Type as WpType,
WasmDecoder, WasmDecoder,
@ -308,7 +307,7 @@ pub fn read_module<
mcg.check_precondition(&info)?; mcg.check_precondition(&info)?;
for i in 0..code_reader.get_count() { for i in 0..code_reader.get_count() {
let item = code_reader.read()?; let item = code_reader.read()?;
let mut fcg = mcg.next_function()?; let fcg = mcg.next_function()?;
let sig = info let sig = info
.signatures .signatures
.get( .get(

View File

@ -73,7 +73,7 @@ pub fn call_protected<T>(f: impl FnOnce() -> T) -> RuntimeResult<T> {
if signum != 0 { if signum != 0 {
*jmp_buf = prev_jmp_buf; *jmp_buf = prev_jmp_buf;
let (faulting_addr, inst_ptr) = CAUGHT_ADDRESSES.with(|cell| cell.get()); let (faulting_addr, _inst_ptr) = CAUGHT_ADDRESSES.with(|cell| cell.get());
let signal = match Signal::from_c_int(signum) { let signal = match Signal::from_c_int(signum) {
Ok(SIGFPE) => "floating-point exception", Ok(SIGFPE) => "floating-point exception",

View File

@ -144,15 +144,6 @@ impl ValueStack {
} }
} }
pub fn peek(&self) -> Result<ValueInfo, CodegenError> {
match self.values.last().cloned() {
Some(x) => Ok(x),
None => Err(CodegenError {
message: "no value on top of stack",
}),
}
}
pub fn reset_depth(&mut self, target_depth: usize) { pub fn reset_depth(&mut self, target_depth: usize) {
self.values.truncate(target_depth); self.values.truncate(target_depth);
} }