pub struct Mutation<'gc> { /* private fields */ }
Expand description
Handle value given by arena callbacks during construction and mutation. Allows allocating new
Gc
pointers and internally mutating values held by Gc
pointers.
Implementations§
Source§impl<'gc> Mutation<'gc>
impl<'gc> Mutation<'gc>
pub fn metrics(&self) -> &Metrics
Sourcepub fn backward_barrier(&self, parent: Gc<'gc, ()>, child: Option<Gc<'gc, ()>>)
pub fn backward_barrier(&self, parent: Gc<'gc, ()>, child: Option<Gc<'gc, ()>>)
IF we are in the marking phase AND the parent
pointer is colored black AND the child
(if
given) is colored white, then change the parent
color to gray and enqueue it for tracing.
This operation is known as a “backwards write barrier”. Calling this method is one of the
safe ways for the value in the parent
pointer to use internal mutability to adopt the
child
pointer without invalidating the color invariant.
If the child
parameter is given, then calling this method ensures that the parent
pointer may safely adopt the child
pointer. If no child
is given, then calling this
method is more general, and it ensures that the parent
pointer may adopt any child
pointer(s) before collection is next triggered.
Sourcepub fn forward_barrier(&self, parent: Option<Gc<'gc, ()>>, child: Gc<'gc, ()>)
pub fn forward_barrier(&self, parent: Option<Gc<'gc, ()>>, child: Gc<'gc, ()>)
IF we are in the marking phase AND the parent
pointer (if given) is colored black, AND
the child
is colored white, then immediately change the child
to gray and enqueue it
for tracing.
This operation is known as a “forwards write barrier”. Calling this method is one of the
safe ways for the value in the parent
pointer to use internal mutability to adopt the
child
pointer without invalidating the color invariant.
If the parent
parameter is given, then calling this method ensures that the parent
pointer may safely adopt the child
pointer. If no parent
is given, then calling this
method is more general, and it ensures that the child
pointer may be adopted by any
parent pointer(s) before collection is next triggered.