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

Method update_crit_key

cranelift/bforest/src/path.rs:408–429  ·  view source on GitHub ↗

Update the critical key after removing the front entry of the leaf node.

(&mut self, pool: &mut NodePool<F>)

Source from the content-addressed store, hash-verified

406
407 /// Update the critical key after removing the front entry of the leaf node.
408 fn update_crit_key(&mut self, pool: &mut NodePool<F>) {
409 // Find the inner level containing the critical key for the current leaf node.
410 let crit_level = match self.left_sibling_branch_level(self.size - 1) {
411 None => return,
412 Some(l) => l,
413 };
414 let crit_kidx = self.entry[crit_level] - 1;
415
416 // Extract the new critical key from the leaf node.
417 let crit_key = pool[self.leaf_node()].leaf_crit_key();
418 let crit_node = self.node[crit_level];
419
420 match pool[crit_node] {
421 NodeData::Inner {
422 size, ref mut keys, ..
423 } => {
424 debug_assert!(crit_kidx < size);
425 keys[usize::from(crit_kidx)] = crit_key;
426 }
427 _ => panic!("Expected inner node"),
428 }
429 }
430
431 /// Given that the current leaf node is in an unhealthy (underflowed or even empty) status,
432 /// balance it with sibling nodes.

Callers 2

removeMethod · 0.80
balance_nodesMethod · 0.80

Calls 4

fromFunction · 0.85
leaf_crit_keyMethod · 0.80
leaf_nodeMethod · 0.80

Tested by

no test coverage detected