pub struct MMTK<VM: VMBinding> {Show 14 fields
pub(crate) options: Arc<Options>,
pub(crate) state: Arc<GlobalState>,
pub(crate) plan: UnsafeCell<Box<dyn Plan<VM = VM>>>,
pub(crate) reference_processors: ReferenceProcessors,
pub(crate) finalizable_processor: Mutex<FinalizableProcessor<<VM::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType>>,
pub(crate) scheduler: Arc<GCWorkScheduler<VM>>,
pub(crate) sanity_checker: Mutex<SanityChecker<VM::VMEdge>>,
pub(crate) edge_logger: EdgeLogger<VM::VMEdge>,
pub(crate) gc_trigger: Arc<GCTrigger<VM>>,
pub(crate) gc_requester: Arc<GCRequester<VM>>,
pub(crate) stats: Arc<Stats>,
inside_harness: AtomicBool,
inside_sanity: AtomicBool,
pub(crate) analysis_manager: Arc<AnalysisManager<VM>>,
}
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
Fields§
§options: Arc<Options>
§state: Arc<GlobalState>
§plan: UnsafeCell<Box<dyn Plan<VM = VM>>>
§reference_processors: ReferenceProcessors
§finalizable_processor: Mutex<FinalizableProcessor<<VM::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType>>
§scheduler: Arc<GCWorkScheduler<VM>>
§sanity_checker: Mutex<SanityChecker<VM::VMEdge>>
§edge_logger: EdgeLogger<VM::VMEdge>
§gc_trigger: Arc<GCTrigger<VM>>
§gc_requester: Arc<GCRequester<VM>>
§stats: Arc<Stats>
§inside_harness: AtomicBool
§inside_sanity: AtomicBool
§analysis_manager: Arc<AnalysisManager<VM>>
Analysis counters. The feature analysis allows us to periodically stop the world and collect some statistics.
Implementations§
source§impl<VM: VMBinding> MMTK<VM>
impl<VM: VMBinding> MMTK<VM>
sourcepub(crate) fn new(options: Arc<Options>) -> Self
pub(crate) fn new(options: Arc<Options>) -> Self
Create an MMTK instance. This is not public. Bindings should use MMTKBuilder::build
.
sourcepub fn harness_begin(&self, tls: VMMutatorThread)
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.
sourcepub fn harness_end(&'static self)
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.
pub(crate) fn sanity_begin(&self)
pub(crate) fn sanity_end(&self)
pub(crate) fn is_in_sanity(&self) -> bool
pub(crate) fn set_gc_status(&self, s: GcStatus)
sourcepub fn gc_in_progress(&self) -> bool
pub fn gc_in_progress(&self) -> bool
Return true if a collection is in progress.
sourcepub fn gc_in_progress_proper(&self) -> bool
pub fn gc_in_progress_proper(&self) -> bool
Return true if a collection is in progress and past the preparatory stage.
sourcepub fn is_emergency_collection(&self) -> bool
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.
sourcepub fn handle_user_collection_request(
&self,
tls: VMMutatorThread,
force: bool,
exhaustive: bool
)
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 GCforce
: The request cannot be ignored (except for NoGC)exhaustive
: The requested GC should be exhaustive. This is also a hint.
sourcepub fn trigger_internal_collection_request(&self)
pub fn trigger_internal_collection_request(&self)
MMTK has requested stop-the-world activity (e.g., stw within a concurrent gc).
sourcepub unsafe fn get_plan_mut(&self) -> &mut dyn Plan<VM = VM>
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.
sourcepub fn get_options(&self) -> &Options
pub fn get_options(&self) -> &Options
Get the run time options.
Trait Implementations§
Auto Trait Implementations§
impl<VM> !RefUnwindSafe for MMTK<VM>
impl<VM> Unpin for MMTK<VM>where <<VM as VMBinding>::VMReferenceGlue as ReferenceGlue<VM>>::FinalizableType: Unpin, <VM as VMBinding>::VMEdge: Unpin,
impl<VM> !UnwindSafe for MMTK<VM>
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, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
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.