MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / set_address_map

Method set_address_map

crates/cranelift/src/compiled_function.rs:165–190  ·  view source on GitHub ↗

Create and return the compiled function address map from the original source offset and length.

(&mut self, offset: u32, length: u32, with_instruction_addresses: bool)

Source from the content-addressed store, hash-verified

163 /// Create and return the compiled function address map from the original source offset
164 /// and length.
165 pub fn set_address_map(&mut self, offset: u32, length: u32, with_instruction_addresses: bool) {
166 assert!((offset + length) <= u32::max_value());
167 let len = self.buffer.data().len();
168 let srclocs = self
169 .buffer
170 .get_srclocs_sorted()
171 .into_iter()
172 .map(|&MachSrcLoc { start, end, loc }| (loc, start, (end - start)));
173 let instructions = if with_instruction_addresses {
174 collect_address_maps(len.try_into().unwrap(), srclocs)
175 } else {
176 Default::default()
177 };
178 let start_srcloc = FilePos::new(offset);
179 let end_srcloc = FilePos::new(offset + length);
180
181 let address_map = FunctionAddressMap {
182 instructions: instructions.into(),
183 start_srcloc,
184 end_srcloc,
185 body_offset: 0,
186 body_len: len.try_into().unwrap(),
187 };
188
189 self.metadata.address_map = address_map;
190 }
191
192 /// Get a reference to the unwind information from the
193 /// function's metadata.

Callers 2

finish_with_infoMethod · 0.80
compile_functionMethod · 0.80

Calls 9

collect_address_mapsFunction · 0.85
get_srclocs_sortedMethod · 0.80
newFunction · 0.50
lenMethod · 0.45
dataMethod · 0.45
mapMethod · 0.45
into_iterMethod · 0.45
unwrapMethod · 0.45
try_intoMethod · 0.45

Tested by

no test coverage detected