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

Method stack

crates/environ/src/frame_table.rs:585–610  ·  view source on GitHub ↗

Get the offsets and types for operand stack values, from top of stack (most recently pushed) down.

(
        &self,
        shape: FrameStackShape,
    )

Source from the content-addressed store, hash-verified

583 /// Get the offsets and types for operand stack values, from top
584 /// of stack (most recently pushed) down.
585 pub fn stack(
586 &self,
587 shape: FrameStackShape,
588 ) -> impl Iterator<Item = (FrameStateSlotOffset, FrameValType)> {
589 fn unpack_option_shape(shape: FrameStackShape) -> Option<FrameStackShape> {
590 if shape.0 == u32::MAX {
591 None
592 } else {
593 Some(shape)
594 }
595 }
596
597 let mut shape = unpack_option_shape(shape);
598 core::iter::from_fn(move || {
599 shape.map(|s| {
600 let parent = FrameStackShape(self.stack_shape_parents[s.index()].get(LittleEndian));
601 let parent = unpack_option_shape(parent);
602 let offset =
603 FrameStateSlotOffset(self.stack_shape_offsets[s.index()].get(LittleEndian));
604 let ty = FrameValType::try_from(self.stack_shape_types[s.index()])
605 .expect("Invalid type");
606 shape = parent;
607 (offset, ty)
608 })
609 })
610 }
611
612 /// Returns an iterator over all storage in this frame.
613 pub fn stack_and_locals(

Callers 1

stack_and_localsMethod · 0.45

Calls 6

FrameStackShapeClass · 0.85
mapMethod · 0.45
getMethod · 0.45
indexMethod · 0.45
expectMethod · 0.45

Tested by

no test coverage detected