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

Method heal_level

cranelift/bforest/src/path.rs:487–503  ·  view source on GitHub ↗

After removing an entry from the node at `level`, check its health and rebalance as needed. Leave the path up to and including `level` in a normalized state where all entries are in bounds. Returns true if the tree becomes empty.

(&mut self, status: Removed, level: usize, pool: &mut NodePool<F>)

Source from the content-addressed store, hash-verified

485 ///
486 /// Returns true if the tree becomes empty.
487 fn heal_level(&mut self, status: Removed, level: usize, pool: &mut NodePool<F>) -> bool {
488 match status {
489 Removed::Healthy => {}
490 Removed::Rightmost => {
491 // The rightmost entry was removed from the current node, so move the path so it
492 // points at the first entry of the next node at this level.
493 debug_assert_eq!(
494 usize::from(self.entry[level]),
495 pool[self.node[level]].entries()
496 );
497 self.next_node(level, pool);
498 }
499 Removed::Underflow => self.underflowed_node(level, pool),
500 Removed::Empty => return self.empty_node(level, pool),
501 }
502 false
503 }
504
505 /// The current node at `level` has underflowed, meaning that it is below half capacity but
506 /// not completely empty.

Callers 2

balance_nodesMethod · 0.80
empty_nodeMethod · 0.80

Calls 3

next_nodeMethod · 0.80
underflowed_nodeMethod · 0.80
empty_nodeMethod · 0.80

Tested by

no test coverage detected