pub unsafe fn walk_frames(
start_fp: usize,
stack_maps: &StackMapRegistry,
) -> Vec<StackRoot>Expand description
Walk JIT frames starting from the given frame pointer, collecting all GC roots.
Uses Cranelift’s frame_size metadata (the FP-to-SP distance, aka active_size())
to compute SP at each safepoint: SP = caller_FP - frame_size. This is the same
approach Wasmtime uses and is correct on both x86_64 and aarch64, regardless of
prologue structure or callee-saved register layout.
§Safety
start_fpmust be a valid frame pointer from within a JIT call chain (typically gc_trigger’s FP, read via inline asm).stack_mapsmust contain entries for all JIT functions in the call chain.- All frames in the chain must have frame pointers (
force-frame-pointers = true).