Skip to main content

Marker

Struct Marker 

Source
pub struct Marker { /* private fields */ }
Expand description

Holds the gray queue during a mark phase. Passed to Trace::trace.

Implementations§

Source§

impl Marker

Source

pub fn mark<T: Trace + 'static>(&mut self, gc: Gc<T>)

Mark a Gc<T> as gray (reachable, but its outgoing edges not yet traced). Called by Trace::trace implementations.

Per-cycle dedup uses visited (a HashSet of box identities) rather than the color flag. Color-based dedup would silently skip new_uncollected boxes left Black by the previous cycle — those allocations are NOT on the heap’s allgc chain, so the start-of-mark “reset all allgc to White” loop does not reach them, and a Black uncollected box would be skipped without re-tracing its children (causing reachable allgc descendants to be swept). The visited set is rebuilt every full_collect (Marker::new), so this dedup is always per-cycle.

Source

pub fn try_visit(&mut self, addr: usize) -> bool

Record that an Rc-backed object (GcRef<T> in Phase A-D-0) has been visited and return whether this is the first visit. Used by recursive Trace impls to break cycles while the real Gc<T> gray-queue path is not yet wired (e.g. _G._G == _G would otherwise infinitely recurse).

Source

pub fn is_visited(&self, id: usize) -> bool

True iff id was reached during the mark phase. Used by the post-mark hook (Heap::full_collect_with_post_mark) to decide whether a weak-table entry’s target is still strongly reachable. Read-only — callers cannot add entries.

Source

pub fn visited_count(&self) -> usize

Number of objects marked so far. Used by the post-mark hook’s ephemeron-convergence fixed-point loop to detect when an iteration added no new reachable objects and the loop can terminate.

Source

pub fn drain_gray_queue(&mut self)

Drain the gray queue, transitively marking children. Each gray box becomes black; its Trace::trace is called so the children it points at get pushed onto the queue. Repeats until the queue is empty.

Exposed for the post-mark hook so it can run ephemeron convergence: after marking new values via Marker::mark (or value.trace(self)), the hook calls drain_gray_queue to propagate the new reachability, then re-checks for fixed-point.

Auto Trait Implementations§

§

impl Freeze for Marker

§

impl !RefUnwindSafe for Marker

§

impl !Send for Marker

§

impl !Sync for Marker

§

impl Unpin for Marker

§

impl UnsafeUnpin for Marker

§

impl !UnwindSafe for Marker

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.