Struct mmtk::plan::Mutator

source ·
#[repr(C)]
pub struct Mutator<VM: VMBinding> { pub barrier: Box<dyn Barrier<VM>>, pub mutator_tls: VMMutatorThread, /* private fields */ }
Expand description

A mutator is a per-thread data structure that manages allocations and barriers. It is usually highly coupled with the language VM. It is recommended for MMTk users 1) to have a mutator struct of the same layout in the thread local storage that can be accessed efficiently, and 2) to implement fastpath allocation and barriers for the mutator in the VM side.

Fields§

§barrier: Box<dyn Barrier<VM>>

Holds some thread-local states for the barrier.

§mutator_tls: VMMutatorThread

The mutator thread that is bound with this Mutator struct.

Implementations§

source§

impl<VM: VMBinding> Mutator<VM>

source

pub fn on_destroy(&mut self)

Inform each allocator about destroying. Call allocator-specific on destroy methods.

source

pub unsafe fn allocator( &self, selector: AllocatorSelector ) -> &dyn Allocator<VM>

Get the allocator for the selector.

§Safety

The selector needs to be valid, and points to an allocator that has been initialized. crate::memory_manager::get_allocator_mapping can be used to get a selector.

source

pub unsafe fn allocator_mut( &mut self, selector: AllocatorSelector ) -> &mut dyn Allocator<VM>

Get the mutable allocator for the selector.

§Safety

The selector needs to be valid, and points to an allocator that has been initialized. crate::memory_manager::get_allocator_mapping can be used to get a selector.

source

pub unsafe fn allocator_impl<T: Allocator<VM>>( &self, selector: AllocatorSelector ) -> &T

Get the allocator of a concrete type for the selector.

§Safety

The selector needs to be valid, and points to an allocator that has been initialized. crate::memory_manager::get_allocator_mapping can be used to get a selector.

source

pub unsafe fn allocator_impl_mut<T: Allocator<VM>>( &mut self, selector: AllocatorSelector ) -> &mut T

Get the mutable allocator of a concrete type for the selector.

§Safety

The selector needs to be valid, and points to an allocator that has been initialized. crate::memory_manager::get_allocator_mapping can be used to get a selector.

source

pub fn get_allocator_base_offset(selector: AllocatorSelector) -> usize

Return the base offset from a mutator pointer to the allocator specified by the selector.

Trait Implementations§

source§

impl<VM: VMBinding> MutatorContext<VM> for Mutator<VM>

source§

unsafe fn barrier_impl<B: Barrier<VM>>(&mut self) -> &mut B

Used by specialized barrier slow-path calls to avoid dynamic dispatches.

source§

fn prepare(&mut self, tls: VMWorkerThread)

Do the prepare work for this mutator.
source§

fn release(&mut self, tls: VMWorkerThread)

Do the release work for this mutator.
source§

fn alloc( &mut self, size: usize, align: usize, offset: usize, allocator: AllocationSemantics ) -> Address

Allocate memory for an object. Read more
source§

fn alloc_slow( &mut self, size: usize, align: usize, offset: usize, allocator: AllocationSemantics ) -> Address

The slow path allocation. This is only useful when the binding implements the fast path allocation, and would like to explicitly call the slow path after the fast path allocation fails.
source§

fn post_alloc( &mut self, refer: ObjectReference, _bytes: usize, allocator: AllocationSemantics )

Perform post-allocation actions. For many allocators none are required. Read more
source§

fn get_tls(&self) -> VMMutatorThread

Get the mutator thread for this mutator context. This is the same value as the argument supplied in crate::memory_manager::bind_mutator when this mutator is created.
source§

fn barrier(&mut self) -> &mut dyn Barrier<VM>

Get active barrier trait object
source§

fn flush_remembered_sets(&mut self)

Flush per-mutator remembered sets and create GC work for the remembered sets.
source§

fn flush(&mut self)

Flush the mutator context.

Auto Trait Implementations§

§

impl<VM> Freeze for Mutator<VM>
where VM: Default + Sync + Send + 'static,

§

impl<VM> !RefUnwindSafe for Mutator<VM>

§

impl<VM> Send for Mutator<VM>
where VM: Default + Sync + Send + 'static,

§

impl<VM> !Sync for Mutator<VM>

§

impl<VM> Unpin for Mutator<VM>
where VM: Default + Sync + Send + 'static,

§

impl<VM> !UnwindSafe for Mutator<VM>

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> Downcast for T
where T: Any,

source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

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

§

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>,

§

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.