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

Method stack

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

Get the type and value of the given operand-stack value in this frame. Index 0 corresponds to the bottom-of-stack, and higher indices from there are more recently pushed values. In other words, index order reads the Wasm virtual machine's abstract stack state left-to-right.

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

Source from the content-addressed store, hash-verified

602 /// index order reads the Wasm virtual machine's abstract stack
603 /// state left-to-right.
604 pub fn stack(&self, mut store: impl AsContextMut, index: u32) -> Result<Val> {
605 let store = store.as_context_mut();
606 let frame_data = self.frame_data(store.0.as_store_opaque())?;
607 let (offset, ty) = frame_data.stack[usize::try_from(index).unwrap()];
608 let slot_addr = frame_data.slot_addr(self.cursor.frame().fp());
609 // SAFETY: compiler produced metadata to describe this
610 // operand-stack slot and stored a value of the correct type
611 // into it. Slot address is valid because we checked liveness
612 // of the activation/frame via `frame_data` above.
613 Ok(unsafe { read_value(store.0.as_store_opaque(), slot_addr, offset, ty) })
614 }
615}
616
617/// A cache from `StoreCodePC`s for modules' private code within a

Callers 3

replaceMethod · 0.45
resume_fiberFunction · 0.45
computeMethod · 0.45

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