Trait mmtk::policy::gc_work::PolicyTraceObject
source · pub trait PolicyTraceObject<VM: VMBinding> {
// Required methods
fn trace_object<Q: ObjectQueue, const KIND: u8>(
&self,
queue: &mut Q,
object: ObjectReference,
copy: Option<CopySemantics>,
worker: &mut GCWorker<VM>
) -> ObjectReference;
fn may_move_objects<const KIND: u8>() -> bool;
// Provided method
fn post_scan_object(&self, _object: ObjectReference) { ... }
}
Expand description
This trait defines policy-specific behavior for tracing objects.
The procedural macro #[derive(PlanTraceObject)] will generate code
that uses this trait. We expect any policy to 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,
copy: Option<CopySemantics>,
worker: &mut GCWorker<VM>
) -> ObjectReference
fn trace_object<Q: ObjectQueue, const KIND: u8>( &self, queue: &mut Q, object: ObjectReference, copy: Option<CopySemantics>, worker: &mut GCWorker<VM> ) -> ObjectReference
Trace object in the policy. If the policy copies objects, we should
expect copy
to be a Some
value.
sourcefn may_move_objects<const KIND: u8>() -> bool
fn may_move_objects<const KIND: u8>() -> bool
Return whether the policy moves objects.
Provided Methods§
sourcefn post_scan_object(&self, _object: ObjectReference)
fn post_scan_object(&self, _object: ObjectReference)
Policy-specific post-scan-object hook. It is called after scanning each object in this space.
Object Safety§
This trait is not object safe.