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

Method truncate_stack_to

winch/codegen/src/codegen/context.rs:809–818  ·  view source on GitHub ↗

Truncates the value stack to the specified target. This function is intended to only be used when restoring the code generation's reachability state, when handling an unreachable end or else.

(&mut self, target: usize)

Source from the content-addressed store, hash-verified

807 /// generation's reachability state, when handling an unreachable end or
808 /// else.
809 pub fn truncate_stack_to(&mut self, target: usize) -> Result<()> {
810 if self.stack.len() > target {
811 self.drop_last(self.stack.len() - target, |regalloc, val| match val {
812 Val::Reg(tr) => Ok(regalloc.free(tr.reg)),
813 _ => Ok(()),
814 })
815 } else {
816 Ok(())
817 }
818 }
819
820 /// Load the [VMContext] pointer into the designated pinned register.
821 pub fn load_vmctx<M>(&mut self, masm: &mut M) -> Result<()>

Callers 2

emit_endMethod · 0.80
ensure_stack_stateMethod · 0.80

Calls 4

OkFunction · 0.85
drop_lastMethod · 0.80
lenMethod · 0.45
freeMethod · 0.45

Tested by

no test coverage detected