A heap may be marked and compacted while performing only two passes over
the objects and object references in the heap. Specifically, objects and
object references are traversed once during a marking phase and again
during a compaction phase of split-reference, two-pass mark-compaction.
Object references are updated in two steps. First, during marking, each
object reference may be updated to include the relative offset within its
block of the referenced object and-during compaction that offset may be
added to the block's destination address resulting in a reference that
points to the actual post-compaction location for the referenced object.
Objects of a particular block may be rearranged, or permuted, with
respect to each other within the block. However, the order between groups
of objects in different blocks may be preserved across compaction.