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

Method contains_latent_local

winch/codegen/src/stack.rs:342–355  ·  view source on GitHub ↗

Returns true if the stack contains a local with the provided index except if the only time the local appears is the top element.

(&self, index: u32)

Source from the content-addressed store, hash-verified

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.
342 pub fn contains_latent_local(&self, index: u32) -> bool {
343 self.inner
344 .iter()
345 // Iterate top-to-bottom so we can skip the top element and stop
346 // when we see a memory element.
347 .rev()
348 // The local is not latent if it's the top element because the top
349 // element will be popped next which materializes the local.
350 .skip(1)
351 // Stop when we see a memory element because that marks where we
352 // spilled up to so there will not be any locals past this point.
353 .take_while(|v| !v.is_mem())
354 .any(|v| v.is_local_at_index(index))
355 }
356
357 /// Extend the stack with the given elements.
358 pub fn extend(&mut self, values: impl IntoIterator<Item = Val>) {

Callers 1

emit_set_localMethod · 0.80

Calls 5

anyMethod · 0.80
is_local_at_indexMethod · 0.80
skipMethod · 0.45
iterMethod · 0.45
is_memMethod · 0.45

Tested by

no test coverage detected