pub struct LoopInfo {
pub header_idx: usize,
pub end_idx: usize,
pub body_locals_written: HashSet<u16>,
pub body_locals_read: HashSet<u16>,
pub body_module_bindings_written: HashSet<u16>,
pub body_module_bindings_read: HashSet<u16>,
pub induction_vars: Vec<InductionVar>,
pub invariant_locals: HashSet<u16>,
pub invariant_module_bindings: HashSet<u16>,
pub body_can_allocate: bool,
pub hoistable_calls: Vec<usize>,
}Expand description
Information about a single loop in the bytecode.
Fields§
§header_idx: usizeBytecode index of LoopStart
end_idx: usizeBytecode index of LoopEnd
body_locals_written: HashSet<u16>Local variables written inside the loop body
body_locals_read: HashSet<u16>Local variables read inside the loop body
body_module_bindings_written: HashSet<u16>Module bindings written inside the loop body
body_module_bindings_read: HashSet<u16>Module bindings read inside the loop body
induction_vars: Vec<InductionVar>Identified induction variables
invariant_locals: HashSet<u16>Locals that are loop-invariant (read but not written in loop body)
invariant_module_bindings: HashSet<u16>Module bindings that are loop-invariant
body_can_allocate: boolWhether the loop body contains opcodes that may trigger heap allocation. When false, the GC safepoint poll at the loop header can be skipped, eliminating a load + compare + branch per iteration (~3 cycles saved).
hoistable_calls: Vec<usize>Bytecode indices of calls that the LICM pass identified as hoistable. Populated by the optimizer’s LICM analysis after loop detection. The translator consults this to emit hoisted calls in the loop pre-header.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LoopInfo
impl RefUnwindSafe for LoopInfo
impl Send for LoopInfo
impl Sync for LoopInfo
impl Unpin for LoopInfo
impl UnsafeUnpin for LoopInfo
impl UnwindSafe for LoopInfo
Blanket Implementations§
impl<T> Allocation for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more