This commit is contained in:
Justin Ethier 2016-01-21 23:11:53 -05:00
parent e9f7b2cbc6
commit bdcf1a6560

View file

@ -188,18 +188,43 @@ The collector cycle is complete and it rests until it is triggered again.
Mutators call this function to add an object to their mark buffer. Mutators call this function to add an object to their mark buffer.
mark_gray(m, obj):
if obj != clear_color:
m->mark_buffer[m->last_write]
m->last_write++
### Collector Mark Gray ### Collector Mark Gray
The collector calls this function to add an object to the mark stack. The collector calls this function to add an object to the mark stack.
collector_mark_gray(obj):
if obj != clear_color:
mark_stack->push(obj)
### Mark Black ### Mark Black
The collector calls this function to mark an object black and mark all of the object's children gray using Collector Mark Gray. The collector calls this function to mark an object black and mark all of the object's children gray using Collector Mark Gray.
mark_black(obj):
if mark(obj) != mark_color:
for each child(c):
collector_mark_gray(c)
mark(obj) = mark_color
## Empty Collector Mark Stack
This function removes and marks each object on the collector's mark stack.
empty_collector_mark_stack():
while not mark_stack->empty()
mark_black(mark_stack->pop())
### Collector Trace ### Collector Trace
This function performs tracing for the collector by looping over all of the mutator mark buffers. All of the remaining objects in each buffer are marked black, as well as all the remaining objects on the collector's mark stack. This function continues looping until there are no more objects to mark: This function performs tracing for the collector by looping over all of the mutator mark buffers. All of the remaining objects in each buffer are marked black, as well as all the remaining objects on the collector's mark stack. This function continues looping until there are no more objects to mark:
collector_trace:
clean = 0 clean = 0
while not clean: while not clean:
clean = 1 clean = 1