pub struct TreadMill {
sync: Mutex<TreadMillSync>,
}Expand description
A data structure for recording objects in the LOS.
All operations are protected by a single mutex TreadMill::sync.
Fields§
§sync: Mutex<TreadMillSync>Implementations§
source§impl TreadMill
impl TreadMill
pub fn new() -> Self
sourcepub fn add_to_treadmill(&self, object: ObjectReference, nursery: bool)
pub fn add_to_treadmill(&self, object: ObjectReference, nursery: bool)
Add an object to the treadmill.
New objects are normally added to alloc_nursery. But when allocating as live (e.g. when
concurrent marking is active), we directly add into the to_space.
sourcepub fn collect_nursery(&self) -> impl IntoIterator<Item = ObjectReference>
pub fn collect_nursery(&self) -> impl IntoIterator<Item = ObjectReference>
Take all objects from the collect_nursery. This is called during sweeping at which time
all unreachable young objects are in the collection nursery.
sourcepub fn collect_mature(&self) -> impl IntoIterator<Item = ObjectReference>
pub fn collect_mature(&self) -> impl IntoIterator<Item = ObjectReference>
Take all objects from the from_space. This is called during sweeping at which time all
unreachable old objects are in the from-space.
sourcepub fn copy(&self, object: ObjectReference, is_in_nursery: bool)
pub fn copy(&self, object: ObjectReference, is_in_nursery: bool)
Move an object to to_space. Called when an object is determined to be reachable.
sourcepub fn is_to_space_empty(&self) -> bool
pub fn is_to_space_empty(&self) -> bool
Return true if the to-space is empty.
sourcepub fn is_from_space_empty(&self) -> bool
pub fn is_from_space_empty(&self) -> bool
Return true if the from-space is empty.
sourcepub fn is_alloc_nursery_empty(&self) -> bool
pub fn is_alloc_nursery_empty(&self) -> bool
Return true if the allocation nursery is empty.
sourcepub fn is_collect_nursery_empty(&self) -> bool
pub fn is_collect_nursery_empty(&self) -> bool
Return true if the collection nursery is empty.
sourcepub fn flip(&mut self, full_heap: bool)
pub fn flip(&mut self, full_heap: bool)
Flip object sets.
It will flip the allocation nursery and the collection nursery.
If full_heap is true, it will also flip the from-space and the to-space.
sourcepub(crate) fn enumerate_objects(
&self,
enumerator: &mut dyn ObjectEnumerator,
all: bool,
)
pub(crate) fn enumerate_objects( &self, enumerator: &mut dyn ObjectEnumerator, all: bool, )
Enumerate objects.
Objects in the allocation nursery and the to-spaces are always enumerated. They include all objects during mutator time, and objects determined to be live during a GC.
If all is true, it will enumerate the collection nursery and the from-space, too.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TreadMill
impl RefUnwindSafe for TreadMill
impl Send for TreadMill
impl Sync for TreadMill
impl Unpin for TreadMill
impl UnwindSafe for TreadMill
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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