Move address maps to a section of the compiled image (#3240)
This commit moves the `address_map` field of `FunctionInfo` into a custom-encoded section of the executable. The goal of this commit is, as previous commits, to push less data through `bincode`. The `address_map` field is actually extremely large and has huge benefits of not being decoded when we load a module. This data is only used for traps and such as well, so it's not overly important that it's massaged in to precise data the runtime can extremely speedily use. The `FunctionInfo` type does retain a tiny bit of information about the function itself (it's start source location), but other than that the `FunctionAddressMap` structure is moved from `wasmtime-environ` to `wasmtime-cranelift` since it's now no longer needed outside of that context.
This commit is contained in:
@@ -849,7 +849,7 @@ mod tests {
|
||||
};
|
||||
use crate::CompiledFunction;
|
||||
use gimli::{self, constants, Encoding, EndianSlice, Expression, RunTimeEndian};
|
||||
use wasmtime_environ::{FilePos, FunctionInfo};
|
||||
use wasmtime_environ::FilePos;
|
||||
|
||||
macro_rules! dw_op {
|
||||
(DW_OP_WASM_location) => {
|
||||
@@ -1177,39 +1177,37 @@ mod tests {
|
||||
}
|
||||
|
||||
fn create_mock_address_transform() -> AddressTransform {
|
||||
use crate::FunctionAddressMap;
|
||||
use cranelift_entity::PrimaryMap;
|
||||
use wasmtime_environ::InstructionAddressMap;
|
||||
use wasmtime_environ::WasmFileInfo;
|
||||
use wasmtime_environ::{FunctionAddressMap, InstructionAddressMap};
|
||||
let mut module_map = PrimaryMap::new();
|
||||
let code_section_offset: u32 = 100;
|
||||
module_map.push(CompiledFunction {
|
||||
info: FunctionInfo {
|
||||
address_map: FunctionAddressMap {
|
||||
instructions: vec![
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::new(code_section_offset + 12),
|
||||
code_offset: 5,
|
||||
},
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::default(),
|
||||
code_offset: 8,
|
||||
},
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::new(code_section_offset + 17),
|
||||
code_offset: 15,
|
||||
},
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::default(),
|
||||
code_offset: 23,
|
||||
},
|
||||
]
|
||||
.into(),
|
||||
start_srcloc: FilePos::new(code_section_offset + 10),
|
||||
end_srcloc: FilePos::new(code_section_offset + 20),
|
||||
body_offset: 0,
|
||||
body_len: 30,
|
||||
},
|
||||
..Default::default()
|
||||
address_map: FunctionAddressMap {
|
||||
instructions: vec![
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::new(code_section_offset + 12),
|
||||
code_offset: 5,
|
||||
},
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::default(),
|
||||
code_offset: 8,
|
||||
},
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::new(code_section_offset + 17),
|
||||
code_offset: 15,
|
||||
},
|
||||
InstructionAddressMap {
|
||||
srcloc: FilePos::default(),
|
||||
code_offset: 23,
|
||||
},
|
||||
]
|
||||
.into(),
|
||||
start_srcloc: FilePos::new(code_section_offset + 10),
|
||||
end_srcloc: FilePos::new(code_section_offset + 20),
|
||||
body_offset: 0,
|
||||
body_len: 30,
|
||||
},
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user