pub struct LocatedCode<P: InstructionPolicy> { /* private fields */ }Expand description
Immutable, fully validated located instructions and their control metadata.
Implementations§
Source§impl<P> LocatedCode<P>
impl<P> LocatedCode<P>
Sourcepub fn freeze(
instructions: Vec<LocatedInstruction<P::Instruction, P::InstructionId>>,
targets: Vec<BranchTarget<P::InstructionId>>,
regions: Vec<RegionSpec<P::InstructionId>>,
) -> Result<Self, CodeError<P::InstructionId>>
pub fn freeze( instructions: Vec<LocatedInstruction<P::Instruction, P::InstructionId>>, targets: Vec<BranchTarget<P::InstructionId>>, regions: Vec<RegionSpec<P::InstructionId>>, ) -> Result<Self, CodeError<P::InstructionId>>
Validates every location and edge before freezing the code.
Sourcepub fn entry(&self) -> CodeCursor
pub fn entry(&self) -> CodeCursor
Returns the entry cursor, always an instruction boundary.
Sourcepub fn cursor(&self, id: P::InstructionId) -> Option<CodeCursor>
pub fn cursor(&self, id: P::InstructionId) -> Option<CodeCursor>
Resolves a stable instruction identity to a valid cursor.
Sourcepub fn instruction(
&self,
cursor: CodeCursor,
) -> &LocatedInstruction<P::Instruction, P::InstructionId>
pub fn instruction( &self, cursor: CodeCursor, ) -> &LocatedInstruction<P::Instruction, P::InstructionId>
Returns the instruction addressed by cursor.
Sourcepub fn next(&self, cursor: CodeCursor) -> Option<CodeCursor>
pub fn next(&self, cursor: CodeCursor) -> Option<CodeCursor>
Advances to the next instruction boundary, or returns None at code end.
Sourcepub fn branch_targets(&self, from: P::InstructionId) -> &[CodeCursor]
pub fn branch_targets(&self, from: P::InstructionId) -> &[CodeCursor]
Returns every validated branch target for an instruction in declaration order.
Sourcepub fn protected_regions(&self) -> &[ProtectedRegion]
pub fn protected_regions(&self) -> &[ProtectedRegion]
Returns the immutable protected-region table.
Sourcepub fn innermost_protected_region(
&self,
cursor: CodeCursor,
) -> Option<ProtectedRegion>
pub fn innermost_protected_region( &self, cursor: CodeCursor, ) -> Option<ProtectedRegion>
Selects the most deeply nested protected region containing cursor.
Auto Trait Implementations§
impl<P> Freeze for LocatedCode<P>where
Box<[LocatedInstruction<<P as InstructionPolicy>::Instruction, <P as InstructionPolicy>::InstructionId>]>: Freeze,
BTreeMap<<P as InstructionPolicy>::InstructionId, CodeCursor>: Freeze,
BTreeMap<<P as InstructionPolicy>::InstructionId, Box<[CodeCursor]>>: Freeze,
impl<P> RefUnwindSafe for LocatedCode<P>where
Box<[LocatedInstruction<<P as InstructionPolicy>::Instruction, <P as InstructionPolicy>::InstructionId>]>: RefUnwindSafe,
BTreeMap<<P as InstructionPolicy>::InstructionId, CodeCursor>: RefUnwindSafe,
BTreeMap<<P as InstructionPolicy>::InstructionId, Box<[CodeCursor]>>: RefUnwindSafe,
impl<P> Send for LocatedCode<P>where
Box<[LocatedInstruction<<P as InstructionPolicy>::Instruction, <P as InstructionPolicy>::InstructionId>]>: Send,
BTreeMap<<P as InstructionPolicy>::InstructionId, CodeCursor>: Send,
BTreeMap<<P as InstructionPolicy>::InstructionId, Box<[CodeCursor]>>: Send,
impl<P> Sync for LocatedCode<P>where
Box<[LocatedInstruction<<P as InstructionPolicy>::Instruction, <P as InstructionPolicy>::InstructionId>]>: Sync,
BTreeMap<<P as InstructionPolicy>::InstructionId, CodeCursor>: Sync,
BTreeMap<<P as InstructionPolicy>::InstructionId, Box<[CodeCursor]>>: Sync,
impl<P> Unpin for LocatedCode<P>where
Box<[LocatedInstruction<<P as InstructionPolicy>::Instruction, <P as InstructionPolicy>::InstructionId>]>: Unpin,
BTreeMap<<P as InstructionPolicy>::InstructionId, CodeCursor>: Unpin,
BTreeMap<<P as InstructionPolicy>::InstructionId, Box<[CodeCursor]>>: Unpin,
impl<P> UnsafeUnpin for LocatedCode<P>where
Box<[LocatedInstruction<<P as InstructionPolicy>::Instruction, <P as InstructionPolicy>::InstructionId>]>: UnsafeUnpin,
BTreeMap<<P as InstructionPolicy>::InstructionId, CodeCursor>: UnsafeUnpin,
BTreeMap<<P as InstructionPolicy>::InstructionId, Box<[CodeCursor]>>: UnsafeUnpin,
impl<P> UnwindSafe for LocatedCode<P>where
Box<[LocatedInstruction<<P as InstructionPolicy>::Instruction, <P as InstructionPolicy>::InstructionId>]>: UnwindSafe,
BTreeMap<<P as InstructionPolicy>::InstructionId, CodeCursor>: UnwindSafe,
BTreeMap<<P as InstructionPolicy>::InstructionId, Box<[CodeCursor]>>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more