MCPcopy Index your code
hub / github.com/RustPython/RustPython / stack_index

Method stack_index

crates/vm/src/frame.rs:345–350  ·  view source on GitHub ↗
(&self, idx: usize)

Source from the content-addressed store, hash-verified

343 /// Get a reference to a stack slot by index from the bottom.
344 #[inline(always)]
345 fn stack_index(&self, idx: usize) -> &Option<PyStackRef> {
346 debug_assert!(idx < self.stack_top as usize);
347 let data = self.data_as_slice();
348 let raw_idx = self.nlocalsplus as usize + idx;
349 unsafe { &*(data.as_ptr().add(raw_idx) as *const Option<PyStackRef>) }
350 }
351
352 /// Get a mutable reference to a stack slot by index from the bottom.
353 #[inline(always)]

Callers 5

stack_lastMethod · 0.80
execute_instructionMethod · 0.80
specialize_callMethod · 0.80
specialize_call_kwMethod · 0.80
nth_valueMethod · 0.80

Calls 3

data_as_sliceMethod · 0.80
addMethod · 0.45
as_ptrMethod · 0.45

Tested by

no test coverage detected