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)
| 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 |
no test coverage detected