devicescript
devicescript copied to clipboard
compacting GC
Some notes on how to implement compacting/moving GC:
- [ ] in addition to marking things as
PENDINGin too deep GC mark, also have a tmp list (16 elements or so) - [ ]
devs_value_pin(value_t)->devs_add_root(value_t*)ordevs_add_root(void**) - [ ] we'll need separate
malloc()area, for pointers that can't move
GC Process:
- mark live pointers as today
- compute final size
Sof the heap (sum of sizes of live objects) - rewrite first word of each live object forwarding pointer, while moving the existing header from first word to linked list past
S - rewrite internal pointers and roots using forwarding pointers
- compact the heap, while fixing the first word from forwarding pointer back into header