pub trait PlanTraceObject<VM: VMBinding> {
// Required methods
fn trace_object<Q: ObjectQueue, const KIND: u8>(
&self,
queue: &mut Q,
object: ObjectReference,
worker: &mut GCWorker<VM>,
) -> ObjectReference;
fn post_scan_object(&self, object: ObjectReference);
fn may_move_objects<const KIND: u8>() -> bool;
}Expand description
A plan that uses PlanProcessEdges needs to provide an implementation for this trait.
Generally a plan does not need to manually implement this trait. Instead, we provide
a procedural macro that helps generate an implementation. Please check macros/trace_object.
A plan could also manually implement this trait. For the sake of performance, the implementation
of this trait should mark methods as [inline(always)].
Required Methods§
Sourcefn trace_object<Q: ObjectQueue, const KIND: u8>(
&self,
queue: &mut Q,
object: ObjectReference,
worker: &mut GCWorker<VM>,
) -> ObjectReference
fn trace_object<Q: ObjectQueue, const KIND: u8>( &self, queue: &mut Q, object: ObjectReference, worker: &mut GCWorker<VM>, ) -> ObjectReference
Trace objects in the plan. Generally one needs to figure out which space an object resides in, and invokes the corresponding policy trace object method.
Arguments:
trace: the current transitive closureobject: the object to trace.worker: the GC worker that is tracing this object.
Sourcefn post_scan_object(&self, object: ObjectReference)
fn post_scan_object(&self, object: ObjectReference)
Post-scan objects in the plan. Each object is scanned by VM::VMScanning::scan_object(), and this function
will be called after the VM::VMScanning::scan_object() as a hook to invoke possible policy post scan method.
If a plan does not have any policy that needs post scan, this method can be implemented as empty.
If a plan has a policy that has some policy specific behaviors for scanning (e.g. mark lines in Immix),
this method should also invoke those policy specific methods for objects in that space.
Sourcefn may_move_objects<const KIND: u8>() -> bool
fn may_move_objects<const KIND: u8>() -> bool
Whether objects in this plan may move. If any of the spaces used by the plan may move objects, this should return true.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.