mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-15 08:47:35 +02:00
WIP
This commit is contained in:
parent
e9f7b2cbc6
commit
bdcf1a6560
1 changed files with 34 additions and 9 deletions
|
@ -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.
|
||||
|
||||
mark_gray(m, obj):
|
||||
if obj != clear_color:
|
||||
m->mark_buffer[m->last_write]
|
||||
m->last_write++
|
||||
|
||||
### Collector Mark Gray
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
while not clean:
|
||||
clean = 1
|
||||
|
|
Loading…
Add table
Reference in a new issue