pub fn is_mmtk_object(addr: Address) -> Option<ObjectReference>
Expand description

Check if addr is the raw address of an object reference to an MMTk object.

Concretely:

  1. Return Some(object) if ObjectReference::from_raw_address(addr) is a valid object reference to an object in any space in MMTk. object is the result of ObjectReference::from_raw_address(addr).
  2. Return None otherwise.

This function is useful for conservative root scanning. The VM can iterate through all words in a stack, filter out zeros, misaligned words, obviously out-of-range words (such as addresses greater than 0x0000_7fff_ffff_ffff on Linux on x86_64), and use this function to deside if the word is really a reference.

This function does not handle internal pointers. If a binding may have internal pointers on the stack, and requires identifying the base reference for an internal pointer, they should use find_object_from_internal_pointer instead.

Note: This function has special behaviors if the VM space (enabled by the vm_space feature) is present. See crate::plan::global::BasePlan::vm_space.

Argument:

  • addr: A non-zero word-aligned address. Because the raw address of an ObjectReference cannot be zero and must be word-aligned, the caller must filter out zero and misaligned addresses before calling this function. Otherwise the behavior is undefined.