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

Method ensure_index_at

winch/codegen/src/stack.rs:332–338  ·  view source on GitHub ↗

Ensures that there are at least `n` elements in the value stack, and returns the index calculated by: stack length minus `n`.

(&self, n: usize)

Source from the content-addressed store, hash-verified

330 /// Ensures that there are at least `n` elements in the value stack,
331 /// and returns the index calculated by: stack length minus `n`.
332 pub fn ensure_index_at(&self, n: usize) -> Result<usize> {
333 if self.len() >= n {
334 Ok(self.len() - n)
335 } else {
336 Err(format_err!(CodeGenError::missing_values_in_stack()))
337 }
338 }
339
340 /// Returns true if the stack contains a local with the provided index
341 /// except if the only time the local appears is the top element.

Callers 2

visit_memory_growMethod · 0.80
emit_table_growMethod · 0.80

Calls 2

OkFunction · 0.85
lenMethod · 0.45

Tested by

no test coverage detected