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

Method pop_stack_shape

crates/cranelift/src/translate/stack.rs:415–427  ·  view source on GitHub ↗
(&mut self, n: usize)

Source from the content-addressed store, hash-verified

413 }
414
415 fn pop_stack_shape(&mut self, n: usize) {
416 // The `stack_shape` vec represents the *clean* slots (already
417 // flushed to memory); its length is always less than or equal
418 // to `stack`, but indices always correspond between the
419 // two. Thus a pop on `stack` may or may not pop something on
420 // `stack_shape`; but if `stack` is truncated down to a length
421 // L by some number of pops, truncating `stack_shape` to that
422 // same length L will pop exactly the right shapes and will
423 // ensure that any new pushes that are "dirty" will be
424 // correctly represented as such.
425 let new_len = self.stack.len() - n;
426 self.stack_shape.truncate(new_len);
427 }
428
429 /// Peek at the top `n` values on the stack in the order they were pushed.
430 pub(crate) fn peekn(&self, n: usize) -> &[Value] {

Callers 5

pop1Method · 0.80
pop2Method · 0.80
pop3Method · 0.80
pop4Method · 0.80
pop5Method · 0.80

Calls 2

lenMethod · 0.45
truncateMethod · 0.45

Tested by

no test coverage detected