Trait mmtk::scheduler::gc_work::ProcessEdgesWork
source · pub trait ProcessEdgesWork: Send + 'static + Sized + DerefMut + Deref<Target = ProcessEdgesBase<Self::VM>> {
type VM: VMBinding;
type ScanObjectsWorkType: ScanObjectsWork<Self::VM>;
const CAPACITY: usize = 4_096usize;
const OVERWRITE_REFERENCE: bool = true;
const SCAN_OBJECTS_IMMEDIATELY: bool = true;
// Required methods
fn new(
edges: Vec<<<Self as ProcessEdgesWork>::VM as VMBinding>::VMEdge>,
roots: bool,
mmtk: &'static MMTK<Self::VM>,
bucket: WorkBucketStage
) -> Self;
fn trace_object(&mut self, object: ObjectReference) -> ObjectReference;
fn create_scan_work(
&self,
nodes: Vec<ObjectReference>,
roots: bool
) -> Self::ScanObjectsWorkType;
// Provided methods
fn cache_roots_for_sanity_gc(&mut self) { ... }
fn start_or_dispatch_scan_work(
&mut self,
work_packet: impl GCWork<Self::VM>
) { ... }
fn flush(&mut self) { ... }
fn process_edge(
&mut self,
slot: <<Self as ProcessEdgesWork>::VM as VMBinding>::VMEdge
) { ... }
fn process_edges(&mut self) { ... }
}
Expand description
Scan & update a list of object slots
Required Associated Types§
sourcetype ScanObjectsWorkType: ScanObjectsWork<Self::VM>
type ScanObjectsWorkType: ScanObjectsWork<Self::VM>
The work packet type for scanning objects when using this ProcessEdgesWork.
Provided Associated Constants§
sourceconst CAPACITY: usize = 4_096usize
const CAPACITY: usize = 4_096usize
The maximum number of edges that should be put to one of this work packets. The caller who creates a work packet of this trait should be responsible to comply with this capacity. Higher capacity means the packet will take longer to finish, and may lead to bad load balancing. On the other hand, lower capacity would lead to higher cost on scheduling many small work packets. It is important to find a proper capacity.
sourceconst OVERWRITE_REFERENCE: bool = true
const OVERWRITE_REFERENCE: bool = true
Do we update object reference? This has to be true for a moving GC.
sourceconst SCAN_OBJECTS_IMMEDIATELY: bool = true
const SCAN_OBJECTS_IMMEDIATELY: bool = true
If true, we do object scanning in this work packet with the same worker without scheduling overhead. If false, we will add object scanning work packets to the global queue and allow other workers to work on it.
Required Methods§
sourcefn new(
edges: Vec<<<Self as ProcessEdgesWork>::VM as VMBinding>::VMEdge>,
roots: bool,
mmtk: &'static MMTK<Self::VM>,
bucket: WorkBucketStage
) -> Self
fn new( edges: Vec<<<Self as ProcessEdgesWork>::VM as VMBinding>::VMEdge>, roots: bool, mmtk: &'static MMTK<Self::VM>, bucket: WorkBucketStage ) -> Self
Create a ProcessEdgesWork
.
Arguments:
edges
: a vector of the edges.roots
: are the objects root reachable objects?mmtk
: a reference to the MMTK instance.bucket
: which work bucket this packet belongs to. Further work generated from this packet will also be put to the same bucket.
sourcefn trace_object(&mut self, object: ObjectReference) -> ObjectReference
fn trace_object(&mut self, object: ObjectReference) -> ObjectReference
Trace an MMTk object. The implementation should forward this call to the policy-specific
trace_object()
methods, depending on which space this object is in.
If the object is not in any MMTk space, the implementation should forward the call to
ActivePlan::vm_trace_object()
to let the binding handle the tracing.
sourcefn create_scan_work(
&self,
nodes: Vec<ObjectReference>,
roots: bool
) -> Self::ScanObjectsWorkType
fn create_scan_work( &self, nodes: Vec<ObjectReference>, roots: bool ) -> Self::ScanObjectsWorkType
Create an object-scanning work packet to be used for this ProcessEdgesWork.
roots
indicates if we are creating a packet for root scanning. It is only true when this
method is called to handle RootsWorkFactory::create_process_pinning_roots_work
.
Provided Methods§
sourcefn cache_roots_for_sanity_gc(&mut self)
fn cache_roots_for_sanity_gc(&mut self)
If the work includes roots, we will store the roots somewhere so for sanity GC, we can do another transitive closure from the roots.
sourcefn start_or_dispatch_scan_work(&mut self, work_packet: impl GCWork<Self::VM>)
fn start_or_dispatch_scan_work(&mut self, work_packet: impl GCWork<Self::VM>)
Start the a scan work packet. If SCAN_OBJECTS_IMMEDIATELY, the work packet will be executed immediately, in this method. Otherwise, the work packet will be added the Closure work bucket and will be dispatched later by the scheduler.
sourcefn flush(&mut self)
fn flush(&mut self)
Flush the nodes in ProcessEdgesBase, and create a ScanObjects work packet for it. If the node set is empty, this method will simply return with no work packet created.
sourcefn process_edge(
&mut self,
slot: <<Self as ProcessEdgesWork>::VM as VMBinding>::VMEdge
)
fn process_edge( &mut self, slot: <<Self as ProcessEdgesWork>::VM as VMBinding>::VMEdge )
Process an edge, including loading the object reference from the memory slot, trace the object and store back the new object reference if necessary.
sourcefn process_edges(&mut self)
fn process_edges(&mut self)
Process all the edges in the work packet.