pub struct StackMapRegistry { /* private fields */ }Expand description
Maps absolute return addresses to stack map info.
Key = function_base_ptr + code_offset
(i.e., the return address, which is what the frame walker sees as caller_pc).
Cranelift’s code_offset for user stack maps already points to the
instruction AFTER the call (the return point).
Implementations§
Source§impl StackMapRegistry
impl StackMapRegistry
pub fn new() -> Self
Sourcepub fn register(
&mut self,
base_ptr: usize,
size: u32,
raw_entries: &[RawStackMap],
)
pub fn register( &mut self, base_ptr: usize, size: u32, raw_entries: &[RawStackMap], )
Register stack map entries from a compiled function.
base_ptr is the start address of the compiled function in memory.
size is the total size of the function in bytes.
raw_entries come from CompiledCode.buffer.user_stack_maps():
each tuple is (code_offset, frame_size, UserStackMap).
We key by base_ptr + code_offset as the return address. Cranelift’s
code_offset for user stack maps points to the instruction AFTER the call
(the return point), so base_ptr + code_offset IS the absolute return address.
Sourcepub fn lookup(&self, return_addr: usize) -> Option<&StackMapInfo>
pub fn lookup(&self, return_addr: usize) -> Option<&StackMapInfo>
Look up stack map info by return address (PC value from frame walker).
Sourcepub fn contains_address(&self, addr: usize) -> bool
pub fn contains_address(&self, addr: usize) -> bool
Check if an address falls within the known JIT code region. Used by the frame walker to determine when to stop walking.