pub struct FeedbackVector {
pub function_id: u16,
pub slots: HashMap<usize, FeedbackSlot>,
pub generation: u32,
}Expand description
Per-function feedback vector: maps bytecode offsets to IC slots.
Fields§
§function_id: u16§slots: HashMap<usize, FeedbackSlot>§generation: u32Implementations§
Source§impl FeedbackVector
impl FeedbackVector
Sourcepub fn rebase(&mut self, base_offset: usize)
pub fn rebase(&mut self, base_offset: usize)
Rebase slot keys by subtracting base_offset.
The interpreter records feedback at absolute bytecode IPs, but the JIT compiles sub-programs with 0-based instruction indices. This method remaps slots so the JIT can look up feedback by local offset.
Slots with offsets below base_offset are dropped (they belong to
a different function or the program preamble).
Sourcepub fn merge_at_offset(&mut self, other: &FeedbackVector, offset: usize)
pub fn merge_at_offset(&mut self, other: &FeedbackVector, offset: usize)
Merge another feedback vector’s slots into this one at a given offset.
Used when inlining a callee: the callee’s feedback slots are mapped
into the outer function’s sub-program index space by adding offset
to each slot key.
Sourcepub fn record_call(&mut self, offset: usize, target_function_id: u16)
pub fn record_call(&mut self, offset: usize, target_function_id: u16)
Records a call target at the given bytecode offset.
Sourcepub fn record_property(
&mut self,
offset: usize,
schema_id: u64,
field_idx: u16,
field_type_tag: u16,
receiver_kind: u8,
)
pub fn record_property( &mut self, offset: usize, schema_id: u64, field_idx: u16, field_type_tag: u16, receiver_kind: u8, )
Records a property access at the given bytecode offset.
receiver_kind: 0 = TypedObject (schema guard), 1 = HashMap (shape guard).
Sourcepub fn record_arithmetic(&mut self, offset: usize, left_tag: u8, right_tag: u8)
pub fn record_arithmetic(&mut self, offset: usize, left_tag: u8, right_tag: u8)
Records arithmetic operand types at the given bytecode offset.
Sourcepub fn record_method(
&mut self,
offset: usize,
receiver_kind: u8,
method_name_id: u32,
handler_ptr: usize,
)
pub fn record_method( &mut self, offset: usize, receiver_kind: u8, method_name_id: u32, handler_ptr: usize, )
Records a method dispatch at the given bytecode offset.
Sourcepub fn get_slot(&self, offset: usize) -> Option<&FeedbackSlot>
pub fn get_slot(&self, offset: usize) -> Option<&FeedbackSlot>
Retrieves the feedback slot at the given bytecode offset.
Sourcepub fn is_monomorphic(&self, offset: usize) -> bool
pub fn is_monomorphic(&self, offset: usize) -> bool
Returns true if the slot at the given offset is in Monomorphic state.
Sourcepub fn slot_count(&self) -> usize
pub fn slot_count(&self) -> usize
Number of active IC slots in this vector.
Sourcepub fn monomorphic_ratio(&self) -> f64
pub fn monomorphic_ratio(&self) -> f64
Fraction of IC slots that are monomorphic (0.0 to 1.0).
Used by the TierManager to decide whether feedback quality is sufficient to warrant optimizing JIT compilation. A high ratio (>0.7) suggests the function has stable types worth specializing.
Trait Implementations§
Source§impl Clone for FeedbackVector
impl Clone for FeedbackVector
Source§fn clone(&self) -> FeedbackVector
fn clone(&self) -> FeedbackVector
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for FeedbackVector
impl RefUnwindSafe for FeedbackVector
impl Send for FeedbackVector
impl Sync for FeedbackVector
impl Unpin for FeedbackVector
impl UnsafeUnpin for FeedbackVector
impl UnwindSafe for FeedbackVector
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
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