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

Function gc_refs_in_frame

crates/wasmtime/src/runtime/debug.rs:833–862  ·  view source on GitHub ↗
(ft: FrameTable<'a>, pc: u32, fp: *mut usize)

Source from the content-addressed store, hash-verified

831// structured result) within the closure borrowed by a nested closure.
832#[cfg(feature = "gc")]
833pub(crate) fn gc_refs_in_frame<'a>(ft: FrameTable<'a>, pc: u32, fp: *mut usize) -> Vec<*mut u32> {
834 let fp = fp.cast::<u8>();
835 let mut ret = vec![];
836 if let Some(frames) = ft.find_program_point(pc, FrameInstPos::Post) {
837 for (_wasm_pc, frame_desc, stack_shape) in frames {
838 let (frame_desc_data, slot_to_fp_offset) = ft.frame_descriptor(frame_desc).unwrap();
839 let frame_base = unsafe { fp.offset(-isize::try_from(slot_to_fp_offset).unwrap()) };
840 let frame_desc = FrameStateSlot::parse(frame_desc_data).unwrap();
841 for (offset, ty) in frame_desc.stack_and_locals(stack_shape) {
842 match ty {
843 FrameValType::AnyRef | FrameValType::ExnRef | FrameValType::ExternRef => {
844 let slot = unsafe {
845 frame_base
846 .offset(isize::try_from(offset.offset()).unwrap())
847 .cast::<u32>()
848 };
849 ret.push(slot);
850 }
851 FrameValType::ContRef | FrameValType::FuncRef => {}
852 FrameValType::I32
853 | FrameValType::I64
854 | FrameValType::F32
855 | FrameValType::F64
856 | FrameValType::V128 => {}
857 }
858 }
859 }
860 }
861 ret
862}
863
864/// One debug event that occurs when running Wasm code on a store with
865/// a debug handler attached.

Callers 1

Calls 7

find_program_pointMethod · 0.80
frame_descriptorMethod · 0.80
stack_and_localsMethod · 0.80
parseFunction · 0.50
unwrapMethod · 0.45
offsetMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected