MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / update_mapping_cache

Method update_mapping_cache

hail-fuzz/src/coverage.rs:435–452  ·  view source on GitHub ↗

Update the mapping of blocks IDs to addresses if the mapping has changed.

(&self, vm: &mut Vm)

Source from the content-addressed store, hash-verified

433
434 /// Update the mapping of blocks IDs to addresses if the mapping has changed.
435 fn update_mapping_cache(&self, vm: &mut Vm) {
436 let injector_mapping = match self.pack_bits {
437 true => {
438 &vm.get_injector_mut::<ExactBlockCoverageInjector>(self.injector).unwrap().mapping
439 }
440 false => {
441 &vm.get_injector_mut::<ExactBlockCountCoverageInjector>(self.injector)
442 .unwrap()
443 .mapping
444 }
445 };
446 if self.mapping_cache.borrow().len() != injector_mapping.len() {
447 let mut mapping = self.mapping_cache.borrow_mut();
448 mapping.clear();
449 mapping.extend(injector_mapping.iter().map(|(addr, idx)| (*addr, *idx)));
450 mapping.sort_by_key(|(_, index)| *index);
451 }
452 }
453
454 /// Translate coverage bits to real blocks.
455 pub fn blocks_for(&self, vm: &mut Vm, bits: &[u32]) -> Vec<u64> {

Callers 4

get_blocksMethod · 0.80
get_unreached_blocksMethod · 0.80
blocks_forMethod · 0.80
serializeMethod · 0.80

Calls 2

lenMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected