pub fn object_reference_write_pre<VM: VMBinding>(
mutator: &mut Mutator<VM>,
src: ObjectReference,
slot: VM::VMSlot,
target: Option<ObjectReference>,
)Expand description
The write barrier by MMTk. This is a pre write barrier, which we expect a binding to call before it modifies an object. For performance reasons, a VM should implement the write barrier fast-path on their side rather than just calling this function.
For a correct barrier implementation, a VM binding needs to choose one of the following options:
- Use subsuming barrier
object_reference_write - Use both
object_reference_write_preandobject_reference_write_post, or both, if the binding has difficulty delegating the store to mmtk-core with the subsuming barrier. - Implement fast-path on the VM side, and call the generic api
object_reference_write_slowas barrier slow-path call. - Implement fast-path on the VM side, and do a specialized slow-path call.
Arguments:
mutator: The mutator for the current thread.src: The modified source object.slot: The location of the field to be modified.target: The target for the write operation.Noneif the slot did not hold an object reference before the write operation. For example, the slot may be holding anullreference, a small integer, or special values such astrue,false,undefined, etc.