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_pre and object_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_slow as 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. None if the slot did not hold an object reference before the write operation. For example, the slot may be holding a null reference, a small integer, or special values such as true, false, undefined, etc.