Function mmtk::memory_manager::object_reference_write
source · pub fn object_reference_write<VM: VMBinding>(
mutator: &mut Mutator<VM>,
src: ObjectReference,
slot: VM::VMSlot,
target: ObjectReference
)
👎Deprecated: Use
object_reference_write_pre
and object_reference_write_post
instead, until this function is redesignedExpand description
The subsuming write barrier by MMTk. 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
andobject_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.
§Deprecated
This function needs to be redesigned. Its current form has multiple issues.
- It is only able to write non-null object references into the slot. But dynamic language
VMs may write non-reference values, such as tagged small integers, special values such as
null
,undefined
,true
,false
, etc. into a field that previous contains an object reference. - It relies on
slot.store
to writetarget
into the slot, butslot.store
is designed for forwarding references when an object is moved by GC, and is supposed to preserve tagged type information, the offset (if it is an interior pointer), etc. A write barrier is associated to an assignment operation, which usually updates such information instead.
We will redesign a more general subsuming write barrier to address those problems and replace
the current object_reference_write
. Before that happens, VM bindings should use
object_reference_write_pre
and object_reference_write_post
instead.