Trait mmtk::Plan [−][src]
pub trait Plan: 'static + Sync + Downcast {
type VM: VMBinding;
Show 30 methods
fn constraints(&self) -> &'static PlanConstraints;
fn create_worker_local(
&self,
tls: VMWorkerThread,
mmtk: &'static MMTK<Self::VM>
) -> GCWorkerLocalPtr;
fn base(&self) -> &BasePlan<Self::VM>;
fn schedule_collection(
&'static self,
_scheduler: &GCWorkScheduler<Self::VM>
);
fn gc_init(
&mut self,
heap_size: usize,
vm_map: &'static Map64,
scheduler: &Arc<GCWorkScheduler<Self::VM>>
);
fn get_allocator_mapping(
&self
) -> &'static EnumMap<AllocationSemantics, AllocatorSelector>;
fn prepare(&mut self, tls: VMWorkerThread);
fn release(&mut self, tls: VMWorkerThread);
fn collection_required(
&self,
space_full: bool,
_space: &dyn Space<Self::VM>
) -> bool;
fn get_pages_used(&self) -> usize;
fn common(&self) -> &CommonPlan<Self::VM> { ... }
fn generational(&self) -> &Gen<Self::VM> { ... }
fn mmapper(&self) -> &'static FragmentedMapper { ... }
fn options(&self) -> &Options { ... }
fn is_current_gc_nursery(&self) -> bool { ... }
fn is_initialized(&self) -> bool { ... }
fn should_trigger_gc_when_heap_is_full(&self) -> bool { ... }
fn poll(&self, space_full: bool, space: &dyn Space<Self::VM>) -> bool { ... }
fn log_poll(&self, space: &dyn Space<Self::VM>, message: &'static str) { ... }
fn get_pages_reserved(&self) -> usize { ... }
fn get_total_pages(&self) -> usize { ... }
fn get_pages_avail(&self) -> usize { ... }
fn get_collection_reserve(&self) -> usize { ... }
fn is_emergency_collection(&self) -> bool { ... }
fn get_free_pages(&self) -> usize { ... }
fn handle_user_collection_request(&self, tls: VMMutatorThread, force: bool) { ... }
fn last_collection_was_exhaustive(&self) -> bool { ... }
fn last_collection_full_heap(&self) -> bool { ... }
fn force_full_heap_collection(&self) { ... }
fn modify_check(&self, object: ObjectReference) { ... }
}
Expand description
A plan describes the global core functionality for all memory management schemes. All global MMTk plans should implement this trait.
The global instance defines and manages static resources (such as memory and virtual memory resources).
Constructor:
For the constructor of a new plan, there are a few things the constructor must do (please check existing plans and see what they do in the constructor):
- Create a HeapMeta, and use this HeapMeta to initialize all the spaces.
- Create a vector of all the side metadata specs with
SideMetadataContext::new_global_specs()
, the parameter is a vector of global side metadata specs that are specific to the plan. - Initialize all the spaces the plan uses with the heap meta, and the global metadata specs vector.
- Create a
SideMetadataSanity
object, and invoke verify_side_metadata_sanity() for each space (or invoke verify_side_metadata_sanity() inCommonPlan
/BasePlan
for the spaces in the common/base plan).
Methods in this trait:
Only methods that will be overridden by each specific plan should be included in this trait. The trait may provide a default implementation, and each plan can override the implementation. For methods that won’t be overridden, we should implement those methods in BasePlan (or CommonPlan) and call them from there instead. We should avoid having methods with the same name in both Plan and BasePlan, as this may confuse people, and they may call a wrong method by mistake.
Associated Types
Required methods
fn constraints(&self) -> &'static PlanConstraints
fn create_worker_local(
&self,
tls: VMWorkerThread,
mmtk: &'static MMTK<Self::VM>
) -> GCWorkerLocalPtr
fn schedule_collection(&'static self, _scheduler: &GCWorkScheduler<Self::VM>)
fn gc_init(
&mut self,
heap_size: usize,
vm_map: &'static Map64,
scheduler: &Arc<GCWorkScheduler<Self::VM>>
)
fn get_allocator_mapping(
&self
) -> &'static EnumMap<AllocationSemantics, AllocatorSelector>
fn prepare(&mut self, tls: VMWorkerThread)
fn release(&mut self, tls: VMWorkerThread)
fn collection_required(
&self,
space_full: bool,
_space: &dyn Space<Self::VM>
) -> bool
fn collection_required(
&self,
space_full: bool,
_space: &dyn Space<Self::VM>
) -> bool
This method controls the triggering of a GC. It is called periodically
during allocation. Returns true
to trigger a collection.
@param spaceFull Space request failed, must recover pages within ‘space’.
@param space TODO
@return true
if a collection is requested by the plan.
fn get_pages_used(&self) -> usize
Provided methods
fn generational(&self) -> &Gen<Self::VM>
fn is_current_gc_nursery(&self) -> bool
fn is_current_gc_nursery(&self) -> bool
Is current GC only collecting objects allocated since last GC?
fn is_initialized(&self) -> bool
fn should_trigger_gc_when_heap_is_full(&self) -> bool
fn get_pages_reserved(&self) -> usize
fn get_total_pages(&self) -> usize
fn get_pages_avail(&self) -> usize
fn get_collection_reserve(&self) -> usize
fn is_emergency_collection(&self) -> bool
fn get_free_pages(&self) -> usize
fn handle_user_collection_request(&self, tls: VMMutatorThread, force: bool)
fn handle_user_collection_request(&self, tls: VMMutatorThread, force: bool)
The application code has requested a collection.
fn last_collection_was_exhaustive(&self) -> bool
fn last_collection_was_exhaustive(&self) -> bool
Return whether last GC was an exhaustive attempt to collect the heap. For many collectors this is the same as asking whether the last GC was a full heap collection.
fn last_collection_full_heap(&self) -> bool
fn last_collection_full_heap(&self) -> bool
Return whether last GC is a full GC.
fn force_full_heap_collection(&self)
fn force_full_heap_collection(&self)
Force the next collection to be full heap.
fn modify_check(&self, object: ObjectReference)
Implementations
Returns true if the trait object wraps an object of type __T
.
Returns a boxed object from a boxed trait object if the underlying object is of type
__T
. Returns the original boxed trait if it isn’t.
Returns an Rc
-ed object from an Rc
-ed trait object if the underlying object is of
type __T
. Returns the original Rc
-ed trait if it isn’t.
Returns a reference to the object within the trait object if it is of type __T
, or
None
if it isn’t.
Returns a mutable reference to the object within the trait object if it is of type
__T
, or None
if it isn’t.