Update the object crate to 0.27.0 (#3465)

Mostly just keeping us up to date with changes there since we somewhat
heavily rely on it now.
This commit is contained in:
Alex Crichton
2021-10-20 10:52:06 -05:00
committed by GitHub
parent fe4b15c8b0
commit e2a724ce18
12 changed files with 25 additions and 29 deletions

View File

@@ -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"

View File

@@ -222,7 +222,7 @@ impl wasmtime_environ::Compiler for Compiler {
types: &TypeTables,
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
emit_dwarf: bool,
obj: &mut Object,
obj: &mut Object<'static>,
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)> {
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)?;

View File

@@ -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(

View File

@@ -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]

View File

@@ -172,7 +172,7 @@ pub trait Compiler: Send + Sync {
types: &TypeTables,
funcs: PrimaryMap<DefinedFuncIndex, Box<dyn Any + Send>>,
emit_dwarf: bool,
obj: &mut Object,
obj: &mut Object<'static>,
) -> Result<(PrimaryMap<DefinedFuncIndex, FunctionInfo>, Vec<Trampoline>)>;
/// 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<Object> {
fn object(&self) -> Result<Object<'static>> {
use target_lexicon::Architecture::*;
let triple = self.triple();

View File

@@ -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 }

View File

@@ -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;
}

View File

@@ -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"