by gmcabrita on 10/11/12, 11:38 PM with 28 comments
by RodgerTheGreat on 10/12/12, 1:22 AM
As an experiment, I tried writing a garbage collector which used high-order bits of a word to identify pointers. The result is about a page of code in Forth:
http://hastebin.com/raw/gabunowelo.fs
This example works exclusively with fixed-size "cons pair" allocations, but generalizing to arbitrary-sized allocations only increases the complexity of the system slightly. Obviously this bitflag technique is not "safe" in general, as arbitrary values on the stacks could produce false positives, but it's easy to imagine a 33-bit or 65-bit architecture that provided the necessary hardware support without such caveats.
by microtherion on 10/12/12, 12:52 AM
I noticed that Jones has a new book (The Garbage Collection Handbook) out now, which presumably is even better: http://tinyurl.com/8nl6con
by pcwalton on 10/12/12, 12:57 AM
Rust is using this model today.
by batgaijin on 10/12/12, 1:46 AM
by mseepgood on 10/12/12, 6:17 AM
struct {
double a; // 64 bit
short b // 16 bit
int c, d; // 32+32 bit
FooPtr e; // 64 bit
int f; // 32 bit
BarPtr g; // 64 bit
}
Does it assume that all fields are aligned to 64 bit boundaries? Does it potentially consider a double to be a pointer? And how does it know where to stop looking for references without knowing the size of the object?
by weirdkid on 10/12/12, 1:44 AM
by keikun17 on 10/12/12, 1:25 AM