Returns the blocks corresponding to the bits indexed by `target` that are not set.
(&self, vm: &mut Vm, target: &[u32])
| 409 | |
| 410 | /// Returns the blocks corresponding to the bits indexed by `target` that are not set. |
| 411 | pub fn get_unreached_blocks(&self, vm: &mut Vm, target: &[u32]) -> Vec<u64> { |
| 412 | self.update_mapping_cache(vm); |
| 413 | let mapping = self.mapping_cache.borrow(); |
| 414 | |
| 415 | let cov: &[u64] = bytemuck::cast_slice(vm.cpu.trace[self.storage].data()); |
| 416 | if self.pack_bits { |
| 417 | target |
| 418 | .iter() |
| 419 | .copied() |
| 420 | .filter(|bit| !is_bit_set(cov, *bit)) |
| 421 | .map(|bit| mapping.get(bit as usize).map_or(0, |(addr, _)| *addr)) |
| 422 | .collect() |
| 423 | } |
| 424 | else { |
| 425 | target |
| 426 | .iter() |
| 427 | .enumerate() |
| 428 | .filter(|(_, entry)| **entry == 0) |
| 429 | .map(|(i, _)| mapping.get(i).map_or(0, |(addr, _)| *addr)) |
| 430 | .collect() |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /// Update the mapping of blocks IDs to addresses if the mapping has changed. |
| 435 | fn update_mapping_cache(&self, vm: &mut Vm) { |
no test coverage detected