pub struct FeedbackVector { /* private fields */ }Expand description
Runtime feedback vector for a single function activation.
A FeedbackVector is created from a FeedbackMetadata at runtime (once
per function object, not once per call). The interpreter reads and writes
InlineCacheState entries to record what types it has seen at each
instruction site.
§Slot transitions
Slots start at InlineCacheState::Uninitialized and can only move
forward through the ordering Uninitialized → Monomorphic → Polymorphic → Megamorphic. Use FeedbackVector::transition to advance a slot while
respecting this invariant.
Implementations§
Source§impl FeedbackVector
impl FeedbackVector
Sourcepub fn new(metadata: &FeedbackMetadata) -> Self
pub fn new(metadata: &FeedbackMetadata) -> Self
Create a new FeedbackVector from compile-time metadata.
All slots start at InlineCacheState::Uninitialized.
Sourcepub fn slot_count(&self) -> u32
pub fn slot_count(&self) -> u32
The total number of slots in this vector.
Sourcepub fn kind_of(&self, slot: u32) -> Option<FeedbackSlotKind>
pub fn kind_of(&self, slot: u32) -> Option<FeedbackSlotKind>
Return the FeedbackSlotKind for slot, or None if out of range.
Sourcepub fn get_state(&self, slot: u32) -> Option<InlineCacheState>
pub fn get_state(&self, slot: u32) -> Option<InlineCacheState>
Return the current InlineCacheState for slot, or None if out of
range.
Sourcepub fn set_state(&mut self, slot: u32, state: InlineCacheState) -> bool
pub fn set_state(&mut self, slot: u32, state: InlineCacheState) -> bool
Unconditionally set the InlineCacheState for slot.
Returns true if the slot existed (state was updated), false
otherwise.
Sourcepub fn transition(&mut self, slot: u32, new_state: InlineCacheState) -> bool
pub fn transition(&mut self, slot: u32, new_state: InlineCacheState) -> bool
Advance the slot to new_state only if new_state is strictly higher
in the ordering than the current state.
Returns true if the state was advanced, false otherwise (including
when the slot index is out of range).
Trait Implementations§
Source§impl Clone for FeedbackVector
impl Clone for FeedbackVector
Source§fn clone(&self) -> FeedbackVector
fn clone(&self) -> FeedbackVector
1.0.0 (const: unstable) · 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> 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