Phase I | Pin all "children" of C-Objects within the heap. This assures that the objects will not be mistakenly moved. |
Phase II | Scan the stack, registers, and static area, pinning and marking all objects pointed to from these. The marked objects get added to a queue(the ExplicitQueue) to be scanned. All the pages where the marked objects occur are going to be kept so we pin all other objects on that page to avoid copying them unecessarily. The page is also "pinned" by setting the pinned bit in its PageInfo structure. |
Phase III | Arbitrarily select elements from the ExplicitQueue or Cheney's queue(ImplicitQueue) until no elements remain, performing the following operations on each element(object). For each object process each of its children. If the child is pinned but not marked, mark it and add it to the explicitQueue. Also pin the page it is on and all other objects on the page. If the child is not marked, and not forwarded, forward it and add it to the ImplicitQueue. If the child is already forwarded update the pointer to the child's new location. If the child is a C-Object that has not been marked or forwarded add it to the new list of C-Objects to use after this collection. |
Phase IV | Move all pinned pages into toSpace by resetting their bits appropriately, and moving them into the toSpace list. Unpin all the pinned and traversed objects(i.e. all the pinned objects that survived the collection). Then flip toSpace to fromSpace. |
add %g7,12,%o1 Add the size to allocPtr
and %o1,-2048,%o0 And with PAGE_MASK
cmp %o0,%g7 Do the comparison
bleu .LL3 Branch if less than or equal
mov 2113,%o0* Load the header word.
call gcAllocSpace,0
Uncommon nop
Case add %g7,12,%o1
mov 2113,%o0
.LL3:
st %o0,[%g7] Store the header word.
mov %o1,%g7 Update allocPtr
* This instruction is in the delay slot and gets executed whether the
branch is taken or not.
Abbreviation | Full Name | Description |
---|---|---|
CO | C-Object Queue | This is a queue of all conservative objects alive after the last collection, and allocated since. |
EQ | Explicit Queue | This is the queue used for processing marked objects that are not copied. |
IQ | Implicit Queue | This is the Cheney queue used to enqueue all the objects that are being copied. Implicit refers to the fact that this queue does not need any additional system pages. |
TO | Traversed Object Queue | This is a queue of all the objects that have been traversed(marked). In the actual implementation we use EQ for this purpose as well but it simplifies the exposition if we maintain this as a separate data structure. |
N/A | From-Space | The linked list of pages that are in use at the start of collection. |
N/A | To-Space | The linked list of pages that are alive at the end of the collection. This is in fact the same list of pages associated with the implicit queue. |