PolicyTraceObject

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

Source

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.

Source

fn may_move_objects<const KIND: u8>() -> bool

Return whether the policy moves objects.

Provided Methods§

Source

fn post_scan_object(&self, _object: ObjectReference)

Policy-specific post-scan-object hook. It is called after scanning each object in this space.

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.

Implementors§