(
instructions: &[Instruction],
source_index: usize,
target: i32,
)
| 1477 | .skip(old) |
| 1478 | .find_map(|mapped| *mapped) |
| 1479 | .unwrap_or(next_index); |
| 1480 | u16::try_from(mapped).map_err(|_| jvm::Error::VerificationError { |
| 1481 | context: "optimise2".to_string(), |
| 1482 | message: "Compacted exception range end exceeds the JVM limit".to_string(), |
| 1483 | }) |
| 1484 | }; |
| 1485 | for entry in exception_table.iter_mut() { |
| 1486 | entry.range_pc = |
| 1487 | map_exact_boundary(entry.range_pc.start)?..map_end_boundary(entry.range_pc.end)?; |
| 1488 | entry.handler_pc = map_exact_boundary(entry.handler_pc)?; |
| 1489 | } |
| 1490 | |
| 1491 | let mut compacted = Vec::with_capacity(next_index); |
| 1492 | let mut compacted_locations = Vec::with_capacity(next_index); |
| 1493 | for (old_index, (instruction, source_location)) in |
| 1494 | instructions.into_iter().zip(source_locations).enumerate() |
| 1495 | { |
| 1496 | if !keep[old_index] { |
| 1497 | continue; |
| 1498 | } |
| 1499 | let new_index = old_to_new[old_index].ok_or_else(|| jvm::Error::VerificationError { |
| 1500 | context: "optimise2".to_string(), |
| 1501 | message: format!("Kept instruction {old_index} has no compacted index"), |
| 1502 | })?; |
no test coverage detected