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

Method local

crates/wasmtime/src/runtime/debug.rs:585–595  ·  view source on GitHub ↗

Get the type and value of the given local in this frame. # Panics Panics if the index is out-of-range (greater than `num_locals()`).

(&self, mut store: impl AsContextMut, index: u32)

Source from the content-addressed store, hash-verified

583 /// Panics if the index is out-of-range (greater than
584 /// `num_locals()`).
585 pub fn local(&self, mut store: impl AsContextMut, index: u32) -> Result<Val> {
586 let store = store.as_context_mut();
587 let frame_data = self.frame_data(store.0.as_store_opaque())?;
588 let (offset, ty) = frame_data.locals[usize::try_from(index).unwrap()];
589 let slot_addr = frame_data.slot_addr(self.cursor.frame().fp());
590 // SAFETY: compiler produced metadata to describe this local
591 // slot and stored a value of the correct type into it. Slot
592 // address is valid because we checked liveness of the
593 // activation/frame via `frame_data` above.
594 Ok(unsafe { read_value(store.0.as_store_opaque(), slot_addr, offset, ty) })
595 }
596
597 /// Get the type and value of the given operand-stack value in
598 /// this frame.

Callers

nothing calls this directly

Calls 9

OkFunction · 0.85
read_valueFunction · 0.85
frame_dataMethod · 0.80
as_store_opaqueMethod · 0.80
slot_addrMethod · 0.80
frameMethod · 0.80
as_context_mutMethod · 0.45
unwrapMethod · 0.45
fpMethod · 0.45

Tested by

no test coverage detected