pub struct RefMap { /* private fields */ }Expand description
Which slots of a frame are Repr::Ref, as one bit each.
A frame’s roots are a static fact here rather than a program-counter dependent one, and that is the point of the register machine: a stack machine’s live-reference set changes as operands are pushed and popped, so its map has to be indexed by pc. Here the answer does not change between the first instruction of a function and the last.
The lowering guarantees the one fact this relies on: a slot’s Repr is
fixed for the whole function. A slot may be reused by a later value of
the same Repr — that is what keeps a frame from growing with every
temporary a long body mentions — but never by one of a different Repr,
because then no single bit would be right at every program counter.
A static map says which slots the collector reads. It cannot say when the
value in one stopped being needed, because that is a fact about a program
point. The lowering answers that in the data instead: it emits
Clear at a reference’s last use, so a dead slot
holds null and the collector traces nothing from it.
Implementations§
Source§impl RefMap
impl RefMap
Sourcepub fn of(reprs: &[Repr]) -> RefMap
pub fn of(reprs: &[Repr]) -> RefMap
The map for a frame of slots words, with reprs[i] at slot i.
Sourcepub fn is_ref(&self, slot: u32) -> bool
pub fn is_ref(&self, slot: u32) -> bool
Whether slot slot holds a reference.
Out of range answers false rather than panicking: the collector
walks a frame whose size it took from the same crate::Function as
this map, so a disagreement is a bug in the lowering, and a
collection is the worst place to discover one by unwinding.
Trait Implementations§
impl Eq for RefMap
impl StructuralPartialEq for RefMap
Auto Trait Implementations§
impl Freeze for RefMap
impl RefUnwindSafe for RefMap
impl Send for RefMap
impl Sync for RefMap
impl Unpin for RefMap
impl UnsafeUnpin for RefMap
impl UnwindSafe for RefMap
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.