Struct mmtk::MMTK

source ·
pub struct MMTK<VM: VMBinding> { /* private fields */ }
Expand description

An MMTk instance. MMTk allows multiple instances to run independently, and each instance gives users a separate heap. Note that multi-instances is not fully supported yet

Implementations§

source§

impl<VM: VMBinding> MMTK<VM>

source

pub fn harness_begin(&self, tls: VMMutatorThread)

Generic hook to allow benchmarks to be harnessed. MMTk will trigger a GC to clear any residual garbage and start collecting statistics for the benchmark. This is usually called by the benchmark harness as its last step before the actual benchmark.

source

pub fn harness_end(&'static self)

Generic hook to allow benchmarks to be harnessed. MMTk will stop collecting statistics, and print out the collected statistics in a defined format. This is usually called by the benchmark harness right after the actual benchmark.

source

pub fn gc_in_progress(&self) -> bool

Return true if a collection is in progress.

source

pub fn gc_in_progress_proper(&self) -> bool

Return true if a collection is in progress and past the preparatory stage.

source

pub fn is_emergency_collection(&self) -> bool

Return true if the current GC is an emergency GC.

An emergency GC happens when a normal GC cannot reclaim enough memory to satisfy allocation requests. Plans may do full-heap GC, defragmentation, etc. during emergency in order to free up more memory.

VM bindings can call this function during GC to check if the current GC is an emergency GC. If it is, the VM binding is recommended to retain fewer objects than normal GCs, to the extent allowed by the specification of the VM or langauge. For example, the VM binding may choose not to retain objects used for caching. Specifically, for Java virtual machines, that means not retaining referents of SoftReference which is primarily designed for implementing memory-sensitive caches.

source

pub fn is_user_triggered_collection(&self) -> bool

Return true if the current GC is trigger manually by the user/binding.

source

pub fn handle_user_collection_request( &self, tls: VMMutatorThread, force: bool, exhaustive: bool )

The application code has requested a collection. This is just a GC hint, and we may ignore it.

§Arguments
  • tls: The mutator thread that requests the GC
  • force: The request cannot be ignored (except for NoGC)
  • exhaustive: The requested GC should be exhaustive. This is also a hint.
source

pub fn trigger_internal_collection_request(&self)

MMTK has requested stop-the-world activity (e.g., stw within a concurrent gc).

source

pub fn get_plan(&self) -> &dyn Plan<VM = VM>

Get a reference to the plan.

source

pub unsafe fn get_plan_mut(&self) -> &mut dyn Plan<VM = VM>

Get the plan as mutable reference.

§Safety

This is unsafe because the caller must ensure that the plan is not used by other threads.

source

pub fn get_options(&self) -> &Options

Get the run time options.

Trait Implementations§

source§

impl<VM: VMBinding> Send for MMTK<VM>

source§

impl<VM: VMBinding> Sync for MMTK<VM>

Auto Trait Implementations§

§

impl<VM> !Freeze for MMTK<VM>

§

impl<VM> !RefUnwindSafe for MMTK<VM>

§

impl<VM> Unpin for MMTK<VM>
where VM: Default + Sync + Send + 'static, <<VM as VMBinding>::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType: Unpin,

§

impl<VM> !UnwindSafe for MMTK<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> DowncastSync for T
where T: Any + Send + Sync,

source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
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.