News for hackers. Stuff that matters.
Re:The D Garbage Collector by pcwalton on Monday March 20, 2017 @02:26PM (#13916440)
> A fast copying collector would require write barriers: using atomics everytime a pointer is written.

No, for two reasons:

1. Write barriers are not necessary if an object is in a nursery, which is true for most objects per the generational hypothesis. This is trivial to check based on the pointer value.

2. You can have thread local remembered sets.

Re:The D Garbage Collector by p0nce on Monday March 20, 2017 @02:33PM (#13916505)
I read this in http://www.infognition.com/blog/2014/the_real_problem_with_g... better ask the author of the article if you have a way for a better D GC.

> To make fast GC it needs to be generational, but generational GC means write barriers: you can't just freely mutate memory, every pointer mutation must be accompanied by additional bookkeeping.

I guess that in the context of D generations are not possible or practical. If you have any idea why it should be possible, you may write a DIP.

Re:The D Garbage Collector by WalterBright on Monday March 20, 2017 @09:41PM (#13919129)
It's possible to do generational collection in D. I've written one before and was careful to design the semantics of D to allow for it. It just needs someone to spend the time to implement it (the core language doesn't need to change).

I'm skeptical, however, if it will offer a real improvement.

Re:The D Garbage Collector by valarauca1 on Monday March 20, 2017 @03:39PM (#13917027)
>Write barriers are not necessary if an object is in a nursery, which is true for most objects per the generational hypothesis. This is trivial to check based on the pointer value.

Yes but what when it leaves it?

You have to update all pointers to another location.

When it passes to the Gen2 slab all references that point to it need to be updated, and those changes need to propagate to all threads, and all cores. The simplest way to do this is a memory barrier.

Well the real simplest way is just "never multi-thread" and this is OCaml's GC is so fast. No write barriers, 1 thread only, final destination.

Re:The D Garbage Collector by rurban on Monday March 20, 2017 @02:54PM (#13916679)
And 3rd: use forwarding pointers. Every good implementation uses #3.