Verify that all predecessors to an EBB are valid branches, and have the EBB recorded as a successor.

This commit is contained in:
Angus Holder
2017-03-20 11:07:50 +00:00
committed by Jakob Stoklund Olesen
parent c596ea1ac1
commit bb0246c8c1
2 changed files with 43 additions and 2 deletions

View File

@@ -72,6 +72,11 @@ impl JumpTableData {
.enumerate())
}
/// Checks if any of the entries branch to `ebb`.
pub fn branches_to(&self, ebb: Ebb) -> bool {
self.table.iter().any(|target_ebb| target_ebb.expand() == Some(ebb))
}
/// Access the whole table as a mutable slice.
pub fn as_mut_slice(&mut self) -> &mut [PackedOption<Ebb>] {
self.table.as_mut_slice()