pub fn find_object_from_internal_pointer(
    internal_ptr: Address,
    max_search_bytes: usize
) -> Option<ObjectReference>
Expand description

Find if there is an object with VO bit set for the given address range. This should be used instead of crate::memory_manager::is_mmtk_object for conservative stack scanning if the binding may have internal pointers on the stack.

Note that, we only consider pointers that point to addresses that are equal to or greater than the raw addresss of the object’s ObjectReference, and within the allocation as ‘internal pointers’. To be precise, for each object ref obj_ref, internal pointers are in the range [obj_ref.to_raw_address(), obj_ref.to_object_start() + ObjectModel::get_current_size(obj_ref)). If a binding defines internal pointers differently, calling this method is undefined behavior. If this is the case for you, please submit an issue or engage us on Zulip to discuss more.

Note that, in the similar situation as crate::memory_manager::is_mmtk_object, the binding should filter out obvious non-pointers (e.g. alignment check, bound check, etc) before calling this function to avoid unnecessary cost. This method is not cheap.

To minimize the cost, the user should also use a small max_search_bytes.

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:

  • internal_ptr: The address to start searching. We search backwards from this address (including this address) to find the base reference.
  • max_search_bytes: The maximum number of bytes we may search for an object with VO bit set. internal_ptr - max_search_bytes is not included.