diff --git a/Cargo.lock b/Cargo.lock index 118d6600f5..b5ece2f173 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -142,9 +142,9 @@ checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.61" +version = "0.3.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7a905d892734eea339e896738c14b9afce22b5318f64b951e70bf3844419b01" +checksum = "091bcdf2da9950f96aa522681ce805e6857f6ca8df73833d35736ab2dc78e152" dependencies = [ "addr2line", "cc", @@ -1585,9 +1585,9 @@ checksum = "4facc753ae494aeb6e3c22f839b158aebd4f9270f55cd3c79906c45476c47ab4" [[package]] name = "memchr" -version = "2.4.0" +version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16bd47d9e329435e309c58469fe0791c2d0d1ba96ec0954152a5ae2b04387dc" +checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" [[package]] name = "memmap2" @@ -1774,9 +1774,9 @@ checksum = "17b02fc0ff9a9e4b35b3342880f48e896ebf69f2967921fe8646bf5b7125956a" [[package]] name = "object" -version = "0.26.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c55827317fb4c08822499848a14237d2874d6f139828893017237e7ab93eb386" +checksum = "c821014c18301591b89b843809ef953af9e3df0496c232d5c0611b0a52aac363" dependencies = [ "crc32fast", "indexmap", diff --git a/Cargo.toml b/Cargo.toml index 9f8aa6cc24..fc4a4acc54 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -31,7 +31,7 @@ wasmtime-wasi = { path = "crates/wasi", version = "0.30.0" } wasmtime-wasi-crypto = { path = "crates/wasi-crypto", version = "0.30.0", optional = true } wasmtime-wasi-nn = { path = "crates/wasi-nn", version = "0.30.0", optional = true } structopt = { version = "0.3.5", features = ["color", "suggestions"] } -object = { version = "0.26.0", default-features = false, features = ["write"] } +object = { version = "0.27.0", default-features = false, features = ["write"] } anyhow = "1.0.19" target-lexicon = { version = "0.12.0", default-features = false } pretty_env_logger = "0.4.0" diff --git a/cranelift/object/Cargo.toml b/cranelift/object/Cargo.toml index 77bfbf1df3..60486bb8bf 100644 --- a/cranelift/object/Cargo.toml +++ b/cranelift/object/Cargo.toml @@ -12,7 +12,7 @@ edition = "2018" [dependencies] cranelift-module = { path = "../module", version = "0.77.0" } cranelift-codegen = { path = "../codegen", version = "0.77.0", default-features = false, features = ["std"] } -object = { version = "0.26.0", default-features = false, features = ["write"] } +object = { version = "0.27.0", default-features = false, features = ["write"] } target-lexicon = "0.12" anyhow = "1.0" log = { version = "0.4.6", default-features = false } diff --git a/cranelift/object/src/backend.rs b/cranelift/object/src/backend.rs index 0f710d9f0e..4931d01e2f 100644 --- a/cranelift/object/src/backend.rs +++ b/cranelift/object/src/backend.rs @@ -114,7 +114,7 @@ impl ObjectBuilder { /// See the `ObjectBuilder` for a convenient way to construct `ObjectModule` instances. pub struct ObjectModule { isa: Box, - object: Object, + object: Object<'static>, declarations: ModuleDeclarations, functions: SecondaryMap>, data_objects: SecondaryMap>, @@ -669,7 +669,7 @@ fn translate_linkage(linkage: Linkage) -> (SymbolScope, bool) { /// compilation. pub struct ObjectProduct { /// Object artifact with all functions and data from the module defined. - pub object: Object, + pub object: Object<'static>, /// Symbol IDs for functions (both declared and defined). pub functions: SecondaryMap>, /// Symbol IDs for data objects (both declared and defined). diff --git a/crates/cranelift/Cargo.toml b/crates/cranelift/Cargo.toml index 9339b71fee..6f5a435e48 100644 --- a/crates/cranelift/Cargo.toml +++ b/crates/cranelift/Cargo.toml @@ -22,7 +22,7 @@ cranelift-native = { path = '../../cranelift/native', version = '0.77.0' } wasmparser = "0.81.0" target-lexicon = "0.12" gimli = { version = "0.25.0", default-features = false, features = ['read', 'std'] } -object = { version = "0.26.0", default-features = false, features = ['write'] } +object = { version = "0.27.0", default-features = false, features = ['write'] } more-asserts = "0.2.1" thiserror = "1.0.4" diff --git a/crates/cranelift/src/compiler.rs b/crates/cranelift/src/compiler.rs index 0f947605d0..18402cc647 100644 --- a/crates/cranelift/src/compiler.rs +++ b/crates/cranelift/src/compiler.rs @@ -222,7 +222,7 @@ impl wasmtime_environ::Compiler for Compiler { types: &TypeTables, funcs: PrimaryMap>, emit_dwarf: bool, - obj: &mut Object, + obj: &mut Object<'static>, ) -> Result<(PrimaryMap, Vec)> { let funcs: crate::CompiledFunctions = funcs .into_iter() @@ -317,7 +317,7 @@ impl wasmtime_environ::Compiler for Compiler { &self, ty: &WasmFuncType, host_fn: usize, - obj: &mut Object, + obj: &mut Object<'static>, ) -> Result<(Trampoline, Trampoline)> { let host_to_wasm = self.host_to_wasm_trampoline(ty)?; let wasm_to_host = self.wasm_to_host_trampoline(ty, host_fn)?; diff --git a/crates/cranelift/src/obj.rs b/crates/cranelift/src/obj.rs index a5bed41d89..08048e5e86 100644 --- a/crates/cranelift/src/obj.rs +++ b/crates/cranelift/src/obj.rs @@ -105,7 +105,7 @@ pub struct ObjectBuilder<'a> { isa: &'a dyn TargetIsa, /// The object file that we're generating code into. - obj: &'a mut Object, + obj: &'a mut Object<'static>, /// The WebAssembly module we're generating code for. module: &'a Module, @@ -163,7 +163,7 @@ struct RUNTIME_FUNCTION { } impl<'a> ObjectBuilder<'a> { - pub fn new(obj: &'a mut Object, module: &'a Module, isa: &'a dyn TargetIsa) -> Self { + pub fn new(obj: &'a mut Object<'static>, module: &'a Module, isa: &'a dyn TargetIsa) -> Self { // Entire code (functions and trampolines) will be placed // in the ".text" section. let text_section = obj.add_section( diff --git a/crates/environ/Cargo.toml b/crates/environ/Cargo.toml index cc9756688f..063c0adc67 100644 --- a/crates/environ/Cargo.toml +++ b/crates/environ/Cargo.toml @@ -22,7 +22,7 @@ log = { version = "0.4.8", default-features = false } more-asserts = "0.2.1" cfg-if = "1.0" gimli = { version = "0.25.0", default-features = false, features = ['read'] } -object = { version = "0.26.0", default-features = false, features = ['read_core', 'write_core', 'elf'] } +object = { version = "0.27.0", default-features = false, features = ['read_core', 'write_core', 'elf'] } target-lexicon = "0.12" [badges] diff --git a/crates/environ/src/compilation.rs b/crates/environ/src/compilation.rs index 30111e59db..2cb7e94af1 100644 --- a/crates/environ/src/compilation.rs +++ b/crates/environ/src/compilation.rs @@ -172,7 +172,7 @@ pub trait Compiler: Send + Sync { types: &TypeTables, funcs: PrimaryMap>, emit_dwarf: bool, - obj: &mut Object, + obj: &mut Object<'static>, ) -> Result<(PrimaryMap, Vec)>; /// Inserts two functions for host-to-wasm and wasm-to-host trampolines into @@ -186,7 +186,7 @@ pub trait Compiler: Send + Sync { &self, ty: &WasmFuncType, host_fn: usize, - obj: &mut Object, + obj: &mut Object<'static>, ) -> Result<(Trampoline, Trampoline)>; /// Creates a new `Object` file which is used to build the results of a @@ -195,7 +195,7 @@ pub trait Compiler: Send + Sync { /// The returned object file will have an appropriate /// architecture/endianness for `self.triple()`, but at this time it is /// always an ELF file, regardless of target platform. - fn object(&self) -> Result { + fn object(&self) -> Result> { use target_lexicon::Architecture::*; let triple = self.triple(); diff --git a/crates/jit/Cargo.toml b/crates/jit/Cargo.toml index d881b14d1f..47656d764b 100644 --- a/crates/jit/Cargo.toml +++ b/crates/jit/Cargo.toml @@ -22,7 +22,7 @@ anyhow = "1.0" cfg-if = "1.0" log = "0.4" gimli = { version = "0.25.0", default-features = false, features = ["std", "read"] } -object = { version = "0.26.0", default-features = false, features = ["std", "read_core", "elf"] } +object = { version = "0.27.0", default-features = false, features = ["std", "read_core", "elf"] } serde = { version = "1.0.94", features = ["derive"] } addr2line = { version = "0.16.0", default-features = false } ittapi-rs = { version = "0.1.5", optional = true } diff --git a/crates/jit/src/mmap_vec.rs b/crates/jit/src/mmap_vec.rs index fddd0e3eb7..fb4fd991d9 100644 --- a/crates/jit/src/mmap_vec.rs +++ b/crates/jit/src/mmap_vec.rs @@ -195,17 +195,13 @@ impl WritableBuffer for ObjectMmap { Ok(()) } - fn resize(&mut self, new_len: usize, value: u8) { + fn resize(&mut self, new_len: usize) { + // Resizing always appends 0 bytes and since new mmaps start out as 0 + // bytes we don't actually need to do anything as part of this other + // than update our own length. if new_len <= self.len { return; } - let mmap = self.mmap.as_mut().expect("write before reserve"); - - // new mmaps are automatically filled with zeros, so if we're asked to - // fill with zeros then we can skip the actual fill step. - if value != 0 { - mmap[self.len..][..new_len - self.len].fill(value); - } self.len = new_len; } diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml index a848d87f9d..188920241f 100644 --- a/crates/wasmtime/Cargo.toml +++ b/crates/wasmtime/Cargo.toml @@ -37,7 +37,7 @@ paste = "1.0.3" psm = "0.1.11" lazy_static = "1.4" rayon = { version = "1.0", optional = true } -object = { version = "0.26", default-features = false, features = ['read_core', 'elf'] } +object = { version = "0.27", default-features = false, features = ['read_core', 'elf'] } [target.'cfg(target_os = "windows")'.dependencies] winapi = "0.3.7"