pub fn forward_object<VM: VMBinding>(
object: ObjectReference,
semantics: CopySemantics,
copy_context: &mut GCWorkerCopyContext<VM>,
on_after_forwarding: impl FnOnce(ObjectReference),
) -> ObjectReferenceExpand description
Copy an object and set the forwarding state.
The caller can use on_after_forwarding to set extra metadata (including VO bits, mark bits,
etc.) after the object is copied, but before the forwarding state is changed to FORWARDED. The
atomic memory operation that sets the forwarding bits to FORWARDED has the SeqCst order. It
will guarantee that if another GC worker thread that attempts to forward the same object sees
the forwarding bits being FORWARDED, it is guaranteed to see those extra metadata set.
Arguments:
object: The object to copy.semantics: The copy semantics.copy_context: A reference ot theCopyContextinstance of the current GC worker.on_after_forwarding: A callback function that is called afterobjectis copied, but before the forwarding bits are set. Its argument is a reference to the new copy ofobject.