The collector now has an abstract interface onto the embedder. The
embedder has to supply some functionality, such as tracing and
forwarding. This is a pretty big change in terms of lines but it's
supposed to have no functional or performance change.
We're targetting systems that need to be able to inspect the kind of an
object, so this information has to be somewhere. If it's out-of-line,
we might save memory, but we would lose locality. Concretely in Guile
the tag bits are in the object itself.
Firstly, we add a priority evacuation reserve to prioritize having a few
evacuation blocks on hand. Otherwise if we give them all to big
allocations first and we have a fragmented heap, we won't be able to
evacuate that fragmented heap to give more blocks to the large
allocations.
Secondly, we remove `enum gc_reason`. The issue is that with multiple
mutator threads, the precise thread triggering GC does not provide much
information. Instead we should make choices on how to collect based on
the state of the heap.
Finally, we move detection of out-of-memory inside the collector,
instead of the allocator.
Together, these changes let mt-gcbench (with fragmentation) operate in
smaller heaps.
Marking conservative roots in place effectively prohibits them from
being moved, and we need to trace the roots anyway to discover
conservative roots. No need therefore for a pin bit.
If the mutator finds completely empty blocks, it puts them on the side.
The large object space acquires empty blocks, sweeping if needed, and
causes them to be unmapped, possibly causing GC.