3 ms·
As another example, here's a simple GC I wrote quite a while ago in Forth: https://github.com/JohnEarnest/Mako/blob/master/lib/Algorithms/Garbage.fs https://git
by RodgerTheGreat 7y ago
As another example, here's a simple GC I wrote quite a while ago in Forth: https://github.com/JohnEarnest/Mako/blob/master/lib/Algorithms/Garbage.fs https://github.com/JohnEarnest/Mako/blob/master/lib/Algorith...
This one is a precise, copying GC, with a reserved arena for persistent references into garbage-collected objects (in addition to the stacks). Pointers are identified by reserving a high bit in words.
- eru 7y agoIn C that's hard to to do in general, because people do pointer arithmetic, and they sometimes abuse that pointers often come aligned (eg 3 byte aligned), so they re-use the extra two bits for various flags and mask them out before de-referencing. But compare https://news.ycombinator.com/item?id=19182779 https://news.ycombinator.com/item?id=19182779