From 6aa87a0bbf2e6f4e02f75e5d96e0d46345c2973d Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 17 May 2019 01:10:21 +0800 Subject: [PATCH 01/30] Add the `internals` field and necessary structures for metering. --- lib/llvm-backend/src/code.rs | 1 + lib/llvm-backend/src/intrinsics.rs | 4 ++++ lib/runtime-core/src/backing.rs | 19 ++++++++++++++++++- lib/runtime-core/src/codegen.rs | 5 ++++- lib/runtime-core/src/lib.rs | 2 ++ lib/runtime-core/src/vm.rs | 19 +++++++++++++++++-- 6 files changed, 46 insertions(+), 4 deletions(-) diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index 8514208ad54..aecf6fd74ae 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -472,6 +472,7 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { fn feed_event(&mut self, event: Event, module_info: &ModuleInfo) -> Result<(), CodegenError> { let op = match event { Event::Wasm(x) => x, + Event::WasmOwned(ref x) => x, Event::Internal(_x) => { return Ok(()); } diff --git a/lib/llvm-backend/src/intrinsics.rs b/lib/llvm-backend/src/intrinsics.rs index ebee5a3882d..2198821ed9f 100644 --- a/lib/llvm-backend/src/intrinsics.rs +++ b/lib/llvm-backend/src/intrinsics.rs @@ -163,6 +163,7 @@ impl Intrinsics { let stack_lower_bound_ty = i8_ty; let memory_base_ty = i8_ty; let memory_bound_ty = void_ty; + let internals_ty = void_ty; let local_function_ty = i8_ptr_ty; let anyfunc_ty = context.struct_type( @@ -218,6 +219,9 @@ impl Intrinsics { memory_bound_ty .ptr_type(AddressSpace::Generic) .as_basic_type_enum(), + internals_ty + .ptr_type(AddressSpace::Generic) + .as_basic_type_enum(), local_function_ty .ptr_type(AddressSpace::Generic) .as_basic_type_enum(), diff --git a/lib/runtime-core/src/backing.rs b/lib/runtime-core/src/backing.rs index 821ff379f4d..52aec386eaa 100644 --- a/lib/runtime-core/src/backing.rs +++ b/lib/runtime-core/src/backing.rs @@ -15,7 +15,20 @@ use crate::{ }, vm, }; -use std::slice; +use std::{ + slice, + fmt::Debug, +}; + +pub const INTERNALS_SIZE: usize = 256; + +pub(crate) struct Internals(pub(crate) [u64; INTERNALS_SIZE]); + +impl Debug for Internals { + fn fmt(&self, formatter: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { + write!(formatter, "Internals({:?})", &self.0[..]) + } +} /// The `LocalBacking` "owns" the memory used by all the local resources of an Instance. /// That is, local memories, tables, and globals (as well as some additional @@ -40,6 +53,8 @@ pub struct LocalBacking { /// as well) are subject to change. pub(crate) dynamic_sigindices: BoxedMap, pub(crate) local_functions: BoxedMap, + + pub(crate) internals: Internals, } impl LocalBacking { @@ -66,6 +81,8 @@ impl LocalBacking { dynamic_sigindices, local_functions, + + internals: Internals([0; 256]), } } diff --git a/lib/runtime-core/src/codegen.rs b/lib/runtime-core/src/codegen.rs index 1d9f30f1a4e..9ae20d8c942 100644 --- a/lib/runtime-core/src/codegen.rs +++ b/lib/runtime-core/src/codegen.rs @@ -17,6 +17,7 @@ use wasmparser::{Operator, Type as WpType}; pub enum Event<'a, 'b> { Internal(InternalEvent), Wasm(&'b Operator<'a>), + WasmOwned(Operator<'a>), } pub enum InternalEvent { @@ -39,7 +40,9 @@ impl fmt::Debug for InternalEvent { } } -pub struct BkptInfo {} +pub struct BkptInfo { + pub throw: unsafe extern "C" fn () -> !, +} pub trait ModuleCodeGenerator, RM: RunnableModule, E: Debug> { /// Creates a new module code generator. diff --git a/lib/runtime-core/src/lib.rs b/lib/runtime-core/src/lib.rs index 20708c17a5e..871e5875b6e 100644 --- a/lib/runtime-core/src/lib.rs +++ b/lib/runtime-core/src/lib.rs @@ -49,6 +49,8 @@ pub use self::module::Module; pub use self::typed_func::Func; use std::sync::Arc; +pub use wasmparser; + use self::cache::{Artifact, Error as CacheError}; pub mod prelude { diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index 323e40c219b..b772cc9b479 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -1,4 +1,4 @@ -pub use crate::backing::{ImportBacking, LocalBacking}; +pub use crate::backing::{ImportBacking, LocalBacking, INTERNALS_SIZE}; use crate::{ memory::{Memory, MemoryType}, module::{ModuleInfo, ModuleInner}, @@ -92,6 +92,8 @@ pub struct InternalCtx { pub memory_base: *mut u8, pub memory_bound: usize, + + pub internals: *mut [u64; INTERNALS_SIZE], // TODO: Make this dynamic? } #[repr(C)] @@ -200,6 +202,8 @@ impl Ctx { memory_base: mem_base, memory_bound: mem_bound, + + internals: &mut local_backing.internals.0, }, local_functions: local_backing.local_functions.as_ptr(), @@ -249,6 +253,8 @@ impl Ctx { memory_base: mem_base, memory_bound: mem_bound, + + internals: &mut local_backing.internals.0, }, local_functions: local_backing.local_functions.as_ptr(), @@ -356,9 +362,13 @@ impl Ctx { 11 * (mem::size_of::() as u8) } - pub fn offset_local_functions() -> u8 { + pub fn offset_internals() -> u8 { 12 * (mem::size_of::() as u8) } + + pub fn offset_local_functions() -> u8 { + 13 * (mem::size_of::() as u8) + } } enum InnerFunc {} @@ -572,6 +582,11 @@ mod vm_offset_tests { offset_of!(InternalCtx => memory_bound).get_byte_offset(), ); + assert_eq!( + Ctx::offset_internals() as usize, + offset_of!(InternalCtx => internals).get_byte_offset(), + ); + assert_eq!( Ctx::offset_local_functions() as usize, offset_of!(Ctx => local_functions).get_byte_offset(), From 7e79dd2cfe20b81ea466bbe440988cbc9d9282bc Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 17 May 2019 01:10:45 +0800 Subject: [PATCH 02/30] Metering middleware. --- lib/middleware-common/Cargo.toml | 2 +- lib/middleware-common/src/lib.rs | 1 + lib/middleware-common/src/metering.rs | 83 +++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 lib/middleware-common/src/metering.rs diff --git a/lib/middleware-common/Cargo.toml b/lib/middleware-common/Cargo.toml index 57a42577ccc..2beabfb6b3d 100644 --- a/lib/middleware-common/Cargo.toml +++ b/lib/middleware-common/Cargo.toml @@ -8,4 +8,4 @@ authors = ["The Wasmer Engineering Team "] edition = "2018" [dependencies] -wasmer-runtime-core = { path = "../runtime-core", version = "0.4.1" } +wasmer-runtime-core = { path = "../runtime-core" } diff --git a/lib/middleware-common/src/lib.rs b/lib/middleware-common/src/lib.rs index e09d9ee03b7..41699c9e705 100644 --- a/lib/middleware-common/src/lib.rs +++ b/lib/middleware-common/src/lib.rs @@ -1,3 +1,4 @@ #![deny(unused_imports, unused_variables, unused_unsafe, unreachable_patterns)] pub mod call_trace; +pub mod metering; diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs new file mode 100644 index 00000000000..5d19eef353e --- /dev/null +++ b/lib/middleware-common/src/metering.rs @@ -0,0 +1,83 @@ +use wasmer_runtime_core::{ + codegen::{Event, EventSink, FunctionMiddleware, InternalEvent}, + module::ModuleInfo, + wasmparser::{Operator, Type as WpType}, +}; + +pub struct Metering { + limit: u64, + current_block: u64, +} + +impl Metering { + pub fn new(limit: u64) -> Metering { + Metering { + limit, + current_block: 0, + } + } +} + +impl FunctionMiddleware for Metering { + type Error = String; + fn feed_event<'a, 'b: 'a>( + &mut self, + op: Event<'a, 'b>, + _module_info: &ModuleInfo, + sink: &mut EventSink<'a, 'b>, + ) -> Result<(), Self::Error> { + match op { + Event::Internal(InternalEvent::FunctionBegin(_)) => { + self.current_block = 0; + }, + Event::Wasm(&ref op) | Event::WasmOwned(ref op) => { + self.current_block += 1; + match *op { + Operator::Loop { .. } + | Operator::Block { .. } + | Operator::End + | Operator::If { .. } + | Operator::Else + | Operator::Unreachable + | Operator::Br { .. } + | Operator::BrTable { .. } + | Operator::BrIf { .. } + | Operator::Call { .. } + | Operator::CallIndirect { .. } + => { + sink.push(Event::Internal(InternalEvent::GetInternal(0))); + sink.push(Event::WasmOwned(Operator::I64Const { value: self.current_block as i64 })); + sink.push(Event::WasmOwned(Operator::I64Add)); + sink.push(Event::Internal(InternalEvent::SetInternal(0))); + self.current_block = 0; + }, + _ => {} + } + match *op { + Operator::Br { .. } + | Operator::BrTable { .. } + | Operator::BrIf { .. } + | Operator::Call { .. } + | Operator::CallIndirect { .. } + => { + sink.push(Event::Internal(InternalEvent::GetInternal(0))); + sink.push(Event::WasmOwned(Operator::I64Const { value: self.limit as i64 })); + sink.push(Event::WasmOwned(Operator::I64GeU)); + sink.push(Event::WasmOwned(Operator::If { ty: WpType::EmptyBlockType })); + sink.push(Event::Internal(InternalEvent::Breakpoint(Box::new(move |ctx| { + eprintln!("execution limit reached"); + unsafe { + (ctx.throw)(); + } + })))); + sink.push(Event::WasmOwned(Operator::End)); + }, + _ => {} + } + }, + _ => {} + } + sink.push(op); + Ok(()) + } +} From e7297b9465f131c0dea9fb2e69378d6809f33f3a Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 17 May 2019 01:11:22 +0800 Subject: [PATCH 03/30] Update singlepass backend to support metering. --- lib/singlepass-backend/src/codegen_x64.rs | 71 +++++++++++++++++++++- lib/singlepass-backend/src/protect_unix.rs | 12 +++- 2 files changed, 79 insertions(+), 4 deletions(-) diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index 7d4d0de5cc1..4a0c3e4f5f1 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -23,7 +23,7 @@ use wasmer_runtime_core::{ FuncIndex, FuncSig, GlobalIndex, LocalFuncIndex, LocalOrImport, MemoryIndex, SigIndex, TableIndex, Type, }, - vm::{self, LocalGlobal, LocalTable}, + vm::{self, LocalGlobal, LocalTable, INTERNALS_SIZE}, }; use wasmparser::{Operator, Type as WpType}; @@ -1494,8 +1494,10 @@ impl FunctionCodeGenerator for X64FunctionCode { let a = self.assembler.as_mut().unwrap(); + let op = match ev { Event::Wasm(x) => x, + Event::WasmOwned(ref x) => x, Event::Internal(x) => { match x { InternalEvent::Breakpoint(callback) => { @@ -1505,8 +1507,71 @@ impl FunctionCodeGenerator for X64FunctionCode { .unwrap() .insert(a.get_offset(), callback); } - InternalEvent::FunctionBegin(_) | InternalEvent::FunctionEnd => {} - _ => unimplemented!(), + InternalEvent::FunctionBegin(_) | InternalEvent::FunctionEnd => {}, + InternalEvent::GetInternal(idx) => { + let idx = idx as usize; + assert!(idx < INTERNALS_SIZE); + + let tmp = self.machine.acquire_temp_gpr().unwrap(); + + // Load `internals` pointer. + a.emit_mov( + Size::S64, + Location::Memory( + Machine::get_vmctx_reg(), + vm::Ctx::offset_internals() as i32, + ), + Location::GPR(tmp), + ); + + let loc = self.machine.acquire_locations( + a, + &[WpType::I64], + false, + )[0]; + self.value_stack.push((loc, LocalOrTemp::Temp)); + + // Move internal into the result location. + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S64, + Location::Memory(tmp, (idx * 8) as i32), + loc, + ); + + self.machine.release_temp_gpr(tmp); + } + InternalEvent::SetInternal(idx) => { + let idx = idx as usize; + assert!(idx < INTERNALS_SIZE); + + let tmp = self.machine.acquire_temp_gpr().unwrap(); + + // Load `internals` pointer. + a.emit_mov( + Size::S64, + Location::Memory( + Machine::get_vmctx_reg(), + vm::Ctx::offset_internals() as i32, + ), + Location::GPR(tmp), + ); + let loc = get_location_released(a, &mut self.machine, self.value_stack.pop().unwrap()); + + // Move internal into storage. + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S64, + loc, + Location::Memory(tmp, (idx * 8) as i32), + ); + self.machine.release_temp_gpr(tmp); + } + //_ => unimplemented!(), } return Ok(()); } diff --git a/lib/singlepass-backend/src/protect_unix.rs b/lib/singlepass-backend/src/protect_unix.rs index 6204134a721..e26467b8e05 100644 --- a/lib/singlepass-backend/src/protect_unix.rs +++ b/lib/singlepass-backend/src/protect_unix.rs @@ -35,7 +35,9 @@ extern "C" fn signal_trap_handler( let bkpt_map = BKPT_MAP.with(|x| x.borrow().last().map(|x| x.clone())); if let Some(bkpt_map) = bkpt_map { if let Some(ref x) = bkpt_map.get(&(ip as usize)) { - (x)(BkptInfo {}); + (x)(BkptInfo { + throw: throw, + }); return; } } @@ -128,6 +130,14 @@ pub fn call_protected(f: impl FnOnce() -> T) -> Result { } } +pub unsafe extern "C" fn throw() -> ! { + let jmp_buf = SETJMP_BUFFER.with(|buf| buf.get()); + if *jmp_buf == [0; SETJMP_BUFFER_LEN] { + ::std::process::abort(); + } + longjmp(jmp_buf as *mut ::nix::libc::c_void, 0xffff); +} + /// Unwinds to last protected_call. pub unsafe fn do_unwind(signum: i32, siginfo: *const c_void, ucontext: *const c_void) -> ! { // Since do_unwind is only expected to get called from WebAssembly code which doesn't hold any host resources (locks etc.) From 14fcd78b30134095e341aa76ac56fa510f32ed34 Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 17 May 2019 01:15:05 +0800 Subject: [PATCH 04/30] Update bin/wasmer and run cargo fmt. --- lib/middleware-common/src/metering.rs | 72 ++++++++++++---------- lib/runtime-core/src/backing.rs | 5 +- lib/runtime-core/src/codegen.rs | 2 +- lib/singlepass-backend/src/codegen_x64.rs | 1 - lib/singlepass-backend/src/protect_unix.rs | 4 +- src/bin/wasmer.rs | 20 +++++- 6 files changed, 60 insertions(+), 44 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index 5d19eef353e..0b95e5f978c 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -29,52 +29,58 @@ impl FunctionMiddleware for Metering { match op { Event::Internal(InternalEvent::FunctionBegin(_)) => { self.current_block = 0; - }, + } Event::Wasm(&ref op) | Event::WasmOwned(ref op) => { self.current_block += 1; match *op { Operator::Loop { .. } - | Operator::Block { .. } - | Operator::End - | Operator::If { .. } - | Operator::Else - | Operator::Unreachable - | Operator::Br { .. } - | Operator::BrTable { .. } - | Operator::BrIf { .. } - | Operator::Call { .. } - | Operator::CallIndirect { .. } - => { - sink.push(Event::Internal(InternalEvent::GetInternal(0))); - sink.push(Event::WasmOwned(Operator::I64Const { value: self.current_block as i64 })); - sink.push(Event::WasmOwned(Operator::I64Add)); - sink.push(Event::Internal(InternalEvent::SetInternal(0))); - self.current_block = 0; - }, + | Operator::Block { .. } + | Operator::End + | Operator::If { .. } + | Operator::Else + | Operator::Unreachable + | Operator::Br { .. } + | Operator::BrTable { .. } + | Operator::BrIf { .. } + | Operator::Call { .. } + | Operator::CallIndirect { .. } => { + sink.push(Event::Internal(InternalEvent::GetInternal(0))); + sink.push(Event::WasmOwned(Operator::I64Const { + value: self.current_block as i64, + })); + sink.push(Event::WasmOwned(Operator::I64Add)); + sink.push(Event::Internal(InternalEvent::SetInternal(0))); + self.current_block = 0; + } _ => {} } match *op { - Operator::Br { .. } - | Operator::BrTable { .. } - | Operator::BrIf { .. } - | Operator::Call { .. } - | Operator::CallIndirect { .. } - => { - sink.push(Event::Internal(InternalEvent::GetInternal(0))); - sink.push(Event::WasmOwned(Operator::I64Const { value: self.limit as i64 })); - sink.push(Event::WasmOwned(Operator::I64GeU)); - sink.push(Event::WasmOwned(Operator::If { ty: WpType::EmptyBlockType })); - sink.push(Event::Internal(InternalEvent::Breakpoint(Box::new(move |ctx| { + Operator::Br { .. } + | Operator::BrTable { .. } + | Operator::BrIf { .. } + | Operator::Call { .. } + | Operator::CallIndirect { .. } => { + sink.push(Event::Internal(InternalEvent::GetInternal(0))); + sink.push(Event::WasmOwned(Operator::I64Const { + value: self.limit as i64, + })); + sink.push(Event::WasmOwned(Operator::I64GeU)); + sink.push(Event::WasmOwned(Operator::If { + ty: WpType::EmptyBlockType, + })); + sink.push(Event::Internal(InternalEvent::Breakpoint(Box::new( + move |ctx| { eprintln!("execution limit reached"); unsafe { (ctx.throw)(); } - })))); - sink.push(Event::WasmOwned(Operator::End)); - }, + }, + )))); + sink.push(Event::WasmOwned(Operator::End)); + } _ => {} } - }, + } _ => {} } sink.push(op); diff --git a/lib/runtime-core/src/backing.rs b/lib/runtime-core/src/backing.rs index 52aec386eaa..cef525f2c91 100644 --- a/lib/runtime-core/src/backing.rs +++ b/lib/runtime-core/src/backing.rs @@ -15,10 +15,7 @@ use crate::{ }, vm, }; -use std::{ - slice, - fmt::Debug, -}; +use std::{fmt::Debug, slice}; pub const INTERNALS_SIZE: usize = 256; diff --git a/lib/runtime-core/src/codegen.rs b/lib/runtime-core/src/codegen.rs index 9ae20d8c942..f7a997e2999 100644 --- a/lib/runtime-core/src/codegen.rs +++ b/lib/runtime-core/src/codegen.rs @@ -41,7 +41,7 @@ impl fmt::Debug for InternalEvent { } pub struct BkptInfo { - pub throw: unsafe extern "C" fn () -> !, + pub throw: unsafe extern "C" fn() -> !, } pub trait ModuleCodeGenerator, RM: RunnableModule, E: Debug> { diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index 4a0c3e4f5f1..6b8ea5569a5 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -1494,7 +1494,6 @@ impl FunctionCodeGenerator for X64FunctionCode { let a = self.assembler.as_mut().unwrap(); - let op = match ev { Event::Wasm(x) => x, Event::WasmOwned(ref x) => x, diff --git a/lib/singlepass-backend/src/protect_unix.rs b/lib/singlepass-backend/src/protect_unix.rs index e26467b8e05..56ac61519c5 100644 --- a/lib/singlepass-backend/src/protect_unix.rs +++ b/lib/singlepass-backend/src/protect_unix.rs @@ -35,9 +35,7 @@ extern "C" fn signal_trap_handler( let bkpt_map = BKPT_MAP.with(|x| x.borrow().last().map(|x| x.clone())); if let Some(bkpt_map) = bkpt_map { if let Some(ref x) = bkpt_map.get(&(ip as usize)) { - (x)(BkptInfo { - throw: throw, - }); + (x)(BkptInfo { throw: throw }); return; } } diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 8231c60b410..806af915879 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -17,18 +17,22 @@ use wasmer::*; use wasmer_clif_backend::CraneliftCompiler; #[cfg(feature = "backend:llvm")] use wasmer_llvm_backend::LLVMCompiler; +#[cfg(feature = "backend:singlepass")] +use wasmer_middleware_common::metering::Metering; use wasmer_runtime::{ cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH}, error::RuntimeError, Func, Value, }; +#[cfg(feature = "backend:singlepass")] +use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler}; use wasmer_runtime_core::{ self, backend::{Compiler, CompilerConfig, MemoryBoundCheckMode}, loader::{Instance as LoadedInstance, LocalLoader}, }; #[cfg(feature = "backend:singlepass")] -use wasmer_singlepass_backend::SinglePassCompiler; +use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG; #[cfg(feature = "wasi")] use wasmer_wasi; @@ -110,6 +114,9 @@ struct Run { /// Application arguments #[structopt(name = "--", raw(multiple = "true"))] args: Vec, + + #[structopt(long = "inst-limit")] + instruction_limit: Option, } #[allow(dead_code)] @@ -286,7 +293,16 @@ fn execute_wasm(options: &Run) -> Result<(), String> { let compiler: Box = match options.backend { #[cfg(feature = "backend:singlepass")] - Backend::Singlepass => Box::new(SinglePassCompiler::new()), + Backend::Singlepass => { + let c: StreamingCompiler = StreamingCompiler::new(|| { + let mut chain = MiddlewareChain::new(); + if let Some(limit) = options.instruction_limit { + chain.push(Metering::new(limit)); + } + chain + }); + Box::new(c) + } #[cfg(not(feature = "backend:singlepass"))] Backend::Singlepass => return Err("The singlepass backend is not enabled".to_string()), Backend::Cranelift => Box::new(CraneliftCompiler::new()), From b830f10fa07050d20cf8523fff2540c0f8276030 Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 17 May 2019 01:20:09 +0800 Subject: [PATCH 05/30] Update metering data on return --- lib/middleware-common/src/metering.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index 0b95e5f978c..cf82b66d185 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -43,7 +43,8 @@ impl FunctionMiddleware for Metering { | Operator::BrTable { .. } | Operator::BrIf { .. } | Operator::Call { .. } - | Operator::CallIndirect { .. } => { + | Operator::CallIndirect { .. } + | Operator::Return => { sink.push(Event::Internal(InternalEvent::GetInternal(0))); sink.push(Event::WasmOwned(Operator::I64Const { value: self.current_block as i64, From 8e0d71b2bcad8ad5301d4ad9cdb9ddbcfb066d11 Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 17 May 2019 01:32:41 +0800 Subject: [PATCH 06/30] Fix missing `internals` in test. --- lib/runtime-core/src/vm.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index b772cc9b479..2d801b9cc1a 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -699,6 +699,8 @@ mod vm_ctx_tests { dynamic_sigindices: Map::new().into_boxed_map(), local_functions: Map::new().into_boxed_map(), + + internals: crate::backing::Internals([0; 256]), }; let mut import_backing = ImportBacking { memories: Map::new().into_boxed_map(), From 6aec1c4b5f6f61461700022afa47f6bbd3450986 Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 17 May 2019 01:33:33 +0800 Subject: [PATCH 07/30] Use `INTERNALS_SIZE` --- lib/runtime-core/src/backing.rs | 2 +- lib/runtime-core/src/vm.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/runtime-core/src/backing.rs b/lib/runtime-core/src/backing.rs index cef525f2c91..2078837b052 100644 --- a/lib/runtime-core/src/backing.rs +++ b/lib/runtime-core/src/backing.rs @@ -79,7 +79,7 @@ impl LocalBacking { dynamic_sigindices, local_functions, - internals: Internals([0; 256]), + internals: Internals([0; INTERNALS_SIZE]), } } diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index 2d801b9cc1a..34ce7ed0a84 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -700,7 +700,7 @@ mod vm_ctx_tests { dynamic_sigindices: Map::new().into_boxed_map(), local_functions: Map::new().into_boxed_map(), - internals: crate::backing::Internals([0; 256]), + internals: crate::backing::Internals([0; crate::backing::INTERNALS_SIZE]), }; let mut import_backing = ImportBacking { memories: Map::new().into_boxed_map(), From cf58305889f19298036eab9f5f37785851f1ac90 Mon Sep 17 00:00:00 2001 From: losfair Date: Thu, 23 May 2019 20:10:17 +0800 Subject: [PATCH 08/30] Dynamically allocate internal fields. --- lib/middleware-common/src/metering.rs | 9 ++++--- lib/runtime-core/src/vm.rs | 37 ++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index cf82b66d185..d38d42d7b91 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -2,8 +2,11 @@ use wasmer_runtime_core::{ codegen::{Event, EventSink, FunctionMiddleware, InternalEvent}, module::ModuleInfo, wasmparser::{Operator, Type as WpType}, + vm::InternalField, }; +static INTERNAL_FIELD: InternalField = InternalField::allocate(); + pub struct Metering { limit: u64, current_block: u64, @@ -45,12 +48,12 @@ impl FunctionMiddleware for Metering { | Operator::Call { .. } | Operator::CallIndirect { .. } | Operator::Return => { - sink.push(Event::Internal(InternalEvent::GetInternal(0))); + sink.push(Event::Internal(InternalEvent::GetInternal(INTERNAL_FIELD.index() as _))); sink.push(Event::WasmOwned(Operator::I64Const { value: self.current_block as i64, })); sink.push(Event::WasmOwned(Operator::I64Add)); - sink.push(Event::Internal(InternalEvent::SetInternal(0))); + sink.push(Event::Internal(InternalEvent::SetInternal(INTERNAL_FIELD.index() as _))); self.current_block = 0; } _ => {} @@ -61,7 +64,7 @@ impl FunctionMiddleware for Metering { | Operator::BrIf { .. } | Operator::Call { .. } | Operator::CallIndirect { .. } => { - sink.push(Event::Internal(InternalEvent::GetInternal(0))); + sink.push(Event::Internal(InternalEvent::GetInternal(INTERNAL_FIELD.index() as _))); sink.push(Event::WasmOwned(Operator::I64Const { value: self.limit as i64, })); diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index 34ce7ed0a84..95c11dfc338 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -6,7 +6,7 @@ use crate::{ types::{LocalOrImport, MemoryIndex}, vmcalls, }; -use std::{ffi::c_void, mem, ptr}; +use std::{ffi::c_void, mem, ptr, sync::atomic::{AtomicUsize, Ordering}, sync::Once, cell::UnsafeCell}; use hashbrown::HashMap; @@ -96,6 +96,41 @@ pub struct InternalCtx { pub internals: *mut [u64; INTERNALS_SIZE], // TODO: Make this dynamic? } +static INTERNAL_FIELDS: AtomicUsize = AtomicUsize::new(0); + +pub struct InternalField { + init: Once, + inner: UnsafeCell, +} + +unsafe impl Send for InternalField {} +unsafe impl Sync for InternalField {} + +impl InternalField { + pub const fn allocate() -> InternalField { + InternalField { + init: Once::new(), + inner: UnsafeCell::new(::std::usize::MAX), + } + } + + pub fn index(&self) -> usize { + let inner: *mut usize = self.inner.get(); + self.init.call_once(|| { + let idx = INTERNAL_FIELDS.fetch_add(1, Ordering::SeqCst); + if idx >= INTERNALS_SIZE { + INTERNAL_FIELDS.fetch_sub(1, Ordering::SeqCst); + panic!("at most {} internal fields are supported", INTERNALS_SIZE); + } else { + unsafe { + *inner = idx; + } + } + }); + unsafe { *inner } + } +} + #[repr(C)] pub struct Intrinsics { pub memory_grow: *const Func, From dcf52ef1a7125955c5ee9e5097648b251e84aa18 Mon Sep 17 00:00:00 2001 From: losfair Date: Thu, 23 May 2019 20:10:34 +0800 Subject: [PATCH 09/30] Cargo fmt --- lib/middleware-common/src/metering.rs | 14 ++++++++++---- lib/runtime-core/src/vm.rs | 8 +++++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index d38d42d7b91..d7d33da128e 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -1,8 +1,8 @@ use wasmer_runtime_core::{ codegen::{Event, EventSink, FunctionMiddleware, InternalEvent}, module::ModuleInfo, - wasmparser::{Operator, Type as WpType}, vm::InternalField, + wasmparser::{Operator, Type as WpType}, }; static INTERNAL_FIELD: InternalField = InternalField::allocate(); @@ -48,12 +48,16 @@ impl FunctionMiddleware for Metering { | Operator::Call { .. } | Operator::CallIndirect { .. } | Operator::Return => { - sink.push(Event::Internal(InternalEvent::GetInternal(INTERNAL_FIELD.index() as _))); + sink.push(Event::Internal(InternalEvent::GetInternal( + INTERNAL_FIELD.index() as _, + ))); sink.push(Event::WasmOwned(Operator::I64Const { value: self.current_block as i64, })); sink.push(Event::WasmOwned(Operator::I64Add)); - sink.push(Event::Internal(InternalEvent::SetInternal(INTERNAL_FIELD.index() as _))); + sink.push(Event::Internal(InternalEvent::SetInternal( + INTERNAL_FIELD.index() as _, + ))); self.current_block = 0; } _ => {} @@ -64,7 +68,9 @@ impl FunctionMiddleware for Metering { | Operator::BrIf { .. } | Operator::Call { .. } | Operator::CallIndirect { .. } => { - sink.push(Event::Internal(InternalEvent::GetInternal(INTERNAL_FIELD.index() as _))); + sink.push(Event::Internal(InternalEvent::GetInternal( + INTERNAL_FIELD.index() as _, + ))); sink.push(Event::WasmOwned(Operator::I64Const { value: self.limit as i64, })); diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index 95c11dfc338..74a1c06dd7a 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -6,7 +6,13 @@ use crate::{ types::{LocalOrImport, MemoryIndex}, vmcalls, }; -use std::{ffi::c_void, mem, ptr, sync::atomic::{AtomicUsize, Ordering}, sync::Once, cell::UnsafeCell}; +use std::{ + cell::UnsafeCell, + ffi::c_void, + mem, ptr, + sync::atomic::{AtomicUsize, Ordering}, + sync::Once, +}; use hashbrown::HashMap; From 68a8800f991f2b9c4f059fc819a2bced4ca907fd Mon Sep 17 00:00:00 2001 From: losfair Date: Thu, 23 May 2019 20:28:57 +0800 Subject: [PATCH 10/30] Temporarily use the original zbox. --- Cargo.lock | 417 ++++++++++++++++++------------------- lib/runtime-abi/Cargo.toml | 4 +- 2 files changed, 209 insertions(+), 212 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f5504e8c14d..388c88cee96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,27 +54,26 @@ name = "atty" version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "autocfg" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "backtrace" -version = "0.3.15" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -82,8 +81,8 @@ name = "backtrace-sys" version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -101,7 +100,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", "cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "clang-sys 0.26.4 (registry+https://github.com/rust-lang/crates.io-index)", "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -147,6 +146,7 @@ version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -156,7 +156,7 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bzip2-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -164,8 +164,8 @@ name = "bzip2-sys" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -181,7 +181,7 @@ name = "capstone-sys" version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -202,13 +202,13 @@ dependencies = [ "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "cc" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -224,7 +224,7 @@ dependencies = [ [[package]] name = "cfg-if" -version = "0.1.7" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -233,7 +233,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -261,10 +261,10 @@ dependencies = [ [[package]] name = "cmake" -version = "0.1.39" +version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -274,7 +274,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "cookie" -version = "0.11.1" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", @@ -283,17 +283,15 @@ dependencies = [ [[package]] name = "cookie_store" -version = "0.5.1" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "publicsuffix 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "try_from 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -306,7 +304,7 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -397,7 +395,7 @@ name = "crc32fast" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -412,8 +410,8 @@ dependencies = [ "csv 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_os 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "rand_xoshiro 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -422,7 +420,7 @@ dependencies = [ "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", - "tinytemplate 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", + "tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 2.2.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -460,7 +458,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -474,7 +472,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memoffset 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -494,7 +492,7 @@ name = "crossbeam-utils" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -502,7 +500,7 @@ name = "crossbeam-utils" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -572,7 +570,7 @@ name = "encoding_rs" version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -602,7 +600,7 @@ version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "errno-dragonfly 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -612,7 +610,7 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -620,7 +618,7 @@ name = "error-chain" version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -629,7 +627,7 @@ name = "failure" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", + "backtrace 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)", "failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -641,7 +639,7 @@ dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", "quote 0.6.12 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)", - "synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", + "synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -651,12 +649,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "filetime" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -665,7 +664,7 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -730,7 +729,7 @@ name = "generational-arena" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -758,7 +757,7 @@ dependencies = [ [[package]] name = "h2" -version = "0.1.18" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -788,7 +787,7 @@ name = "heck" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -806,6 +805,17 @@ dependencies = [ "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "http-body" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", + "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "httparse" version = "1.3.3" @@ -821,14 +831,15 @@ dependencies = [ [[package]] name = "hyper" -version = "0.12.28" +version = "0.12.29" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "futures-cpupool 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)", + "h2 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", + "http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -836,13 +847,14 @@ dependencies = [ "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "want 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -853,7 +865,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.28 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.29 (registry+https://github.com/rust-lang/crates.io-index)", "native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -881,8 +893,8 @@ dependencies = [ "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "enum-methods 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "inkwell_internal_macros 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm7-0)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "llvm-sys 70.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "llvm-sys 70.2.0 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -899,7 +911,7 @@ name = "iovec" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -934,14 +946,9 @@ name = "lazy_static" version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -[[package]] -name = "lazycell" -version = "1.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "libc" -version = "0.2.54" +version = "0.2.55" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -959,7 +966,7 @@ name = "libloading" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -974,12 +981,12 @@ dependencies = [ [[package]] name = "llvm-sys" -version = "70.1.0" +version = "70.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -998,25 +1005,7 @@ name = "log" version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "lz4" -version = "1.23.1" -source = "git+https://github.com/zboxfs/lz4-rs.git#4704144553d827a96d4fedeb683dbde1360e06e3" -dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "lz4-sys 1.8.3 (git+https://github.com/zboxfs/lz4-rs.git)", -] - -[[package]] -name = "lz4-sys" -version = "1.8.3" -source = "git+https://github.com/zboxfs/lz4-rs.git#4704144553d827a96d4fedeb683dbde1360e06e3" -dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1029,7 +1018,7 @@ name = "memchr" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1037,7 +1026,7 @@ name = "memmap" version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1046,7 +1035,7 @@ name = "memmap" version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1087,23 +1076,22 @@ name = "miniz_oxide_c_api" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "mio" -version = "0.6.16" +version = "0.6.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1128,15 +1116,15 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl 0.10.22 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl 0.10.23 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.46 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", "schannel 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1144,8 +1132,8 @@ name = "net2" version = "0.2.33" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1155,9 +1143,9 @@ version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1167,9 +1155,9 @@ version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1192,20 +1180,23 @@ name = "num-traits" version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "num-traits" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "num_cpus" version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1215,15 +1206,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl" -version = "0.10.22" +version = "0.10.23" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "openssl-sys 0.9.46 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -1233,12 +1224,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "openssl-sys" -version = "0.9.46" +version = "0.9.47" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", "vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1265,7 +1256,7 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1283,7 +1274,7 @@ name = "parking_lot_core" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1398,7 +1389,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1409,8 +1400,8 @@ name = "rand" version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_chacha 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rand_hc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1427,7 +1418,7 @@ name = "rand_chacha" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1465,7 +1456,7 @@ name = "rand_jitter" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1477,7 +1468,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "fuchsia-cprng 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "rdrand 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1488,7 +1479,7 @@ name = "rand_pcg" version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "rand_core 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1515,7 +1506,7 @@ version = "6.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1536,7 +1527,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-deque 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1591,18 +1582,18 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.9.16" +version = "0.9.17" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)", - "cookie_store 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", + "cookie_store 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "encoding_rs 0.8.17 (registry+https://github.com/rust-lang/crates.io-index)", "flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)", - "hyper 0.12.28 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.12.29 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "mime 0.3.13 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1612,11 +1603,11 @@ dependencies = [ "serde_json 1.0.39 (registry+https://github.com/rust-lang/crates.io-index)", "serde_urlencoded 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)", "uuid 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1706,7 +1697,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)", "core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "security-framework-sys 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1875,7 +1866,7 @@ dependencies = [ [[package]] name = "synstructure" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "proc-macro2 0.4.30 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1891,11 +1882,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "tar" -version = "0.4.25" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "filetime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -1921,11 +1912,11 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.0.7" +version = "3.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1945,7 +1936,7 @@ name = "termion" version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1972,14 +1963,14 @@ name = "time" version = "0.1.42" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "redox_syscall 0.1.54 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "tinytemplate" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1988,12 +1979,12 @@ dependencies = [ [[package]] name = "tokio" -version = "0.1.19" +version = "0.1.20" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2001,10 +1992,20 @@ dependencies = [ "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", - "tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", + "tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "tokio-buf" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", + "either 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)", + "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "tokio-current-thread" version = "0.1.6" @@ -2042,7 +2043,7 @@ dependencies = [ "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", "num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "slab 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2068,7 +2069,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.27 (registry+https://github.com/rust-lang/crates.io-index)", "iovec 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", - "mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)", + "mio 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)", "tokio-reactor 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2091,7 +2092,7 @@ dependencies = [ [[package]] name = "tokio-timer" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2126,7 +2127,7 @@ name = "try_from" version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2173,7 +2174,7 @@ dependencies = [ [[package]] name = "unicode-segmentation" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -2250,8 +2251,8 @@ name = "wabt-sys" version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2309,7 +2310,7 @@ dependencies = [ "cranelift-native 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "cranelift-wasm 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "rayon 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2327,7 +2328,7 @@ dependencies = [ name = "wasmer-dev-utils" version = "0.4.2" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2337,7 +2338,7 @@ dependencies = [ "byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2352,7 +2353,7 @@ dependencies = [ name = "wasmer-kernel-loader" version = "0.1.0" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.4.2", ] @@ -2361,12 +2362,12 @@ name = "wasmer-llvm-backend" version = "0.4.2" dependencies = [ "capstone 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "goblin 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "inkwell 0.1.0 (git+https://github.com/wasmerio/inkwell?branch=llvm7-0)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2391,7 +2392,7 @@ dependencies = [ "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "memmap 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-clif-backend 0.4.2", "wasmer-llvm-backend 0.4.2", @@ -2405,12 +2406,12 @@ version = "0.4.2" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", "tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.4.2", "wasmparser 0.29.2 (registry+https://github.com/rust-lang/crates.io-index)", - "zbox 0.6.1 (git+https://github.com/wasmerio/zbox?branch=bundle-libsodium)", + "zbox 0.7.1 (git+https://github.com/zboxfs/zbox)", "zstd 0.4.24+zstd.1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2419,7 +2420,7 @@ name = "wasmer-runtime-c-api" version = "0.4.2" dependencies = [ "cbindgen 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime 0.4.2", "wasmer-runtime-core 0.4.2", ] @@ -2436,7 +2437,7 @@ dependencies = [ "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)", "page_size 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2459,7 +2460,7 @@ dependencies = [ "dynasmrt 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "nix 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)", "smallvec 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.4.2", @@ -2485,7 +2486,7 @@ dependencies = [ "generational-arena 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", "rand 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-clif-backend 0.4.2", @@ -2500,8 +2501,8 @@ name = "wasmer-win-exception-handler" version = "0.4.2" dependencies = [ "bindgen 0.46.0 (registry+https://github.com/rust-lang/crates.io-index)", - "cmake 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "cmake 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-runtime-core 0.4.2", "winapi 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2518,7 +2519,7 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -2581,29 +2582,28 @@ name = "xattr" version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "zbox" -version = "0.6.1" -source = "git+https://github.com/wasmerio/zbox?branch=bundle-libsodium#2636be2907eddfdaa23e1cd385416e804663a2dd" +version = "0.7.1" +source = "git+https://github.com/zboxfs/zbox#e7f4c8a9a22d8a2052c6f8fe6e2506d2dad6dfec" dependencies = [ "android_logger 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)", "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", - "cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)", + "cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)", "libflate 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", "linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "lz4 1.23.1 (git+https://github.com/zboxfs/lz4-rs.git)", "pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", - "reqwest 0.9.16 (registry+https://github.com/rust-lang/crates.io-index)", + "reqwest 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)", "rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.91 (registry+https://github.com/rust-lang/crates.io-index)", - "tar 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)", - "tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)", + "tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)", + "tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "zip 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2632,7 +2632,7 @@ name = "zstd-safe" version = "1.4.9+zstd.1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", "zstd-sys 1.4.10+zstd.1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -2641,9 +2641,9 @@ name = "zstd-sys" version = "1.4.10+zstd.1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)", + "cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)", "glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)", ] [metadata] @@ -2655,8 +2655,8 @@ dependencies = [ "checksum arrayref 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0d382e583f07208808f6b1249e60848879ba3543f57c32277bf52d69c2f0f0ee" "checksum arrayvec 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "92c7fb76bc8826a8b33b4ee5bb07a247a81e76764ab4d55e8f73e3a4d8808c71" "checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652" -"checksum autocfg 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a6d640bee2da49f60a4068a7fae53acde8982514ab7bae8b8cea9e88cbcfd799" -"checksum backtrace 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "f106c02a3604afcdc0df5d36cc47b44b55917dbaf3d808f71c163a0ddba64637" +"checksum autocfg 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "0e49efa51329a5fd37e7c79db4621af617cd4e3e5bc224939808d076077077bf" +"checksum backtrace 0.3.20 (registry+https://github.com/rust-lang/crates.io-index)" = "45934a579eff9fd0ff637ac376a4bd134f47f8fc603f0b211d696b54d61e35f1" "checksum backtrace-sys 0.1.28 (registry+https://github.com/rust-lang/crates.io-index)" = "797c830ac25ccc92a7f8a7b9862bde440715531514594a6154e3d4a54dd769b6" "checksum base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" "checksum bindgen 0.46.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8f7f7f0701772b17de73e4f5cbcb1dd6926f4706cba4c1ab62c5367f8bdc94e1" @@ -2671,16 +2671,16 @@ dependencies = [ "checksum capstone-sys 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2dc8d32bc5c1e6d0fcde10af411c98b07d93498d51654f678757f08fa2acd6a6" "checksum cast 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "926013f2860c46252efceabb19f4a6b308197505082c609025aa6706c011d427" "checksum cbindgen 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1f861ef68cabbb271d373a7795014052bff37edce22c620d95e395e8719d7dc5" -"checksum cc 1.0.36 (registry+https://github.com/rust-lang/crates.io-index)" = "a0c56216487bb80eec9c4516337b2588a4f2a2290d72a1416d930e4dcdb0c90d" +"checksum cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)" = "39f75544d7bbaf57560d2168f28fd649ff9c76153874db88bdbdfd839b1a7e7d" "checksum cexpr 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "a7fa24eb00d5ffab90eaeaf1092ac85c04c64aaf358ea6f84505b8116d24c6af" -"checksum cfg-if 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "11d43355396e872eefb45ce6342e4374ed7bc2b3a502d1b28e36d6e23c05d1f4" +"checksum cfg-if 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b486ce3ccf7ffd79fdeb678eac06a9e6c09fc88d33836340becb8fffe87c5e33" "checksum clang-sys 0.26.4 (registry+https://github.com/rust-lang/crates.io-index)" = "6ef0c1bcf2e99c649104bd7a7012d8f8802684400e03db0ec0af48583c6fa0e4" "checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -"checksum cmake 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "d9fc5523427cb1451da064f7db483d18bf8957e471baabf140ff683c37a86536" +"checksum cmake 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "2ca4386c8954b76a8415b63959337d940d724b336cabd3afe189c2b51a7e1ff0" "checksum constant_time_eq 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8ff012e225ce166d4422e0e78419d901719760f62ae2b7969ca6b564d1b54a9e" -"checksum cookie 0.11.1 (registry+https://github.com/rust-lang/crates.io-index)" = "99be24cfcf40d56ed37fd11c2123be833959bbc5bddecb46e1c2e442e15fa3e0" -"checksum cookie_store 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b0d2f2ecb21dce00e2453268370312978af9b8024020c7a37ae2cc6dbbe64685" +"checksum cookie 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" +"checksum cookie_store 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "46750b3f362965f197996c4448e4a0935e791bf7d6631bfce9ee0af3d24c919c" "checksum core-foundation 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "25b9e03f145fd4f2bf705e07b900cd41fc636598fe5dc452fd0db1441c3f496d" "checksum core-foundation-sys 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" "checksum cranelift-bforest 0.30.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e5a357d20666bf4a8c2d626a19f1b59dbca66cd844fb1e66c5612254fd0f7505" @@ -2717,7 +2717,7 @@ dependencies = [ "checksum failure 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "795bd83d3abeb9220f257e597aa0080a508b27533824adf336529648f6abf7e2" "checksum failure_derive 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "ea1063915fd7ef4309e222a5a07cf9c319fb9c7836b1f89b85458672dbb127e1" "checksum field-offset 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "64e9bc339e426139e02601fa69d101e96a92aee71b58bc01697ec2a63a5c9e68" -"checksum filetime 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2f8c63033fcba1f51ef744505b3cad42510432b904c062afa67ad7ece008429d" +"checksum filetime 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "450537dc346f0c4d738dda31e790da1da5d4bd12145aad4da0d03d713cb3794f" "checksum flate2 1.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "f87e68aa82b2de08a6e037f1385455759df6e445a8df5e005b4297191dbf18aa" "checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3" "checksum foreign-types 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" @@ -2732,14 +2732,15 @@ dependencies = [ "checksum generic-array 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c0f28c2f5bfb5960175af447a2da7c18900693738343dc896ffbcabd9839592" "checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb" "checksum goblin 0.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "84473a5302fa5094d3d9911c2f312f522f9a37462a777f195f63fae1bf7faf4d" -"checksum h2 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)" = "85ab6286db06040ddefb71641b50017c06874614001a134b423783e2db2920bd" +"checksum h2 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "2b53def7bb0253af7718036fe9338c15defd209136819464384f3a553e07481b" "checksum hashbrown 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "3bae29b6653b3412c2e71e9d486db9f9df5d701941d86683005efb9f2d28e3da" "checksum heck 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" "checksum hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" "checksum http 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)" = "eed324f0f0daf6ec10c474f150505af2c143f251722bf9dbd1261bd1f2ee2c1a" +"checksum http-body 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" "checksum httparse 1.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "e8734b0cfd3bc3e101ec59100e101c2eecd19282202e87808b3037b442777a83" "checksum humantime 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3ca7e5f2e110db35f93b837c81797f3714500b81d517bf20c431b16d3ca4f114" -"checksum hyper 0.12.28 (registry+https://github.com/rust-lang/crates.io-index)" = "e8e4606fed1c162e3a63d408c07584429f49a4f34c7176cb6cbee60e78f2372c" +"checksum hyper 0.12.29 (registry+https://github.com/rust-lang/crates.io-index)" = "e2cd6adf83b3347d36e271f030621a8cf95fd1fd0760546b9fc5a24a0f1447c7" "checksum hyper-tls 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "3a800d6aa50af4b5850b2b0f659625ce9504df908e9733b635720483be26174f" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" "checksum indexmap 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7e81a7c05f79578dbc15793d8b619db9ba32b4577003ef3af1a91c416798c58d" @@ -2750,16 +2751,13 @@ dependencies = [ "checksum itoa 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "501266b7edd0174f8530248f87f99c88fbe60ca4ef3dd486835b8d8d53136f7f" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" "checksum lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bc5729f27f159ddd61f4df6228e827e86643d4d3e7c32183cb30a1c08f604a14" -"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" -"checksum libc 0.2.54 (registry+https://github.com/rust-lang/crates.io-index)" = "c6785aa7dd976f5fbf3b71cfd9cd49d7f783c1ff565a858d71031c6c313aa5c6" +"checksum libc 0.2.55 (registry+https://github.com/rust-lang/crates.io-index)" = "42914d39aad277d9e176efbdad68acb1d5443ab65afe0e0e4f0d49352a950880" "checksum libflate 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)" = "c52384aeb22d0ce82a10d8ddf35f7fb4717d1b23eac5b94cd38d2050fb53766a" "checksum libloading 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9c3ad660d7cb8c5822cd83d10897b0f1f1526792737a179e73896152f85b88c2" "checksum linked-hash-map 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ae91b68aebc4ddb91978b11a1b02ddd8602a05ec19002801c5666000e05e0f83" -"checksum llvm-sys 70.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60a9ee82fe0fa72ae6ef6d018b407296085863836451c7a97384f84ed7e26b9f" +"checksum llvm-sys 70.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a2cb392cf218dbb2d2c4f0fe54b8622871f8897a1d62d24a117dcf540bba124" "checksum lock_api 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "62ebf1391f6acad60e5c8b43706dde4582df75c06698ab44511d15016bc2442c" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" -"checksum lz4 1.23.1 (git+https://github.com/zboxfs/lz4-rs.git)" = "" -"checksum lz4-sys 1.8.3 (git+https://github.com/zboxfs/lz4-rs.git)" = "" "checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08" "checksum memchr 2.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2efc7bc57c883d4a4d6e3246905283d8dae951bb3bd32f49d6ef297f546e1c39" "checksum memmap 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e2ffa2c986de11a9df78620c01eeaaf27d94d3ff02bf81bfcca953102dd0c6ff" @@ -2769,7 +2767,7 @@ dependencies = [ "checksum mime_guess 2.0.0-alpha.6 (registry+https://github.com/rust-lang/crates.io-index)" = "30de2e4613efcba1ec63d8133f344076952090c122992a903359be5a4f99c3ed" "checksum miniz_oxide 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c468f2369f07d651a5d0bb2c9079f8488a66d5466efe42d0c5c6466edcb7f71e" "checksum miniz_oxide_c_api 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b7fe927a42e3807ef71defb191dc87d4e24479b221e67015fe38ae2b7b447bab" -"checksum mio 0.6.16 (registry+https://github.com/rust-lang/crates.io-index)" = "71646331f2619b1026cc302f87a2b8b648d5c6dd6937846a16cc8ce0f347f432" +"checksum mio 0.6.17 (registry+https://github.com/rust-lang/crates.io-index)" = "049ba5ca2b63e837adeee724aa9e36b408ed593529dcc802aa96ca14bd329bdf" "checksum miow 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" "checksum native-tls 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4b2df1a4c22fd44a62147fd8f13dd0f95c9d8ca7b2610299b2a2f9cf8964274e" "checksum net2 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "42550d9fb7b6684a6d404d9fa7250c2eb2646df731d1c06afc06dcee9e1bcf88" @@ -2778,12 +2776,12 @@ dependencies = [ "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum nom 4.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2ad2a91a8e869eeb30b9cb3119ae87773a8f4ae617f41b1eb9c154b2905f7bd6" "checksum num-traits 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)" = "92e5113e9fd4cc14ded8e499429f396a20f98c772a47cc8622a736e1ec843c31" -"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" +"checksum num-traits 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "6ba9a427cfca2be13aa6f6403b0b7e7368fe982bfa16fccc450ce74c46cd9b32" "checksum num_cpus 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1a23f0ed30a54abaa0c7e83b1d2d87ada7c3c23078d1d87815af3e3b6385fbba" "checksum numtoa 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef" -"checksum openssl 0.10.22 (registry+https://github.com/rust-lang/crates.io-index)" = "a51f452b82d622fc8dd973d7266e9055ac64af25b957d9ced3989142dc61cb6b" +"checksum openssl 0.10.23 (registry+https://github.com/rust-lang/crates.io-index)" = "97c140cbb82f3b3468193dd14c1b88def39f341f68257f8a7fe8ed9ed3f628a5" "checksum openssl-probe 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de" -"checksum openssl-sys 0.9.46 (registry+https://github.com/rust-lang/crates.io-index)" = "05636e06b4f8762d4b81d24a351f3966f38bd25ccbcfd235606c91fdb82cc60f" +"checksum openssl-sys 0.9.47 (registry+https://github.com/rust-lang/crates.io-index)" = "75bdd6dbbb4958d38e47a1d2348847ad1eb4dc205dc5d37473ae504391865acc" "checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37" "checksum owning_ref 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "49a4b8ea2179e6a2e27411d3bca09ca6dd630821cf6894c6c7c8467a8ee7ef13" "checksum page_size 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f89ef58b3d32420dbd1a43d2f38ae92f6239ef12bb556ab09ca55445f5a67242" @@ -2824,7 +2822,7 @@ dependencies = [ "checksum regex 1.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "8f0a0bcab2fd7d1d7c54fa9eae6f43eddeb9ce2e7352f8518a814a4f65d60c58" "checksum regex-syntax 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dcfd8681eebe297b81d98498869d4aae052137651ad7b96822f09ceb690d0a96" "checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5" -"checksum reqwest 0.9.16 (registry+https://github.com/rust-lang/crates.io-index)" = "ddcfd2c13c6af0f9c45a1086be3b9c68af79e4430b42790759e2d34cce2a6c60" +"checksum reqwest 0.9.17 (registry+https://github.com/rust-lang/crates.io-index)" = "e57803405f8ea0eb041c1567dac36127e0c8caa1251c843cb03d43fd767b3d50" "checksum rmp 0.8.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a3d45d7afc9b132b34a2479648863aa95c5c88e98b32285326a6ebadc80ec5c9" "checksum rmp-serde 0.13.7 (registry+https://github.com/rust-lang/crates.io-index)" = "011e1d58446e9fa3af7cdc1fb91295b10621d3ac4cb3a85cc86385ee9ca50cd3" "checksum rustc-demangle 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "ccc78bfd5acd7bf3e89cffcf899e5cb1a52d6fafa8dec2739ad70c9577a57288" @@ -2857,19 +2855,20 @@ dependencies = [ "checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad" "checksum syn 0.15.34 (registry+https://github.com/rust-lang/crates.io-index)" = "a1393e4a97a19c01e900df2aec855a29f71cf02c402e2f443b8d2747c25c5dbe" "checksum synom 0.11.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a393066ed9010ebaed60b9eafa373d4b1baac186dd7e008555b0f702b51945b6" -"checksum synstructure 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "73687139bf99285483c96ac0add482c3776528beac1d97d444f6e91f203a2015" +"checksum synstructure 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)" = "02353edf96d6e4dc81aea2d8490a7e9db177bf8acb0e951c24940bf866cb313f" "checksum take_mut 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" -"checksum tar 0.4.25 (registry+https://github.com/rust-lang/crates.io-index)" = "7201214ded95b34e3bc00c9557b6dcec34fd1af428d343143f5db67c661762f0" +"checksum tar 0.4.26 (registry+https://github.com/rust-lang/crates.io-index)" = "b3196bfbffbba3e57481b6ea32249fbaf590396a52505a2615adbb79d9d826d3" "checksum target-lexicon 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d6923974ce4eb5bd28814756256d8ab71c28dd6e7483313fe7ab6614306bf633" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" -"checksum tempfile 3.0.7 (registry+https://github.com/rust-lang/crates.io-index)" = "b86c784c88d98c801132806dadd3819ed29d8600836c4088e855cdf3e178ed8a" +"checksum tempfile 3.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7dc4738f2e68ed2855de5ac9cdbe05c9216773ecde4739b2f095002ab03a13ef" "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f" "checksum termion 1.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dde0593aeb8d47accea5392b39350015b5eccb12c0d98044d856983d89548dea" "checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b" "checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" = "db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f" -"checksum tinytemplate 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7655088894274afb52b807bd3c87072daa1fedd155068b8705cabfd628956115" -"checksum tokio 0.1.19 (registry+https://github.com/rust-lang/crates.io-index)" = "cec6c34409089be085de9403ba2010b80e36938c9ca992c4f67f407bb13db0b1" +"checksum tinytemplate 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "4574b75faccaacddb9b284faecdf0b544b80b6b294f3d062d325c5726a209c20" +"checksum tokio 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)" = "94a1f9396aec29d31bb16c24d155cfa144d1af91c40740125db3131bdaf76da8" +"checksum tokio-buf 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" "checksum tokio-current-thread 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "d16217cad7f1b840c5a97dfb3c43b0c871fef423a6e8d2118c604e843662a443" "checksum tokio-executor 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "83ea44c6c0773cc034771693711c35c677b4b5a4b21b9e7071704c54de7d555e" "checksum tokio-io 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "5090db468dad16e1a7a54c8c67280c5e4b544f3d3e018f0b913b400261f85926" @@ -2877,7 +2876,7 @@ dependencies = [ "checksum tokio-sync 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5b2f843ffdf8d6e1f90bddd48da43f99ab071660cd92b7ec560ef3cdfd7a409a" "checksum tokio-tcp 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1d14b10654be682ac43efee27401d792507e30fd8d26389e1da3b185de2e4119" "checksum tokio-threadpool 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "72558af20be886ea124595ea0f806dd5703b8958e4705429dd58b3d8231f72f2" -"checksum tokio-timer 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)" = "2910970404ba6fa78c5539126a9ae2045d62e3713041e447f695f41405a120c6" +"checksum tokio-timer 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "f2106812d500ed25a4f38235b9cae8f78a09edf43203e16e59c3b769a342a60e" "checksum tokio-trace-core 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "350c9edade9830dc185ae48ba45667a445ab59f6167ef6d0254ec9d2430d9dd3" "checksum toml 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "758664fc71a3a69038656bee8b6be6477d2a6c315a6b81f7081f591bffa4111f" "checksum try-lock 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e604eb7b43c06650e854be16a2a03155743d3752dd1c943f6829e26b7a36e382" @@ -2888,7 +2887,7 @@ dependencies = [ "checksum unicase 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a84e5511b2a947f3ae965dcb29b13b7b1691b6e7332cf5dbc1744138d5acb7f6" "checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5" "checksum unicode-normalization 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "141339a08b982d942be2ca06ff8b076563cbe223d1befd5450716790d44e2426" -"checksum unicode-segmentation 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "aa6024fc12ddfd1c6dbc14a80fa2324d4568849869b779f6bd37e5e4c03344d1" +"checksum unicode-segmentation 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1967f4cdfc355b37fd76d2a954fb2ed3871034eb4f26d60537d88795cfc332a9" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8c1f860d7d29cf02cb2f3f359fd35991af3d30bac52c57d265a3c461074cb4dc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" @@ -2914,7 +2913,7 @@ dependencies = [ "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xattr 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "244c3741f4240ef46274860397c7c74e50eb23624996930e484c16679633a54c" -"checksum zbox 0.6.1 (git+https://github.com/wasmerio/zbox?branch=bundle-libsodium)" = "" +"checksum zbox 0.7.1 (git+https://github.com/zboxfs/zbox)" = "" "checksum zip 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c18fc320faf909036e46ac785ea827f72e485304877faf1a3a39538d3714dbc3" "checksum zstd 0.4.24+zstd.1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2c5a6414958b49ee80f2dd0042023ac8f37cfe1d31fbeec0b9749cf6f2c03683" "checksum zstd-safe 1.4.9+zstd.1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d98332212af687878b146a6549c188e9b72971972d23089c831472f938e6272" diff --git a/lib/runtime-abi/Cargo.toml b/lib/runtime-abi/Cargo.toml index f9617a1008d..bc3b18fdfda 100644 --- a/lib/runtime-abi/Cargo.toml +++ b/lib/runtime-abi/Cargo.toml @@ -17,9 +17,7 @@ wasmparser = "0.29.2" zstd = "0.4" [target.'cfg(unix)'.dependencies.zbox] -git = "https://github.com/wasmerio/zbox" -branch = "bundle-libsodium" -features = ["libsodium-bundled"] +git = "https://github.com/zboxfs/zbox" [dev-dependencies] tempdir = "0.3" From b834b4ff36c25dc138ac130c5ecd3f8ab06cc195 Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 31 May 2019 15:36:08 +0800 Subject: [PATCH 11/30] Metering for LLVM. --- lib/llvm-backend/src/backend.rs | 23 +++++++++- lib/llvm-backend/src/code.rs | 72 +++++++++++++++++++++++++----- lib/llvm-backend/src/intrinsics.rs | 40 ++++++++++++++++- lib/llvm-backend/src/lib.rs | 2 +- lib/runtime-abi/Cargo.toml | 5 --- src/bin/wasmer.rs | 20 ++++++--- 6 files changed, 138 insertions(+), 24 deletions(-) diff --git a/lib/llvm-backend/src/backend.rs b/lib/llvm-backend/src/backend.rs index 7a8c6c64ac8..4824141a60b 100644 --- a/lib/llvm-backend/src/backend.rs +++ b/lib/llvm-backend/src/backend.rs @@ -24,6 +24,7 @@ use wasmer_runtime_core::{ CacheGen, RunnableModule, }, cache::Error as CacheError, + codegen::BkptInfo, module::ModuleInfo, structures::TypedIndex, typed_func::{Wasm, WasmTrapInfo}, @@ -190,6 +191,8 @@ fn get_callbacks() -> Callbacks { fn_name!("vm.exception.trap") => throw_trap as _, + fn_name!("vm.breakpoint") => vm_breakpoint as _, + _ => ptr::null(), } } @@ -209,6 +212,19 @@ fn get_callbacks() -> Callbacks { } } +unsafe extern "C" fn vm_breakpoint(_ctx: &mut vm::Ctx, breakpoints: *const Vec>, index: u32) -> i32 { + unsafe extern "C" fn do_throw() -> ! { + let ptr: *mut i32 = ::std::ptr::null_mut(); + *ptr = 42; + ::std::process::abort(); + } + let breakpoints: &Vec<_> = &*breakpoints; + breakpoints[index as usize](BkptInfo { + throw: do_throw, + }); + 0 +} + pub enum Buffer { LlvmMemory(MemoryBuffer), Memory(Memory), @@ -231,10 +247,11 @@ pub struct LLVMBackend { module: *mut LLVMModule, #[allow(dead_code)] buffer: Arc, + breakpoints: Box>>, } impl LLVMBackend { - pub fn new(module: Module, _intrinsics: Intrinsics) -> (Self, LLVMCache) { + pub fn new(module: Module, _intrinsics: Intrinsics, breakpoints: Box>>) -> (Self, LLVMCache) { Target::initialize_x86(&InitializationConfig { asm_parser: true, asm_printer: true, @@ -289,12 +306,13 @@ impl LLVMBackend { Self { module, buffer: Arc::clone(&buffer), + breakpoints, }, LLVMCache { buffer }, ) } - pub unsafe fn from_buffer(memory: Memory) -> Result<(Self, LLVMCache), String> { + pub unsafe fn from_buffer(memory: Memory, breakpoints: Box>>) -> Result<(Self, LLVMCache), String> { let callbacks = get_callbacks(); let mut module: *mut LLVMModule = ptr::null_mut(); @@ -318,6 +336,7 @@ impl LLVMBackend { Self { module, buffer: Arc::clone(&buffer), + breakpoints, }, LLVMCache { buffer }, )) diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index aecf6fd74ae..4662ef34594 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -398,6 +398,7 @@ pub struct LLVMFunctionCodeGenerator { num_params: usize, ctx: Option>, unreachable_depth: usize, + breakpoints: Option>>>, } impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { @@ -470,13 +471,12 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { } fn feed_event(&mut self, event: Event, module_info: &ModuleInfo) -> Result<(), CodegenError> { - let op = match event { - Event::Wasm(x) => x, - Event::WasmOwned(ref x) => x, - Event::Internal(_x) => { + match event { + Event::Internal(InternalEvent::FunctionBegin(_)) | Event::Internal(InternalEvent::FunctionEnd) => { return Ok(()); } - }; + _ => {} + } let mut state = &mut self.state; let builder = self.builder.as_ref().unwrap(); @@ -489,6 +489,13 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { let mut ctx = self.ctx.as_mut().unwrap(); if !state.reachable { + let op = match event { + Event::Wasm(x) => x, + Event::WasmOwned(ref x) => x, + Event::Internal(_x) => { + return Ok(()); + } + }; match *op { Operator::Block { ty: _ } | Operator::Loop { ty: _ } | Operator::If { ty: _ } => { self.unreachable_depth += 1; @@ -511,6 +518,44 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { } } + let op = match event { + Event::Wasm(x) => x, + Event::WasmOwned(ref x) => x, + Event::Internal(x) => { + match x { + InternalEvent::Breakpoint(handler) => { + let mut breakpoints = self.breakpoints.as_mut().unwrap(); + breakpoints.push(handler); + let ptr: *mut Vec<_> = &mut **breakpoints; + let ptr_const = intrinsics + .i64_ty + .const_int(ptr as usize as u64, false) + .as_basic_value_enum(); + builder.build_call( + intrinsics.breakpoint, + &[ctx.basic(), ptr_const, intrinsics + .i32_ty + .const_int((breakpoints.len() - 1) as u64, false) + .as_basic_value_enum()], + &state.var_name(), + ); + }, + InternalEvent::GetInternal(index) => { + let ptr = ctx.internal_pointer(index as usize, intrinsics); + let value = builder.build_load(ptr, "internal_value"); + state.push1(value); + } + InternalEvent::SetInternal(index) => { + let value = state.pop1()?; + let ptr = ctx.internal_pointer(index as usize, intrinsics); + builder.build_store(ptr, value); + } + _ => {} + } + return Ok(()); + } + }; + match *op { /*************************** * Control Flow instructions. @@ -2508,16 +2553,18 @@ impl ModuleCodeGenerator fn next_function(&mut self) -> Result<&mut LLVMFunctionCodeGenerator, CodegenError> { // Creates a new function and returns the function-scope code generator for it. - let (context, builder, intrinsics) = match self.functions.last_mut() { + let (context, builder, intrinsics, breakpoints) = match self.functions.last_mut() { Some(x) => ( x.context.take().unwrap(), x.builder.take().unwrap(), x.intrinsics.take().unwrap(), + x.breakpoints.take().unwrap(), ), None => ( self.context.take().unwrap(), self.builder.take().unwrap(), self.intrinsics.take().unwrap(), + Box::new(Vec::new()), ), }; @@ -2576,6 +2623,7 @@ impl ModuleCodeGenerator num_params, ctx: None, unreachable_depth: 0, + breakpoints: Some(breakpoints), }; self.functions.push(code); Ok(self.functions.last_mut().unwrap()) @@ -2585,16 +2633,18 @@ impl ModuleCodeGenerator mut self, module_info: &ModuleInfo, ) -> Result<(LLVMBackend, Box), CodegenError> { - let (context, builder, intrinsics) = match self.functions.last_mut() { + let (context, builder, intrinsics, breakpoints) = match self.functions.last_mut() { Some(x) => ( x.context.take().unwrap(), x.builder.take().unwrap(), x.intrinsics.take().unwrap(), + x.breakpoints.take().unwrap(), ), None => ( self.context.take().unwrap(), self.builder.take().unwrap(), self.intrinsics.take().unwrap(), + Box::new(Vec::new()), ), }; self.context = Some(context); @@ -2625,7 +2675,7 @@ impl ModuleCodeGenerator // self.module.print_to_stderr(); - let (backend, cache_gen) = LLVMBackend::new(self.module, self.intrinsics.take().unwrap()); + let (backend, cache_gen) = LLVMBackend::new(self.module, self.intrinsics.take().unwrap(), breakpoints); Ok((backend, Box::new(cache_gen))) } @@ -2657,7 +2707,9 @@ impl ModuleCodeGenerator Ok(()) } - unsafe fn from_cache(artifact: Artifact, _: Token) -> Result { + unsafe fn from_cache(_artifact: Artifact, _: Token) -> Result { + Err(CacheError::Unknown("caching is broken for LLVM backend".into())) + /* let (info, _, memory) = artifact.consume(); let (backend, cache_gen) = LLVMBackend::from_buffer(memory).map_err(CacheError::DeserializeError)?; @@ -2667,6 +2719,6 @@ impl ModuleCodeGenerator cache_gen: Box::new(cache_gen), info, - }) + })*/ } } diff --git a/lib/llvm-backend/src/intrinsics.rs b/lib/llvm-backend/src/intrinsics.rs index 2198821ed9f..c3982857ca5 100644 --- a/lib/llvm-backend/src/intrinsics.rs +++ b/lib/llvm-backend/src/intrinsics.rs @@ -113,6 +113,8 @@ pub struct Intrinsics { pub memory_size_static_import: FunctionValue, pub memory_size_shared_import: FunctionValue, + pub breakpoint: FunctionValue, + pub throw_trap: FunctionValue, pub ctx_ptr_ty: PointerType, @@ -163,7 +165,7 @@ impl Intrinsics { let stack_lower_bound_ty = i8_ty; let memory_base_ty = i8_ty; let memory_bound_ty = void_ty; - let internals_ty = void_ty; + let internals_ty = i64_ty; let local_function_ty = i8_ptr_ty; let anyfunc_ty = context.struct_type( @@ -250,6 +252,8 @@ impl Intrinsics { let ret_i1_take_i1_i1 = i1_ty.fn_type(&[i1_ty_basic, i1_ty_basic], false); + let ret_i32_take_ctx_i64_i32 = i32_ty.fn_type(&[ctx_ptr_ty.as_basic_type_enum(), i64_ty_basic, i32_ty_basic], false); + Self { ctlz_i32: module.add_function("llvm.ctlz.i32", ret_i32_take_i32_i1, None), ctlz_i64: module.add_function("llvm.ctlz.i64", ret_i64_take_i64_i1, None), @@ -382,6 +386,11 @@ impl Intrinsics { ret_i32_take_ctx_i32, None, ), + breakpoint: module.add_function( + "vm.breakpoint", + ret_i32_take_ctx_i64_i32, + None, + ), throw_trap: module.add_function( "vm.exception.trap", void_ty.fn_type(&[i32_ty_basic], false), @@ -432,6 +441,7 @@ pub struct CtxType<'a> { cached_tables: HashMap, cached_sigindices: HashMap, cached_globals: HashMap, + cached_internals: HashMap, cached_imported_functions: HashMap, _phantom: PhantomData<&'a FunctionValue>, @@ -457,6 +467,7 @@ impl<'a> CtxType<'a> { cached_tables: HashMap::new(), cached_sigindices: HashMap::new(), cached_globals: HashMap::new(), + cached_internals: HashMap::new(), cached_imported_functions: HashMap::new(), _phantom: PhantomData, @@ -680,6 +691,33 @@ impl<'a> CtxType<'a> { }) } + pub fn internal_pointer(&mut self, index: usize, intrinsics: &Intrinsics) -> PointerValue { + let (cached_internals, ctx_ptr_value, _info, cache_builder) = ( + &mut self.cached_internals, + self.ctx_ptr_value, + self.info, + &self.cache_builder, + ); + *cached_internals.entry(index).or_insert_with(|| { + let array_ptr_ptr = unsafe { + cache_builder.build_struct_gep( + ctx_ptr_value, + offset_to_index(Ctx::offset_internals()), + "internals_array_ptr_ptr", + ) + }; + let array_ptr = cache_builder.build_load(array_ptr_ptr, "internals_array_ptr").into_pointer_value(); + let const_index = intrinsics.i32_ty.const_int(index as u64, false); + unsafe { + cache_builder.build_in_bounds_gep( + array_ptr, + &[const_index], + "element_ptr", + ) + } + }) + } + pub fn global_cache(&mut self, index: GlobalIndex, intrinsics: &Intrinsics) -> GlobalCache { let (cached_globals, ctx_ptr_value, info, cache_builder) = ( &mut self.cached_globals, diff --git a/lib/llvm-backend/src/lib.rs b/lib/llvm-backend/src/lib.rs index 6d8816af8a3..8c8685d7910 100644 --- a/lib/llvm-backend/src/lib.rs +++ b/lib/llvm-backend/src/lib.rs @@ -2,7 +2,7 @@ #![cfg_attr(nightly, feature(unwind_attributes))] mod backend; -mod code; +pub mod code; mod intrinsics; mod platform; mod read_info; diff --git a/lib/runtime-abi/Cargo.toml b/lib/runtime-abi/Cargo.toml index b989618a00e..865d67f182f 100644 --- a/lib/runtime-abi/Cargo.toml +++ b/lib/runtime-abi/Cargo.toml @@ -16,15 +16,10 @@ tar = "0.4" wasmparser = "0.30.0" zstd = "0.4" -<<<<<<< HEAD -[target.'cfg(unix)'.dependencies.zbox] -git = "https://github.com/zboxfs/zbox" -======= # [target.'cfg(unix)'.dependencies.zbox] # git = "https://github.com/wasmerio/zbox" # branch = "bundle-libsodium" # features = ["libsodium-bundled"] ->>>>>>> origin/master [dev-dependencies] tempdir = "0.3" diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 9a5e6916c6a..3122631d397 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -16,8 +16,9 @@ use structopt::StructOpt; use wasmer::*; use wasmer_clif_backend::CraneliftCompiler; #[cfg(feature = "backend:llvm")] -use wasmer_llvm_backend::LLVMCompiler; -#[cfg(feature = "backend:singlepass")] +use wasmer_llvm_backend::{ + code::LLVMModuleCodeGenerator, +}; use wasmer_middleware_common::metering::Metering; use wasmer_runtime::{ cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH}, @@ -336,7 +337,16 @@ fn execute_wasm(options: &Run) -> Result<(), String> { Backend::Singlepass => return Err("The singlepass backend is not enabled".to_string()), Backend::Cranelift => Box::new(CraneliftCompiler::new()), #[cfg(feature = "backend:llvm")] - Backend::LLVM => Box::new(LLVMCompiler::new()), + Backend::LLVM => { + let c: StreamingCompiler = StreamingCompiler::new(|| { + let mut chain = MiddlewareChain::new(); + if let Some(limit) = options.instruction_limit { + chain.push(Metering::new(limit)); + } + chain + }); + Box::new(c) + }, #[cfg(not(feature = "backend:llvm"))] Backend::LLVM => return Err("the llvm backend is not enabled".to_string()), }; @@ -527,11 +537,11 @@ fn execute_wasm(options: &Run) -> Result<(), String> { .map(|arg| arg.as_str()) .map(|x| Value::I32(x.parse().unwrap())) .collect(); - instance + println!("{:?}", instance .dyn_func("main") .map_err(|e| format!("{:?}", e))? .call(&args) - .map_err(|e| format!("{:?}", e))?; + .map_err(|e| format!("{:?}", e))?); } } From c1e817b3fb077beb24189a3ba104caef3eba7d39 Mon Sep 17 00:00:00 2001 From: losfair Date: Fri, 31 May 2019 19:29:28 +0800 Subject: [PATCH 12/30] Add missing relaxed moves. --- lib/singlepass-backend/src/codegen_x64.rs | 63 ++++++++++++++++++++--- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/lib/singlepass-backend/src/codegen_x64.rs b/lib/singlepass-backend/src/codegen_x64.rs index c59b524edb7..9baa15c22d8 100644 --- a/lib/singlepass-backend/src/codegen_x64.rs +++ b/lib/singlepass-backend/src/codegen_x64.rs @@ -2708,7 +2708,14 @@ impl FunctionCodeGenerator for X64FunctionCode { let tmp_out = self.machine.acquire_temp_gpr().unwrap(); let tmp_in = self.machine.acquire_temp_xmm().unwrap(); - a.emit_mov(Size::S32, loc, Location::XMM(tmp_in)); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S32, + loc, + Location::XMM(tmp_in), + ); Self::emit_f32_int_conv_check(a, &mut self.machine, tmp_in, -1.0, 4294967296.0); a.emit_cvttss2si_64(XMMOrMemory::XMM(tmp_in), tmp_out); @@ -2726,7 +2733,14 @@ impl FunctionCodeGenerator for X64FunctionCode { let tmp_out = self.machine.acquire_temp_gpr().unwrap(); let tmp_in = self.machine.acquire_temp_xmm().unwrap(); - a.emit_mov(Size::S32, loc, Location::XMM(tmp_in)); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S32, + loc, + Location::XMM(tmp_in), + ); Self::emit_f32_int_conv_check( a, &mut self.machine, @@ -2750,7 +2764,14 @@ impl FunctionCodeGenerator for X64FunctionCode { let tmp_out = self.machine.acquire_temp_gpr().unwrap(); let tmp_in = self.machine.acquire_temp_xmm().unwrap(); - a.emit_mov(Size::S32, loc, Location::XMM(tmp_in)); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S32, + loc, + Location::XMM(tmp_in), + ); Self::emit_f32_int_conv_check( a, &mut self.machine, @@ -2788,7 +2809,14 @@ impl FunctionCodeGenerator for X64FunctionCode { let tmp_out = self.machine.acquire_temp_gpr().unwrap(); let tmp_in = self.machine.acquire_temp_xmm().unwrap(); // xmm2 - a.emit_mov(Size::S32, loc, Location::XMM(tmp_in)); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S32, + loc, + Location::XMM(tmp_in), + ); Self::emit_f32_int_conv_check( a, &mut self.machine, @@ -2836,7 +2864,14 @@ impl FunctionCodeGenerator for X64FunctionCode { let tmp_out = self.machine.acquire_temp_gpr().unwrap(); let tmp_in = self.machine.acquire_temp_xmm().unwrap(); - a.emit_mov(Size::S64, loc, Location::XMM(tmp_in)); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S64, + loc, + Location::XMM(tmp_in), + ); Self::emit_f64_int_conv_check(a, &mut self.machine, tmp_in, -1.0, 4294967296.0); a.emit_cvttsd2si_64(XMMOrMemory::XMM(tmp_in), tmp_out); @@ -2890,7 +2925,14 @@ impl FunctionCodeGenerator for X64FunctionCode { let tmp_out = self.machine.acquire_temp_gpr().unwrap(); let tmp_in = self.machine.acquire_temp_xmm().unwrap(); - a.emit_mov(Size::S64, loc, Location::XMM(tmp_in)); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S64, + loc, + Location::XMM(tmp_in), + ); Self::emit_f64_int_conv_check( a, &mut self.machine, @@ -2914,7 +2956,14 @@ impl FunctionCodeGenerator for X64FunctionCode { let tmp_out = self.machine.acquire_temp_gpr().unwrap(); let tmp_in = self.machine.acquire_temp_xmm().unwrap(); // xmm2 - a.emit_mov(Size::S64, loc, Location::XMM(tmp_in)); + Self::emit_relaxed_binop( + a, + &mut self.machine, + Assembler::emit_mov, + Size::S64, + loc, + Location::XMM(tmp_in), + ); Self::emit_f64_int_conv_check( a, &mut self.machine, From 995ecefa928e4087764ed77bd1e839217b8ae1c1 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 09:49:21 -0500 Subject: [PATCH 13/30] Cargo fmt --- lib/llvm-backend/src/backend.rs | 21 ++++++++++++------ lib/llvm-backend/src/code.rs | 24 ++++++++++++++------- lib/llvm-backend/src/intrinsics.rs | 23 ++++++++------------ src/bin/wasmer.rs | 34 ++++++++++++++++-------------- 4 files changed, 58 insertions(+), 44 deletions(-) diff --git a/lib/llvm-backend/src/backend.rs b/lib/llvm-backend/src/backend.rs index 4824141a60b..fa41e908ebb 100644 --- a/lib/llvm-backend/src/backend.rs +++ b/lib/llvm-backend/src/backend.rs @@ -212,16 +212,18 @@ fn get_callbacks() -> Callbacks { } } -unsafe extern "C" fn vm_breakpoint(_ctx: &mut vm::Ctx, breakpoints: *const Vec>, index: u32) -> i32 { +unsafe extern "C" fn vm_breakpoint( + _ctx: &mut vm::Ctx, + breakpoints: *const Vec>, + index: u32, +) -> i32 { unsafe extern "C" fn do_throw() -> ! { let ptr: *mut i32 = ::std::ptr::null_mut(); *ptr = 42; ::std::process::abort(); } let breakpoints: &Vec<_> = &*breakpoints; - breakpoints[index as usize](BkptInfo { - throw: do_throw, - }); + breakpoints[index as usize](BkptInfo { throw: do_throw }); 0 } @@ -251,7 +253,11 @@ pub struct LLVMBackend { } impl LLVMBackend { - pub fn new(module: Module, _intrinsics: Intrinsics, breakpoints: Box>>) -> (Self, LLVMCache) { + pub fn new( + module: Module, + _intrinsics: Intrinsics, + breakpoints: Box>>, + ) -> (Self, LLVMCache) { Target::initialize_x86(&InitializationConfig { asm_parser: true, asm_printer: true, @@ -312,7 +318,10 @@ impl LLVMBackend { ) } - pub unsafe fn from_buffer(memory: Memory, breakpoints: Box>>) -> Result<(Self, LLVMCache), String> { + pub unsafe fn from_buffer( + memory: Memory, + breakpoints: Box>>, + ) -> Result<(Self, LLVMCache), String> { let callbacks = get_callbacks(); let mut module: *mut LLVMModule = ptr::null_mut(); diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index 8ad7cdfce42..0069d0aee1e 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -472,7 +472,8 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { fn feed_event(&mut self, event: Event, module_info: &ModuleInfo) -> Result<(), CodegenError> { match event { - Event::Internal(InternalEvent::FunctionBegin(_)) | Event::Internal(InternalEvent::FunctionEnd) => { + Event::Internal(InternalEvent::FunctionBegin(_)) + | Event::Internal(InternalEvent::FunctionEnd) => { return Ok(()); } _ => {} @@ -533,13 +534,17 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { .as_basic_value_enum(); builder.build_call( intrinsics.breakpoint, - &[ctx.basic(), ptr_const, intrinsics - .i32_ty - .const_int((breakpoints.len() - 1) as u64, false) - .as_basic_value_enum()], + &[ + ctx.basic(), + ptr_const, + intrinsics + .i32_ty + .const_int((breakpoints.len() - 1) as u64, false) + .as_basic_value_enum(), + ], &state.var_name(), ); - }, + } InternalEvent::GetInternal(index) => { let ptr = ctx.internal_pointer(index as usize, intrinsics); let value = builder.build_load(ptr, "internal_value"); @@ -2678,7 +2683,8 @@ impl ModuleCodeGenerator // self.module.print_to_stderr(); - let (backend, cache_gen) = LLVMBackend::new(self.module, self.intrinsics.take().unwrap(), breakpoints); + let (backend, cache_gen) = + LLVMBackend::new(self.module, self.intrinsics.take().unwrap(), breakpoints); Ok((backend, Box::new(cache_gen))) } @@ -2711,7 +2717,9 @@ impl ModuleCodeGenerator } unsafe fn from_cache(_artifact: Artifact, _: Token) -> Result { - Err(CacheError::Unknown("caching is broken for LLVM backend".into())) + Err(CacheError::Unknown( + "caching is broken for LLVM backend".into(), + )) /* let (info, _, memory) = artifact.consume(); let (backend, cache_gen) = diff --git a/lib/llvm-backend/src/intrinsics.rs b/lib/llvm-backend/src/intrinsics.rs index c3982857ca5..34f985c14bb 100644 --- a/lib/llvm-backend/src/intrinsics.rs +++ b/lib/llvm-backend/src/intrinsics.rs @@ -252,7 +252,10 @@ impl Intrinsics { let ret_i1_take_i1_i1 = i1_ty.fn_type(&[i1_ty_basic, i1_ty_basic], false); - let ret_i32_take_ctx_i64_i32 = i32_ty.fn_type(&[ctx_ptr_ty.as_basic_type_enum(), i64_ty_basic, i32_ty_basic], false); + let ret_i32_take_ctx_i64_i32 = i32_ty.fn_type( + &[ctx_ptr_ty.as_basic_type_enum(), i64_ty_basic, i32_ty_basic], + false, + ); Self { ctlz_i32: module.add_function("llvm.ctlz.i32", ret_i32_take_i32_i1, None), @@ -386,11 +389,7 @@ impl Intrinsics { ret_i32_take_ctx_i32, None, ), - breakpoint: module.add_function( - "vm.breakpoint", - ret_i32_take_ctx_i64_i32, - None, - ), + breakpoint: module.add_function("vm.breakpoint", ret_i32_take_ctx_i64_i32, None), throw_trap: module.add_function( "vm.exception.trap", void_ty.fn_type(&[i32_ty_basic], false), @@ -706,15 +705,11 @@ impl<'a> CtxType<'a> { "internals_array_ptr_ptr", ) }; - let array_ptr = cache_builder.build_load(array_ptr_ptr, "internals_array_ptr").into_pointer_value(); + let array_ptr = cache_builder + .build_load(array_ptr_ptr, "internals_array_ptr") + .into_pointer_value(); let const_index = intrinsics.i32_ty.const_int(index as u64, false); - unsafe { - cache_builder.build_in_bounds_gep( - array_ptr, - &[const_index], - "element_ptr", - ) - } + unsafe { cache_builder.build_in_bounds_gep(array_ptr, &[const_index], "element_ptr") } }) } diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 387582aa19e..c97aa7c3ce6 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -16,9 +16,7 @@ use structopt::StructOpt; use wasmer::*; use wasmer_clif_backend::CraneliftCompiler; #[cfg(feature = "backend:llvm")] -use wasmer_llvm_backend::{ - code::LLVMModuleCodeGenerator, -}; +use wasmer_llvm_backend::code::LLVMModuleCodeGenerator; use wasmer_runtime::{ cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH}, error::RuntimeError, @@ -361,15 +359,16 @@ fn execute_wasm(options: &Run) -> Result<(), String> { Backend::Cranelift => Box::new(CraneliftCompiler::new()), #[cfg(feature = "backend:llvm")] Backend::LLVM => { - let c: StreamingCompiler = StreamingCompiler::new(|| { - let mut chain = MiddlewareChain::new(); - if let Some(limit) = options.instruction_limit { - chain.push(Metering::new(limit)); - } - chain - }); + let c: StreamingCompiler = + StreamingCompiler::new(|| { + let mut chain = MiddlewareChain::new(); + if let Some(limit) = options.instruction_limit { + chain.push(Metering::new(limit)); + } + chain + }); Box::new(c) - }, + } #[cfg(not(feature = "backend:llvm"))] Backend::LLVM => return Err("the llvm backend is not enabled".to_string()), }; @@ -558,11 +557,14 @@ fn execute_wasm(options: &Run) -> Result<(), String> { .map(|arg| arg.as_str()) .map(|x| Value::I32(x.parse().unwrap())) .collect(); - println!("{:?}", instance - .dyn_func("main") - .map_err(|e| format!("{:?}", e))? - .call(&args) - .map_err(|e| format!("{:?}", e))?); + println!( + "{:?}", + instance + .dyn_func("main") + .map_err(|e| format!("{:?}", e))? + .call(&args) + .map_err(|e| format!("{:?}", e))? + ); } } From e533a8a7b580d8caff576a3852b772f4c564479e Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 11:37:02 -0500 Subject: [PATCH 14/30] Add tests for metering, add option to compiler config --- Cargo.lock | 4 + lib/middleware-common/Cargo.toml | 11 ++ lib/middleware-common/src/metering.rs | 152 ++++++++++++++++++++++++++ lib/runtime-core/src/backend.rs | 2 + lib/runtime-core/src/vm.rs | 10 ++ 5 files changed, 179 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index d2c1458525d..840c7748cf5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1460,7 +1460,11 @@ dependencies = [ name = "wasmer-middleware-common" version = "0.4.2" dependencies = [ + "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", + "wasmer-clif-backend 0.4.2", + "wasmer-llvm-backend 0.4.2", "wasmer-runtime-core 0.4.2", + "wasmer-singlepass-backend 0.4.2", ] [[package]] diff --git a/lib/middleware-common/Cargo.toml b/lib/middleware-common/Cargo.toml index 1099dda95e0..be5517fbb80 100644 --- a/lib/middleware-common/Cargo.toml +++ b/lib/middleware-common/Cargo.toml @@ -9,3 +9,14 @@ edition = "2018" [dependencies] wasmer-runtime-core = { path = "../runtime-core" } +wasmer-clif-backend = { path = "../clif-backend", version = "0.4.2" } +wasmer-llvm-backend = { path = "../llvm-backend", version = "0.4.2", optional = true } +wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.4.2", optional = true } + +[dev-dependencies] +wabt = "0.7.4" + +[features] +clif = [] +llvm = ["wasmer-llvm-backend"] +singlepass = ["wasmer-singlepass-backend"] \ No newline at end of file diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index d7d33da128e..f547763b188 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -97,3 +97,155 @@ impl FunctionMiddleware for Metering { Ok(()) } } + +#[cfg(test)] +mod tests { + + use wabt::wat2wasm; + use wasmer_runtime_core::{ + backend::{Compiler, CompilerConfig}, + compile_with_config, imports, Func, + }; + + #[cfg(feature = "llvm")] + fn get_compiler() -> impl Compiler { + use wasmer_llvm_backend::LLVMCompiler; + LLVMCompiler::new() + } + + #[cfg(feature = "singlepass")] + fn get_compiler() -> impl Compiler { + use wasmer_singlepass_backend::SinglePassCompiler; + SinglePassCompiler::new() + } + + #[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))] + fn get_compiler() -> impl Compiler { + panic!("compiler not specified, activate a compiler via features"); + use wasmer_clif_backend::CraneliftCompiler; + CraneliftCompiler::new() + } + + // Assemblyscript + // export function add_to(x: i32, y: i32): i32 { + // for(var i = 0; i < x; i++){ + // if(i % 1 == 0){ + // y += i; + // } else { + // y *= i + // } + // } + // return y; + // } + static WAT: &'static str = r#" + (module + (type $t0 (func (param i32 i32) (result i32))) + (type $t1 (func)) + (func $add_to (export "add_to") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) + (local $l0 i32) + block $B0 + i32.const 0 + set_local $l0 + loop $L1 + get_local $l0 + get_local $p0 + i32.lt_s + i32.eqz + br_if $B0 + get_local $l0 + i32.const 1 + i32.rem_s + i32.const 0 + i32.eq + if $I2 + get_local $p1 + get_local $l0 + i32.add + set_local $p1 + else + get_local $p1 + get_local $l0 + i32.mul + set_local $p1 + end + get_local $l0 + i32.const 1 + i32.add + set_local $l0 + br $L1 + unreachable + end + unreachable + end + get_local $p1) + (func $f1 (type $t1)) + (table $table (export "table") 1 anyfunc) + (memory $memory (export "memory") 0) + (global $g0 i32 (i32.const 8)) + (elem (i32.const 0) $f1)) + "#; + + #[test] + fn test_points_reduced_after_call() { + let wasm_binary = wat2wasm(WAT).unwrap(); + + let limit = 100u64; + + let module = compile_with_config( + &wasm_binary, + &get_compiler(), + CompilerConfig { + points_limit: Some(limit), + ..Default::default() + }, + ) + .unwrap(); + + let import_object = imports! {}; + let mut instance = module.instantiate(&import_object).unwrap(); + + instance.context_mut().set_points_used(0u64); + + let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap(); + let value = add_to.call(3, 4).unwrap(); + + // verify it returns the correct value + assert_eq!(value, 7); + + // verify is uses the correct number of points + assert_eq!(instance.context().get_points_used(), 42); // TODO need to update assertion to actual points used. + } + + #[test] + fn test_traps_after_costly_call() { + let wasm_binary = wat2wasm(WAT).unwrap(); + + let limit = 100u64; + + let module = compile_with_config( + &wasm_binary, + &get_compiler(), + CompilerConfig { + points_limit: Some(limit), + ..Default::default() + }, + ) + .unwrap(); + + let import_object = imports! {}; + let mut instance = module.instantiate(&import_object).unwrap(); + + instance.context_mut().set_points_used(0u64); + + let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap(); + let result = add_to.call(10_000_000, 4); + + // verify it errors + assert_eq!(result.is_err(), true); // TODO assert that the trap is caused by PointsExausted + + // verify is uses the correct number of points + assert_eq!(instance.context().get_points_used(), 99); // TODO need to update assertion to actual points used. + // TODO should points used be close to limit or at limit when trapping + } + +} diff --git a/lib/runtime-core/src/backend.rs b/lib/runtime-core/src/backend.rs index 1d493c31475..3c014c8aa88 100644 --- a/lib/runtime-core/src/backend.rs +++ b/lib/runtime-core/src/backend.rs @@ -59,6 +59,8 @@ pub struct CompilerConfig { pub symbol_map: Option>, pub memory_bound_check_mode: MemoryBoundCheckMode, pub enforce_stack_check: bool, + /// Enables metering functionality if set and used as default points limit during compilation + pub points_limit: Option, } pub trait Compiler { diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index 74a1c06dd7a..c74430bf638 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -350,6 +350,16 @@ impl Ctx { pub fn dynamic_sigindice_count(&self) -> usize { unsafe { (*self.local_backing).dynamic_sigindices.len() } } + + /// Returns the number of points used by a function call for metering + pub fn get_points_used(&self) -> u64 { + unimplemented!() + } + + /// Sets the value of points used + pub fn set_points_used(&mut self, _value: u64) { + unimplemented!() + } } #[doc(hidden)] From c020c39193ed9723a7ee61149585e9f60ce1487c Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 13:21:00 -0500 Subject: [PATCH 15/30] Move get/set points used to middleware --- lib/middleware-common/src/metering.rs | 23 +++++++++++++++++------ lib/runtime-core/src/vm.rs | 10 ---------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index f547763b188..c448378d489 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -3,6 +3,7 @@ use wasmer_runtime_core::{ module::ModuleInfo, vm::InternalField, wasmparser::{Operator, Type as WpType}, + Instance, }; static INTERNAL_FIELD: InternalField = InternalField::allocate(); @@ -98,9 +99,19 @@ impl FunctionMiddleware for Metering { } } +/// Returns the number of points used by a function call for metering +pub fn get_points_used(_instance: &Instance) -> u64 { + unimplemented!() +} + +/// Sets the value of points used +pub fn set_points_used(_instance: &mut Instance, _value: u64) { + unimplemented!() +} + #[cfg(test)] mod tests { - + use super::*; use wabt::wat2wasm; use wasmer_runtime_core::{ backend::{Compiler, CompilerConfig}, @@ -204,7 +215,7 @@ mod tests { let import_object = imports! {}; let mut instance = module.instantiate(&import_object).unwrap(); - instance.context_mut().set_points_used(0u64); + set_points_used(&mut instance, 0u64); let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap(); let value = add_to.call(3, 4).unwrap(); @@ -213,7 +224,7 @@ mod tests { assert_eq!(value, 7); // verify is uses the correct number of points - assert_eq!(instance.context().get_points_used(), 42); // TODO need to update assertion to actual points used. + assert_eq!(get_points_used(&instance), 42); // TODO need to update assertion to actual points used. } #[test] @@ -235,7 +246,7 @@ mod tests { let import_object = imports! {}; let mut instance = module.instantiate(&import_object).unwrap(); - instance.context_mut().set_points_used(0u64); + set_points_used(&mut instance, 0u64); let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap(); let result = add_to.call(10_000_000, 4); @@ -244,8 +255,8 @@ mod tests { assert_eq!(result.is_err(), true); // TODO assert that the trap is caused by PointsExausted // verify is uses the correct number of points - assert_eq!(instance.context().get_points_used(), 99); // TODO need to update assertion to actual points used. - // TODO should points used be close to limit or at limit when trapping + assert_eq!(get_points_used(&instance), 99); // TODO need to update assertion to actual points used. + // TODO should points used be close to limit or at limit when trapping } } diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index c74430bf638..74a1c06dd7a 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -350,16 +350,6 @@ impl Ctx { pub fn dynamic_sigindice_count(&self) -> usize { unsafe { (*self.local_backing).dynamic_sigindices.len() } } - - /// Returns the number of points used by a function call for metering - pub fn get_points_used(&self) -> u64 { - unimplemented!() - } - - /// Sets the value of points used - pub fn set_points_used(&mut self, _value: u64) { - unimplemented!() - } } #[doc(hidden)] From f9c8f41232a67284fe692cb7d9f83ac0921c2091 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 13:37:51 -0500 Subject: [PATCH 16/30] Remove points_limit and update tests --- lib/middleware-common/src/metering.rs | 60 ++++++++++++++------------- lib/runtime-core/src/backend.rs | 2 - 2 files changed, 31 insertions(+), 31 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index c448378d489..a155485f680 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -113,30 +113,48 @@ pub fn set_points_used(_instance: &mut Instance, _value: u64) { mod tests { use super::*; use wabt::wat2wasm; - use wasmer_runtime_core::{ - backend::{Compiler, CompilerConfig}, - compile_with_config, imports, Func, - }; + + use wasmer_runtime_core::{backend::Compiler, compile_with, imports, Func}; #[cfg(feature = "llvm")] - fn get_compiler() -> impl Compiler { - use wasmer_llvm_backend::LLVMCompiler; - LLVMCompiler::new() + fn get_compiler(limit: u64) -> impl Compiler { + use wasmer_llvm_backend::code::LLVMModuleCodeGenerator; + use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler}; + let c: StreamingCompiler = + StreamingCompiler::new(move || { + let mut chain = MiddlewareChain::new(); + chain.push(Metering::new(limit)); + chain + }); + c } #[cfg(feature = "singlepass")] - fn get_compiler() -> impl Compiler { - use wasmer_singlepass_backend::SinglePassCompiler; - SinglePassCompiler::new() + fn get_compiler(limit: u64) -> impl Compiler { + use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler}; + use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG; + let c: StreamingCompiler = StreamingCompiler::new(move || { + let mut chain = MiddlewareChain::new(); + chain.push(Metering::new(limit)); + chain + }); + c } #[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))] - fn get_compiler() -> impl Compiler { + fn get_compiler(_limit: u64) -> impl Compiler { panic!("compiler not specified, activate a compiler via features"); use wasmer_clif_backend::CraneliftCompiler; CraneliftCompiler::new() } + #[cfg(feature = "clif")] + fn get_compiler(_limit: u64) -> impl Compiler { + panic!("cranelift does not implement metering"); + use wasmer_clif_backend::CraneliftCompiler; + CraneliftCompiler::new() + } + // Assemblyscript // export function add_to(x: i32, y: i32): i32 { // for(var i = 0; i < x; i++){ @@ -202,15 +220,7 @@ mod tests { let limit = 100u64; - let module = compile_with_config( - &wasm_binary, - &get_compiler(), - CompilerConfig { - points_limit: Some(limit), - ..Default::default() - }, - ) - .unwrap(); + let module = compile_with(&wasm_binary, &get_compiler(limit)).unwrap(); let import_object = imports! {}; let mut instance = module.instantiate(&import_object).unwrap(); @@ -233,15 +243,7 @@ mod tests { let limit = 100u64; - let module = compile_with_config( - &wasm_binary, - &get_compiler(), - CompilerConfig { - points_limit: Some(limit), - ..Default::default() - }, - ) - .unwrap(); + let module = compile_with(&wasm_binary, &get_compiler(limit)).unwrap(); let import_object = imports! {}; let mut instance = module.instantiate(&import_object).unwrap(); diff --git a/lib/runtime-core/src/backend.rs b/lib/runtime-core/src/backend.rs index 3c014c8aa88..1d493c31475 100644 --- a/lib/runtime-core/src/backend.rs +++ b/lib/runtime-core/src/backend.rs @@ -59,8 +59,6 @@ pub struct CompilerConfig { pub symbol_map: Option>, pub memory_bound_check_mode: MemoryBoundCheckMode, pub enforce_stack_check: bool, - /// Enables metering functionality if set and used as default points limit during compilation - pub points_limit: Option, } pub trait Compiler { From 8fdc4f9bc2a40dd7892330e64ace4412c8e56b1f Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 15:42:25 -0500 Subject: [PATCH 17/30] Start documenting Metering --- lib/middleware-common/src/metering.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index a155485f680..2a1d1c27d07 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -8,6 +8,18 @@ use wasmer_runtime_core::{ static INTERNAL_FIELD: InternalField = InternalField::allocate(); +/// Metering is a compiler middleware that calculates the cost of WebAssembly instructions at compile +/// time and will count the cost of executed instructions at runtime. Within the Metering functionality, +/// this instruction cost is called `points`. +/// +/// The Metering struct takes a `limit` parameter which is the maximum number of points which can be +/// used by an instance during a function call. If this limit is exceeded, the function call will +/// trap. Each instance has a `points_used` field which can be used to track points used during +/// a function call and should be set back to zero after a function call. +/// +/// Each compiler backend with Metering enabled should produce the same cost used at runtime for +/// the same function calls so we can say that the metering is deterministic. +/// pub struct Metering { limit: u64, current_block: u64, From 0c3109fb5595ea5900b77ee08b4c4954aab5eda5 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 15:43:02 -0500 Subject: [PATCH 18/30] Update Makefile and test configuration --- Makefile | 5 ++++- lib/middleware-common/src/metering.rs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 13822cce00d..12bcae46aa0 100644 --- a/Makefile +++ b/Makefile @@ -48,18 +48,21 @@ do-install: test: # We use one thread so the emscripten stdouts doesn't collide - cargo test --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-singlepass-backend --exclude wasmer-wasi -- $(runargs) + cargo test --all --exclude wasmer-runtime-c-api --exclude wasmer-emscripten --exclude wasmer-spectests --exclude wasmer-singlepass-backend --exclude wasmer-wasi --exclude wasmer-middleware-common -- $(runargs) # cargo test --all --exclude wasmer-emscripten -- --test-threads=1 $(runargs) cargo test --manifest-path lib/spectests/Cargo.toml --features clif + cargo test --manifest-path lib/middleware-common/Cargo.toml --features clif @if [ ! -z "${CIRCLE_JOB}" ]; then rm -f /home/circleci/project/target/debug/deps/libcranelift_wasm* && rm -f /Users/distiller/project/target/debug/deps/libcranelift_wasm*; fi; cargo test --manifest-path lib/spectests/Cargo.toml --features llvm cargo test --manifest-path lib/runtime/Cargo.toml --features llvm + cargo test --manifest-path lib/middleware-common/Cargo.toml --features llvm cargo build -p wasmer-runtime-c-api cargo test -p wasmer-runtime-c-api -- --nocapture test-singlepass: cargo test --manifest-path lib/spectests/Cargo.toml --features singlepass cargo test --manifest-path lib/runtime/Cargo.toml --features singlepass + cargo test --manifest-path lib/middleware-common/Cargo.toml --features singlepass test-emscripten-llvm: cargo test --manifest-path lib/emscripten/Cargo.toml --features llvm -- --test-threads=1 $(runargs) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index 2a1d1c27d07..5894e414507 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -121,7 +121,7 @@ pub fn set_points_used(_instance: &mut Instance, _value: u64) { unimplemented!() } -#[cfg(test)] +#[cfg(all(test, feature = "singlepass"))] mod tests { use super::*; use wabt::wat2wasm; From 605c0dc399b623cd4ad5badd3515a96c4c5f4923 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 15:45:43 -0500 Subject: [PATCH 19/30] Fix indentation in Makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 12bcae46aa0..463e7f8e168 100644 --- a/Makefile +++ b/Makefile @@ -55,7 +55,7 @@ test: @if [ ! -z "${CIRCLE_JOB}" ]; then rm -f /home/circleci/project/target/debug/deps/libcranelift_wasm* && rm -f /Users/distiller/project/target/debug/deps/libcranelift_wasm*; fi; cargo test --manifest-path lib/spectests/Cargo.toml --features llvm cargo test --manifest-path lib/runtime/Cargo.toml --features llvm - cargo test --manifest-path lib/middleware-common/Cargo.toml --features llvm + cargo test --manifest-path lib/middleware-common/Cargo.toml --features llvm cargo build -p wasmer-runtime-c-api cargo test -p wasmer-runtime-c-api -- --nocapture From 151af82e31a4412b8914807250ed0e12c3218ae3 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 15:51:52 -0500 Subject: [PATCH 20/30] Remove debugging println --- src/bin/wasmer.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index c97aa7c3ce6..848b1044e87 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -557,14 +557,11 @@ fn execute_wasm(options: &Run) -> Result<(), String> { .map(|arg| arg.as_str()) .map(|x| Value::I32(x.parse().unwrap())) .collect(); - println!( - "{:?}", - instance - .dyn_func("main") - .map_err(|e| format!("{:?}", e))? - .call(&args) - .map_err(|e| format!("{:?}", e))? - ); + instance + .dyn_func("main") + .map_err(|e| format!("{:?}", e))? + .call(&args) + .map_err(|e| format!("{:?}", e))?; } } From 66f9049a061cbd68e74561dc1f1198f7fdcfcae7 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Sun, 2 Jun 2019 19:36:26 -0500 Subject: [PATCH 21/30] Reset LLVM related code to master --- lib/llvm-backend/src/backend.rs | 32 +----------- lib/llvm-backend/src/code.rs | 80 ++++-------------------------- lib/llvm-backend/src/intrinsics.rs | 37 -------------- lib/llvm-backend/src/lib.rs | 2 +- 4 files changed, 13 insertions(+), 138 deletions(-) diff --git a/lib/llvm-backend/src/backend.rs b/lib/llvm-backend/src/backend.rs index fa41e908ebb..7a8c6c64ac8 100644 --- a/lib/llvm-backend/src/backend.rs +++ b/lib/llvm-backend/src/backend.rs @@ -24,7 +24,6 @@ use wasmer_runtime_core::{ CacheGen, RunnableModule, }, cache::Error as CacheError, - codegen::BkptInfo, module::ModuleInfo, structures::TypedIndex, typed_func::{Wasm, WasmTrapInfo}, @@ -191,8 +190,6 @@ fn get_callbacks() -> Callbacks { fn_name!("vm.exception.trap") => throw_trap as _, - fn_name!("vm.breakpoint") => vm_breakpoint as _, - _ => ptr::null(), } } @@ -212,21 +209,6 @@ fn get_callbacks() -> Callbacks { } } -unsafe extern "C" fn vm_breakpoint( - _ctx: &mut vm::Ctx, - breakpoints: *const Vec>, - index: u32, -) -> i32 { - unsafe extern "C" fn do_throw() -> ! { - let ptr: *mut i32 = ::std::ptr::null_mut(); - *ptr = 42; - ::std::process::abort(); - } - let breakpoints: &Vec<_> = &*breakpoints; - breakpoints[index as usize](BkptInfo { throw: do_throw }); - 0 -} - pub enum Buffer { LlvmMemory(MemoryBuffer), Memory(Memory), @@ -249,15 +231,10 @@ pub struct LLVMBackend { module: *mut LLVMModule, #[allow(dead_code)] buffer: Arc, - breakpoints: Box>>, } impl LLVMBackend { - pub fn new( - module: Module, - _intrinsics: Intrinsics, - breakpoints: Box>>, - ) -> (Self, LLVMCache) { + pub fn new(module: Module, _intrinsics: Intrinsics) -> (Self, LLVMCache) { Target::initialize_x86(&InitializationConfig { asm_parser: true, asm_printer: true, @@ -312,16 +289,12 @@ impl LLVMBackend { Self { module, buffer: Arc::clone(&buffer), - breakpoints, }, LLVMCache { buffer }, ) } - pub unsafe fn from_buffer( - memory: Memory, - breakpoints: Box>>, - ) -> Result<(Self, LLVMCache), String> { + pub unsafe fn from_buffer(memory: Memory) -> Result<(Self, LLVMCache), String> { let callbacks = get_callbacks(); let mut module: *mut LLVMModule = ptr::null_mut(); @@ -345,7 +318,6 @@ impl LLVMBackend { Self { module, buffer: Arc::clone(&buffer), - breakpoints, }, LLVMCache { buffer }, )) diff --git a/lib/llvm-backend/src/code.rs b/lib/llvm-backend/src/code.rs index 0069d0aee1e..7e76698a91e 100644 --- a/lib/llvm-backend/src/code.rs +++ b/lib/llvm-backend/src/code.rs @@ -398,7 +398,6 @@ pub struct LLVMFunctionCodeGenerator { num_params: usize, ctx: Option>, unreachable_depth: usize, - breakpoints: Option>>>, } impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { @@ -471,13 +470,13 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { } fn feed_event(&mut self, event: Event, module_info: &ModuleInfo) -> Result<(), CodegenError> { - match event { - Event::Internal(InternalEvent::FunctionBegin(_)) - | Event::Internal(InternalEvent::FunctionEnd) => { + let op = match event { + Event::Wasm(x) => x, + Event::Internal(_x) => { return Ok(()); } - _ => {} - } + Event::WasmOwned(ref x) => x, + }; let mut state = &mut self.state; let builder = self.builder.as_ref().unwrap(); @@ -490,13 +489,6 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { let mut ctx = self.ctx.as_mut().unwrap(); if !state.reachable { - let op = match event { - Event::Wasm(x) => x, - Event::WasmOwned(ref x) => x, - Event::Internal(_x) => { - return Ok(()); - } - }; match *op { Operator::Block { ty: _ } | Operator::Loop { ty: _ } | Operator::If { ty: _ } => { self.unreachable_depth += 1; @@ -519,48 +511,6 @@ impl FunctionCodeGenerator for LLVMFunctionCodeGenerator { } } - let op = match event { - Event::Wasm(x) => x, - Event::WasmOwned(ref x) => x, - Event::Internal(x) => { - match x { - InternalEvent::Breakpoint(handler) => { - let mut breakpoints = self.breakpoints.as_mut().unwrap(); - breakpoints.push(handler); - let ptr: *mut Vec<_> = &mut **breakpoints; - let ptr_const = intrinsics - .i64_ty - .const_int(ptr as usize as u64, false) - .as_basic_value_enum(); - builder.build_call( - intrinsics.breakpoint, - &[ - ctx.basic(), - ptr_const, - intrinsics - .i32_ty - .const_int((breakpoints.len() - 1) as u64, false) - .as_basic_value_enum(), - ], - &state.var_name(), - ); - } - InternalEvent::GetInternal(index) => { - let ptr = ctx.internal_pointer(index as usize, intrinsics); - let value = builder.build_load(ptr, "internal_value"); - state.push1(value); - } - InternalEvent::SetInternal(index) => { - let value = state.pop1()?; - let ptr = ctx.internal_pointer(index as usize, intrinsics); - builder.build_store(ptr, value); - } - _ => {} - } - return Ok(()); - } - }; - match *op { /*************************** * Control Flow instructions. @@ -2561,18 +2511,16 @@ impl ModuleCodeGenerator _module_info: Arc>, ) -> Result<&mut LLVMFunctionCodeGenerator, CodegenError> { // Creates a new function and returns the function-scope code generator for it. - let (context, builder, intrinsics, breakpoints) = match self.functions.last_mut() { + let (context, builder, intrinsics) = match self.functions.last_mut() { Some(x) => ( x.context.take().unwrap(), x.builder.take().unwrap(), x.intrinsics.take().unwrap(), - x.breakpoints.take().unwrap(), ), None => ( self.context.take().unwrap(), self.builder.take().unwrap(), self.intrinsics.take().unwrap(), - Box::new(Vec::new()), ), }; @@ -2631,7 +2579,6 @@ impl ModuleCodeGenerator num_params, ctx: None, unreachable_depth: 0, - breakpoints: Some(breakpoints), }; self.functions.push(code); Ok(self.functions.last_mut().unwrap()) @@ -2641,18 +2588,16 @@ impl ModuleCodeGenerator mut self, module_info: &ModuleInfo, ) -> Result<(LLVMBackend, Box), CodegenError> { - let (context, builder, intrinsics, breakpoints) = match self.functions.last_mut() { + let (context, builder, intrinsics) = match self.functions.last_mut() { Some(x) => ( x.context.take().unwrap(), x.builder.take().unwrap(), x.intrinsics.take().unwrap(), - x.breakpoints.take().unwrap(), ), None => ( self.context.take().unwrap(), self.builder.take().unwrap(), self.intrinsics.take().unwrap(), - Box::new(Vec::new()), ), }; self.context = Some(context); @@ -2683,8 +2628,7 @@ impl ModuleCodeGenerator // self.module.print_to_stderr(); - let (backend, cache_gen) = - LLVMBackend::new(self.module, self.intrinsics.take().unwrap(), breakpoints); + let (backend, cache_gen) = LLVMBackend::new(self.module, self.intrinsics.take().unwrap()); Ok((backend, Box::new(cache_gen))) } @@ -2716,11 +2660,7 @@ impl ModuleCodeGenerator Ok(()) } - unsafe fn from_cache(_artifact: Artifact, _: Token) -> Result { - Err(CacheError::Unknown( - "caching is broken for LLVM backend".into(), - )) - /* + unsafe fn from_cache(artifact: Artifact, _: Token) -> Result { let (info, _, memory) = artifact.consume(); let (backend, cache_gen) = LLVMBackend::from_buffer(memory).map_err(CacheError::DeserializeError)?; @@ -2730,6 +2670,6 @@ impl ModuleCodeGenerator cache_gen: Box::new(cache_gen), info, - })*/ + }) } } diff --git a/lib/llvm-backend/src/intrinsics.rs b/lib/llvm-backend/src/intrinsics.rs index 34f985c14bb..ebee5a3882d 100644 --- a/lib/llvm-backend/src/intrinsics.rs +++ b/lib/llvm-backend/src/intrinsics.rs @@ -113,8 +113,6 @@ pub struct Intrinsics { pub memory_size_static_import: FunctionValue, pub memory_size_shared_import: FunctionValue, - pub breakpoint: FunctionValue, - pub throw_trap: FunctionValue, pub ctx_ptr_ty: PointerType, @@ -165,7 +163,6 @@ impl Intrinsics { let stack_lower_bound_ty = i8_ty; let memory_base_ty = i8_ty; let memory_bound_ty = void_ty; - let internals_ty = i64_ty; let local_function_ty = i8_ptr_ty; let anyfunc_ty = context.struct_type( @@ -221,9 +218,6 @@ impl Intrinsics { memory_bound_ty .ptr_type(AddressSpace::Generic) .as_basic_type_enum(), - internals_ty - .ptr_type(AddressSpace::Generic) - .as_basic_type_enum(), local_function_ty .ptr_type(AddressSpace::Generic) .as_basic_type_enum(), @@ -252,11 +246,6 @@ impl Intrinsics { let ret_i1_take_i1_i1 = i1_ty.fn_type(&[i1_ty_basic, i1_ty_basic], false); - let ret_i32_take_ctx_i64_i32 = i32_ty.fn_type( - &[ctx_ptr_ty.as_basic_type_enum(), i64_ty_basic, i32_ty_basic], - false, - ); - Self { ctlz_i32: module.add_function("llvm.ctlz.i32", ret_i32_take_i32_i1, None), ctlz_i64: module.add_function("llvm.ctlz.i64", ret_i64_take_i64_i1, None), @@ -389,7 +378,6 @@ impl Intrinsics { ret_i32_take_ctx_i32, None, ), - breakpoint: module.add_function("vm.breakpoint", ret_i32_take_ctx_i64_i32, None), throw_trap: module.add_function( "vm.exception.trap", void_ty.fn_type(&[i32_ty_basic], false), @@ -440,7 +428,6 @@ pub struct CtxType<'a> { cached_tables: HashMap, cached_sigindices: HashMap, cached_globals: HashMap, - cached_internals: HashMap, cached_imported_functions: HashMap, _phantom: PhantomData<&'a FunctionValue>, @@ -466,7 +453,6 @@ impl<'a> CtxType<'a> { cached_tables: HashMap::new(), cached_sigindices: HashMap::new(), cached_globals: HashMap::new(), - cached_internals: HashMap::new(), cached_imported_functions: HashMap::new(), _phantom: PhantomData, @@ -690,29 +676,6 @@ impl<'a> CtxType<'a> { }) } - pub fn internal_pointer(&mut self, index: usize, intrinsics: &Intrinsics) -> PointerValue { - let (cached_internals, ctx_ptr_value, _info, cache_builder) = ( - &mut self.cached_internals, - self.ctx_ptr_value, - self.info, - &self.cache_builder, - ); - *cached_internals.entry(index).or_insert_with(|| { - let array_ptr_ptr = unsafe { - cache_builder.build_struct_gep( - ctx_ptr_value, - offset_to_index(Ctx::offset_internals()), - "internals_array_ptr_ptr", - ) - }; - let array_ptr = cache_builder - .build_load(array_ptr_ptr, "internals_array_ptr") - .into_pointer_value(); - let const_index = intrinsics.i32_ty.const_int(index as u64, false); - unsafe { cache_builder.build_in_bounds_gep(array_ptr, &[const_index], "element_ptr") } - }) - } - pub fn global_cache(&mut self, index: GlobalIndex, intrinsics: &Intrinsics) -> GlobalCache { let (cached_globals, ctx_ptr_value, info, cache_builder) = ( &mut self.cached_globals, diff --git a/lib/llvm-backend/src/lib.rs b/lib/llvm-backend/src/lib.rs index 8c8685d7910..6d8816af8a3 100644 --- a/lib/llvm-backend/src/lib.rs +++ b/lib/llvm-backend/src/lib.rs @@ -2,7 +2,7 @@ #![cfg_attr(nightly, feature(unwind_attributes))] mod backend; -pub mod code; +mod code; mod intrinsics; mod platform; mod read_info; From 69944c1dc22d02847410ce6e5e8e1b8b88391eb6 Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 5 Jun 2019 02:13:10 +0800 Subject: [PATCH 22/30] Fix ctx layout in LLVM. --- lib/llvm-backend/src/intrinsics.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/llvm-backend/src/intrinsics.rs b/lib/llvm-backend/src/intrinsics.rs index ebee5a3882d..0e00ff42168 100644 --- a/lib/llvm-backend/src/intrinsics.rs +++ b/lib/llvm-backend/src/intrinsics.rs @@ -163,6 +163,7 @@ impl Intrinsics { let stack_lower_bound_ty = i8_ty; let memory_base_ty = i8_ty; let memory_bound_ty = void_ty; + let internals_ty = i64_ty; let local_function_ty = i8_ptr_ty; let anyfunc_ty = context.struct_type( @@ -218,6 +219,9 @@ impl Intrinsics { memory_bound_ty .ptr_type(AddressSpace::Generic) .as_basic_type_enum(), + internals_ty + .ptr_type(AddressSpace::Generic) + .as_basic_type_enum(), local_function_ty .ptr_type(AddressSpace::Generic) .as_basic_type_enum(), From 0867208e0cd4942aa9d1ba48aebbb08d064c3356 Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 5 Jun 2019 02:28:19 +0800 Subject: [PATCH 23/30] Implement {get,set}_points_used. --- lib/middleware-common/src/metering.rs | 13 ++++++------- lib/runtime-core/src/instance.rs | 10 +++++++++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index 5894e414507..7e2fd44d61b 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -112,13 +112,13 @@ impl FunctionMiddleware for Metering { } /// Returns the number of points used by a function call for metering -pub fn get_points_used(_instance: &Instance) -> u64 { - unimplemented!() +pub fn get_points_used(instance: &Instance) -> u64 { + instance.get_internal(&INTERNAL_FIELD) } /// Sets the value of points used -pub fn set_points_used(_instance: &mut Instance, _value: u64) { - unimplemented!() +pub fn set_points_used(instance: &mut Instance, value: u64) { + instance.set_internal(&INTERNAL_FIELD, value); } #[cfg(all(test, feature = "singlepass"))] @@ -246,7 +246,7 @@ mod tests { assert_eq!(value, 7); // verify is uses the correct number of points - assert_eq!(get_points_used(&instance), 42); // TODO need to update assertion to actual points used. + assert_eq!(get_points_used(&instance), 74); } #[test] @@ -269,8 +269,7 @@ mod tests { assert_eq!(result.is_err(), true); // TODO assert that the trap is caused by PointsExausted // verify is uses the correct number of points - assert_eq!(get_points_used(&instance), 99); // TODO need to update assertion to actual points used. - // TODO should points used be close to limit or at limit when trapping + assert_eq!(get_points_used(&instance), 109); // Used points will be slightly more than `limit` because of the way we do gas checking. } } diff --git a/lib/runtime-core/src/instance.rs b/lib/runtime-core/src/instance.rs index 69a8884c3af..cf09b48e75d 100644 --- a/lib/runtime-core/src/instance.rs +++ b/lib/runtime-core/src/instance.rs @@ -13,7 +13,7 @@ use crate::{ table::Table, typed_func::{Func, Wasm, WasmTrapInfo, WasmTypeList}, types::{FuncIndex, FuncSig, GlobalIndex, LocalOrImport, MemoryIndex, TableIndex, Type, Value}, - vm, + vm::{self, InternalField}, }; use smallvec::{smallvec, SmallVec}; use std::{mem, ptr::NonNull, sync::Arc}; @@ -372,6 +372,14 @@ impl Instance { pub fn module(&self) -> Module { Module::new(Arc::clone(&self.module)) } + + pub fn get_internal(&self, field: &InternalField) -> u64 { + self.inner.backing.internals.0[field.index()] + } + + pub fn set_internal(&mut self, field: &InternalField, value: u64) { + self.inner.backing.internals.0[field.index()] = value; + } } impl InstanceInner { From f2d8aad73aa0bb66641ec16b729f3189268a892d Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 5 Jun 2019 11:51:33 +0800 Subject: [PATCH 24/30] Support checking the execution limit exceeded error. --- lib/middleware-common/src/metering.rs | 16 ++++++++++++---- lib/runtime-core/src/codegen.rs | 3 ++- lib/singlepass-backend/src/protect_unix.rs | 3 ++- src/bin/wasmer.rs | 1 + 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index 7e2fd44d61b..436a0d50ab8 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -34,6 +34,9 @@ impl Metering { } } +#[derive(Copy, Clone, Debug)] +pub struct ExecutionLimitExceededError; + impl FunctionMiddleware for Metering { type Error = String; fn feed_event<'a, 'b: 'a>( @@ -93,9 +96,8 @@ impl FunctionMiddleware for Metering { })); sink.push(Event::Internal(InternalEvent::Breakpoint(Box::new( move |ctx| { - eprintln!("execution limit reached"); unsafe { - (ctx.throw)(); + (ctx.throw)(Box::new(ExecutionLimitExceededError)); } }, )))); @@ -251,6 +253,7 @@ mod tests { #[test] fn test_traps_after_costly_call() { + use wasmer_runtime_core::error::RuntimeError; let wasm_binary = wat2wasm(WAT).unwrap(); let limit = 100u64; @@ -265,8 +268,13 @@ mod tests { let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap(); let result = add_to.call(10_000_000, 4); - // verify it errors - assert_eq!(result.is_err(), true); // TODO assert that the trap is caused by PointsExausted + let err = result.unwrap_err(); + match err { + RuntimeError::Error { data } => { + assert!(data.downcast_ref::().is_some()); + }, + _ => unreachable!(), + } // verify is uses the correct number of points assert_eq!(get_points_used(&instance), 109); // Used points will be slightly more than `limit` because of the way we do gas checking. diff --git a/lib/runtime-core/src/codegen.rs b/lib/runtime-core/src/codegen.rs index 71a38dc8830..4ff0c25cb80 100644 --- a/lib/runtime-core/src/codegen.rs +++ b/lib/runtime-core/src/codegen.rs @@ -8,6 +8,7 @@ use crate::{ types::{FuncIndex, FuncSig, SigIndex}, }; use smallvec::SmallVec; +use std::any::Any; use std::fmt; use std::fmt::Debug; use std::marker::PhantomData; @@ -43,7 +44,7 @@ impl fmt::Debug for InternalEvent { } pub struct BkptInfo { - pub throw: unsafe extern "C" fn() -> !, + pub throw: unsafe fn(Box) -> !, } pub trait ModuleCodeGenerator, RM: RunnableModule, E: Debug> { diff --git a/lib/singlepass-backend/src/protect_unix.rs b/lib/singlepass-backend/src/protect_unix.rs index 56ac61519c5..f777c2482c6 100644 --- a/lib/singlepass-backend/src/protect_unix.rs +++ b/lib/singlepass-backend/src/protect_unix.rs @@ -128,11 +128,12 @@ pub fn call_protected(f: impl FnOnce() -> T) -> Result { } } -pub unsafe extern "C" fn throw() -> ! { +pub unsafe fn throw(payload: Box) -> ! { let jmp_buf = SETJMP_BUFFER.with(|buf| buf.get()); if *jmp_buf == [0; SETJMP_BUFFER_LEN] { ::std::process::abort(); } + TRAP_EARLY_DATA.with(|cell| cell.replace(Some(payload))); longjmp(jmp_buf as *mut ::nix::libc::c_void, 0xffff); } diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 848b1044e87..7a2506ac829 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -33,6 +33,7 @@ use wasmer_runtime_core::{ use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG; #[cfg(feature = "wasi")] use wasmer_wasi; +use wasmer_middleware_common::metering::Metering; // stub module to make conditional compilation happy #[cfg(not(feature = "wasi"))] From f5243aff5e5c688aac66df50685514fcbc788ebc Mon Sep 17 00:00:00 2001 From: losfair Date: Wed, 5 Jun 2019 11:52:25 +0800 Subject: [PATCH 25/30] Cargo fmt --- lib/middleware-common/src/metering.rs | 8 +++----- src/bin/wasmer.rs | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index 436a0d50ab8..b5dc273f604 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -95,10 +95,8 @@ impl FunctionMiddleware for Metering { ty: WpType::EmptyBlockType, })); sink.push(Event::Internal(InternalEvent::Breakpoint(Box::new( - move |ctx| { - unsafe { - (ctx.throw)(Box::new(ExecutionLimitExceededError)); - } + move |ctx| unsafe { + (ctx.throw)(Box::new(ExecutionLimitExceededError)); }, )))); sink.push(Event::WasmOwned(Operator::End)); @@ -272,7 +270,7 @@ mod tests { match err { RuntimeError::Error { data } => { assert!(data.downcast_ref::().is_some()); - }, + } _ => unreachable!(), } diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 7a2506ac829..966f0f35adc 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -17,6 +17,7 @@ use wasmer::*; use wasmer_clif_backend::CraneliftCompiler; #[cfg(feature = "backend:llvm")] use wasmer_llvm_backend::code::LLVMModuleCodeGenerator; +use wasmer_middleware_common::metering::Metering; use wasmer_runtime::{ cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH}, error::RuntimeError, @@ -33,7 +34,6 @@ use wasmer_runtime_core::{ use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG; #[cfg(feature = "wasi")] use wasmer_wasi; -use wasmer_middleware_common::metering::Metering; // stub module to make conditional compilation happy #[cfg(not(feature = "wasi"))] From f832c8d315baa1ba6341f24f9da2330fa72fe63b Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Tue, 4 Jun 2019 23:25:19 -0500 Subject: [PATCH 26/30] Try to fix unused import error --- src/bin/wasmer.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/wasmer.rs b/src/bin/wasmer.rs index 966f0f35adc..b53fb3e0336 100644 --- a/src/bin/wasmer.rs +++ b/src/bin/wasmer.rs @@ -17,7 +17,6 @@ use wasmer::*; use wasmer_clif_backend::CraneliftCompiler; #[cfg(feature = "backend:llvm")] use wasmer_llvm_backend::code::LLVMModuleCodeGenerator; -use wasmer_middleware_common::metering::Metering; use wasmer_runtime::{ cache::{Cache as BaseCache, FileSystemCache, WasmHash, WASMER_VERSION_HASH}, error::RuntimeError, @@ -348,6 +347,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> { Backend::Singlepass => { let c: StreamingCompiler = StreamingCompiler::new(|| { let mut chain = MiddlewareChain::new(); + use wasmer_middleware_common::metering::Metering; if let Some(limit) = options.instruction_limit { chain.push(Metering::new(limit)); } @@ -363,6 +363,7 @@ fn execute_wasm(options: &Run) -> Result<(), String> { let c: StreamingCompiler = StreamingCompiler::new(|| { let mut chain = MiddlewareChain::new(); + use wasmer_middleware_common::metering::Metering; if let Some(limit) = options.instruction_limit { chain.push(Metering::new(limit)); } From 27eacf0c4f3496f55be2bcdad21391f11672b714 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Thu, 6 Jun 2019 00:37:04 -0500 Subject: [PATCH 27/30] Add metering benchmark --- Cargo.lock | 1 + lib/middleware-common/Cargo.toml | 7 +- .../benches/metering_benchmark.rs | 231 ++++++++++++++++++ 3 files changed, 238 insertions(+), 1 deletion(-) create mode 100644 lib/middleware-common/benches/metering_benchmark.rs diff --git a/Cargo.lock b/Cargo.lock index 840c7748cf5..60052424362 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1460,6 +1460,7 @@ dependencies = [ name = "wasmer-middleware-common" version = "0.4.2" dependencies = [ + "criterion 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", "wabt 0.7.4 (registry+https://github.com/rust-lang/crates.io-index)", "wasmer-clif-backend 0.4.2", "wasmer-llvm-backend 0.4.2", diff --git a/lib/middleware-common/Cargo.toml b/lib/middleware-common/Cargo.toml index be5517fbb80..d6f7c2c4b30 100644 --- a/lib/middleware-common/Cargo.toml +++ b/lib/middleware-common/Cargo.toml @@ -15,8 +15,13 @@ wasmer-singlepass-backend = { path = "../singlepass-backend", version = "0.4.2", [dev-dependencies] wabt = "0.7.4" +criterion = "0.2" [features] clif = [] llvm = ["wasmer-llvm-backend"] -singlepass = ["wasmer-singlepass-backend"] \ No newline at end of file +singlepass = ["wasmer-singlepass-backend"] + +[[bench]] +name = "metering_benchmark" +harness = false \ No newline at end of file diff --git a/lib/middleware-common/benches/metering_benchmark.rs b/lib/middleware-common/benches/metering_benchmark.rs new file mode 100644 index 00000000000..58884296867 --- /dev/null +++ b/lib/middleware-common/benches/metering_benchmark.rs @@ -0,0 +1,231 @@ +#[macro_use] +extern crate criterion; + +use criterion::black_box; +use criterion::{Benchmark, Criterion}; + +use wabt::wat2wasm; + +use wasmer_middleware_common::metering::Metering; +use wasmer_runtime_core::vm::Ctx; +use wasmer_runtime_core::{backend::Compiler, compile_with, imports, Func}; + +//export function add_to(x: i32, y: i32): i32 { +// for(var i = 0; i < x; i++){ +// if(i % 1 == 0){ +// y += i; +// } else { +// y *= i +// } +// } +// return y; +//} +static WAT: &'static str = r#" + (module + (type $t0 (func (param i32 i32) (result i32))) + (type $t1 (func)) + (func $add_to (export "add_to") (type $t0) (param $p0 i32) (param $p1 i32) (result i32) + (local $l0 i32) + block $B0 + i32.const 0 + set_local $l0 + loop $L1 + get_local $l0 + get_local $p0 + i32.lt_s + i32.eqz + br_if $B0 + get_local $l0 + i32.const 1 + i32.rem_s + i32.const 0 + i32.eq + if $I2 + get_local $p1 + get_local $l0 + i32.add + set_local $p1 + else + get_local $p1 + get_local $l0 + i32.mul + set_local $p1 + end + get_local $l0 + i32.const 1 + i32.add + set_local $l0 + br $L1 + unreachable + end + unreachable + end + get_local $p1) + (func $f1 (type $t1)) + (table $table (export "table") 1 anyfunc) + (memory $memory (export "memory") 0) + (global $g0 i32 (i32.const 8)) + (elem (i32.const 0) $f1)) + "#; + +static WAT_GAS: &'static str = r#" + (module + (type $t0 (func (param i32 i32) (result i32))) + (type $t1 (func)) + (type $t2 (func (param i32))) + (import "env" "gas" (func $env.gas (type $t2))) + (func $add_to (type $t0) (param $p0 i32) (param $p1 i32) (result i32) + (local $l0 i32) + i32.const 3 + call $env.gas + block $B0 + i32.const 5 + call $env.gas + i32.const 0 + set_local $l0 + loop $L1 + i32.const 18 + call $env.gas + get_local $l0 + get_local $p0 + i32.lt_s + i32.eqz + br_if $B0 + get_local $l0 + i32.const 1 + i32.rem_s + i32.const 0 + i32.eq + if $I2 + i32.const 5 + call $env.gas + get_local $p1 + get_local $l0 + i32.add + set_local $p1 + else + i32.const 5 + call $env.gas + get_local $p1 + get_local $l0 + i32.mul + set_local $p1 + end + get_local $l0 + i32.const 1 + i32.add + set_local $l0 + br $L1 + unreachable + end + unreachable + end + get_local $p1) + (func $f2 (type $t1) + i32.const 1 + call $env.gas) + (table $table 1 anyfunc) + (memory $memory 0) + (global $g0 i32 (i32.const 8)) + (export "memory" (memory 0)) + (export "table" (table 0)) + (export "add_to" (func $add_to)) + (elem (i32.const 0) $f2)) + "#; + +#[cfg(feature = "llvm")] +fn get_compiler(limit: u64, metering: bool) -> impl Compiler { + use wasmer_llvm_backend::code::LLVMModuleCodeGenerator; + use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler}; + let c: StreamingCompiler = + StreamingCompiler::new(move || { + let mut chain = MiddlewareChain::new(); + if metering { + chain.push(Metering::new(limit)); + } + chain + }); + + c +} + +#[cfg(feature = "singlepass")] +fn get_compiler(limit: u64, metering: bool) -> impl Compiler { + use wasmer_runtime_core::codegen::{MiddlewareChain, StreamingCompiler}; + use wasmer_singlepass_backend::ModuleCodeGenerator as SinglePassMCG; + let c: StreamingCompiler = StreamingCompiler::new(move || { + let mut chain = MiddlewareChain::new(); + if metering { + chain.push(Metering::new(limit)); + } + chain + }); + c +} + +#[cfg(not(any(feature = "llvm", feature = "clif", feature = "singlepass")))] +fn get_compiler(_limit: u64, metering: bool) -> impl Compiler { + panic!("compiler not specified, activate a compiler via features"); + use wasmer_clif_backend::CraneliftCompiler; + CraneliftCompiler::new() +} + +#[cfg(feature = "clif")] +fn get_compiler(_limit: u64, metering: bool) -> impl Compiler { + panic!("cranelift does not implement metering"); + use wasmer_clif_backend::CraneliftCompiler; + CraneliftCompiler::new() +} + +fn gas(ctx: &mut Ctx, gas_amount: u32) { + use wasmer_middleware_common::metering; + // TODO read gas field + let used = 100; + let new = used + gas_amount; + () +} + +fn bench_metering(c: &mut Criterion) { + use wasmer_middleware_common::metering; + + c.bench( + "Meter", + Benchmark::new("No Metering", |b| { + let compiler = get_compiler(0, false); + let wasm_binary = wat2wasm(WAT).unwrap(); + let module = compile_with(&wasm_binary, &compiler).unwrap(); + let import_object = imports! {}; + let mut instance = module.instantiate(&import_object).unwrap(); + let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap(); + b.iter(|| add_to.call(100, 4).unwrap()) + }) + .with_function("Gas Metering", |b| { + let compiler = get_compiler(0, false); + let gas_wasm_binary = wat2wasm(WAT_GAS).unwrap(); + let gas_module = compile_with(&gas_wasm_binary, &compiler).unwrap(); + let gas_import_object = imports! { + "env" => { + "gas" => Func::new(gas), + }, + }; + let mut gas_instance = gas_module.instantiate(&gas_import_object).unwrap(); + let gas_add_to: Func<(i32, i32), i32> = gas_instance.func("add_to").unwrap(); + b.iter(|| gas_add_to.call(100, 4).unwrap()) + }) + .with_function("Built-in Metering", |b| { + let metering_compiler = get_compiler(std::u64::MAX, true); + let wasm_binary = wat2wasm(WAT).unwrap(); + let metering_module = compile_with(&wasm_binary, &metering_compiler).unwrap(); + let metering_import_object = imports! {}; + let mut metering_instance = metering_module + .instantiate(&metering_import_object) + .unwrap(); + metering::set_points_used(&mut metering_instance, 0u64); + let metering_add_to: Func<(i32, i32), i32> = metering_instance.func("add_to").unwrap(); + b.iter(|| metering_add_to.call(100, 4).unwrap()) + }), + ); +} + +criterion_group!(benches, bench_metering); +criterion_main!(benches); From c6cd49a370d8ff709f2c5467dd4fd0a236c0b17a Mon Sep 17 00:00:00 2001 From: losfair Date: Thu, 6 Jun 2019 14:10:57 +0800 Subject: [PATCH 28/30] Support getting/setting metering points and internal fields with a Ctx. --- lib/middleware-common/src/metering.rs | 16 +++++++++++++--- lib/runtime-core/src/vm.rs | 12 ++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/lib/middleware-common/src/metering.rs b/lib/middleware-common/src/metering.rs index b5dc273f604..dd5b856b5dc 100644 --- a/lib/middleware-common/src/metering.rs +++ b/lib/middleware-common/src/metering.rs @@ -1,7 +1,7 @@ use wasmer_runtime_core::{ codegen::{Event, EventSink, FunctionMiddleware, InternalEvent}, module::ModuleInfo, - vm::InternalField, + vm::{Ctx, InternalField}, wasmparser::{Operator, Type as WpType}, Instance, }; @@ -111,16 +111,26 @@ impl FunctionMiddleware for Metering { } } -/// Returns the number of points used by a function call for metering +/// Returns the number of points used by an Instance. pub fn get_points_used(instance: &Instance) -> u64 { instance.get_internal(&INTERNAL_FIELD) } -/// Sets the value of points used +/// Sets the number of points used by an Instance. pub fn set_points_used(instance: &mut Instance, value: u64) { instance.set_internal(&INTERNAL_FIELD, value); } +/// Returns the number of points used in a Ctx. +pub fn get_points_used_ctx(ctx: &Ctx) -> u64 { + ctx.get_internal(&INTERNAL_FIELD) +} + +/// Sets the number of points used in a Ctx. +pub fn set_points_used_ctx(ctx: &mut Ctx, value: u64) { + ctx.set_internal(&INTERNAL_FIELD, value); +} + #[cfg(all(test, feature = "singlepass"))] mod tests { use super::*; diff --git a/lib/runtime-core/src/vm.rs b/lib/runtime-core/src/vm.rs index 74a1c06dd7a..a845514491e 100644 --- a/lib/runtime-core/src/vm.rs +++ b/lib/runtime-core/src/vm.rs @@ -350,6 +350,18 @@ impl Ctx { pub fn dynamic_sigindice_count(&self) -> usize { unsafe { (*self.local_backing).dynamic_sigindices.len() } } + + /// Returns the value of the specified internal field. + pub fn get_internal(&self, field: &InternalField) -> u64 { + unsafe { (*self.internal.internals)[field.index()] } + } + + /// Writes the value to the specified internal field. + pub fn set_internal(&mut self, field: &InternalField, value: u64) { + unsafe { + (*self.internal.internals)[field.index()] = value; + } + } } #[doc(hidden)] From 418764a15ff0ebf75e3dc53c970ec57bf99de77d Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Thu, 6 Jun 2019 23:25:11 -0500 Subject: [PATCH 29/30] Add get/set gas used for benchmark --- lib/middleware-common/benches/metering_benchmark.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/middleware-common/benches/metering_benchmark.rs b/lib/middleware-common/benches/metering_benchmark.rs index 58884296867..931121cef2c 100644 --- a/lib/middleware-common/benches/metering_benchmark.rs +++ b/lib/middleware-common/benches/metering_benchmark.rs @@ -179,9 +179,8 @@ fn get_compiler(_limit: u64, metering: bool) -> impl Compiler { fn gas(ctx: &mut Ctx, gas_amount: u32) { use wasmer_middleware_common::metering; - // TODO read gas field - let used = 100; - let new = used + gas_amount; + let used = metering::get_points_used_ctx(ctx); + metering::set_points_used_ctx(ctx, used + u64::from(gas_amount)); () } From e87d507162e19fc0e914b39e7a0848d179e8ae98 Mon Sep 17 00:00:00 2001 From: Brandon Fish Date: Thu, 6 Jun 2019 23:30:31 -0500 Subject: [PATCH 30/30] Add black_box to benchmarking --- lib/middleware-common/benches/metering_benchmark.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/middleware-common/benches/metering_benchmark.rs b/lib/middleware-common/benches/metering_benchmark.rs index 931121cef2c..20759ed0109 100644 --- a/lib/middleware-common/benches/metering_benchmark.rs +++ b/lib/middleware-common/benches/metering_benchmark.rs @@ -196,7 +196,7 @@ fn bench_metering(c: &mut Criterion) { let import_object = imports! {}; let mut instance = module.instantiate(&import_object).unwrap(); let add_to: Func<(i32, i32), i32> = instance.func("add_to").unwrap(); - b.iter(|| add_to.call(100, 4).unwrap()) + b.iter(|| black_box(add_to.call(100, 4))) }) .with_function("Gas Metering", |b| { let compiler = get_compiler(0, false); @@ -209,7 +209,7 @@ fn bench_metering(c: &mut Criterion) { }; let mut gas_instance = gas_module.instantiate(&gas_import_object).unwrap(); let gas_add_to: Func<(i32, i32), i32> = gas_instance.func("add_to").unwrap(); - b.iter(|| gas_add_to.call(100, 4).unwrap()) + b.iter(|| black_box(gas_add_to.call(100, 4))) }) .with_function("Built-in Metering", |b| { let metering_compiler = get_compiler(std::u64::MAX, true); @@ -221,7 +221,7 @@ fn bench_metering(c: &mut Criterion) { .unwrap(); metering::set_points_used(&mut metering_instance, 0u64); let metering_add_to: Func<(i32, i32), i32> = metering_instance.func("add_to").unwrap(); - b.iter(|| metering_add_to.call(100, 4).unwrap()) + b.iter(|| black_box(metering_add_to.call(100, 4))) }), ); }