On Fri, 10 Apr 2009 23:04:16 -0400, Leandro Lucarella <llu...@gmail.com>
wrote:
I hope I can come up with something useful with my thesis (improving D's
GC) and I can contribute that. Right now all my energies are focused on
that, and I'm very close to the point to finally start playing with
alternate implementations.
BTW, is there any real interest in adding some more power to the GC
implementator to allow some kind of moving or generational collector?
Yes.
Here are some good starting points on how to allow better GC support in
D:
http://d.puremagic.com/issues/show_bug.cgi?id=679
I think this should be less a spec issue and more a library issue and
core.memory seems to already have a BlkAttr.NO_MOVE, which covers memory
pinning.
http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=35426
Well, making the GC type aware/semi-precise (i.e. providing support for
moving/copying collectors) seems like the most important change, i.e.
static void* malloc(size_t sz, uint ba = 0);
to
static void* malloc(T)(uint ba = 0);
static void* malloc(T:T[])(uint ba = 0);
The change to support concurrent GCs, effects both performance and code
gen significantly. Also, if D's thread model supports thread-local heaps,
the need for a concurrent GC is vastly reduced (its only a benefit to the
shared heaps (mutable and immutable), while most objects would are on the
thread-local heaps).
On that note, support for per thread GCs in general is another major
change. i.e.:
GC.malloc!(T)();
to
Thread.getThis.gc.malloc!(T)(); // Alternatively use thread local storage.
Even without a locality guarantee, this allows for concurrent allocation
and (I think) better D DLL behaviour since you don't end up with two
separate heaps which don't know about each other.
Anyway, if you are interested in my progress, I have a blog[1] where
I write almost everything I do related to the subject. The blog it's in
Planet D, but Planet D seems to be broken =/
[1] http://proj.llucax.com.ar/blog/dgc/blog
P.S. Thanks for the blog. (I have been following it for a while now)