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>
    ) -> 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§

source

type VM: VMBinding

The associate type for the VM.

source

type ScanObjectsWorkType: ScanObjectsWork<Self::VM>

The work packet type for scanning objects when using this ProcessEdgesWork.

Provided Associated Constants§

source

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.

source

const OVERWRITE_REFERENCE: bool = true

Do we update object reference? This has to be true for a moving GC.

source

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§

source

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.
source

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.

source

fn create_scan_work( &self, nodes: Vec<ObjectReference> ) -> 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§

source

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.

source

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.

source

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.

source

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.

source

fn process_edges(&mut self)

Process all the edges in the work packet.

Object Safety§

This trait is not object safe.

Implementors§