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>
impl<P> RefUnwindSafe for LocatedCode<P>where
<P as InstructionPolicy>::Instruction: RefUnwindSafe,
<P as InstructionPolicy>::InstructionId: RefUnwindSafe,
impl<P> Send for LocatedCode<P>
impl<P> Sync for LocatedCode<P>
impl<P> Unpin for LocatedCode<P>
impl<P> UnsafeUnpin for LocatedCode<P>
impl<P> UnwindSafe for LocatedCode<P>where
<P as InstructionPolicy>::InstructionId: RefUnwindSafe + UnwindSafe,
<P as InstructionPolicy>::Instruction: 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