Garbage Collector

Rainer Schuetze r.sagitario at gmx.de
Sat Dec 1 09:48:20 PST 2012



On 01.12.2012 14:32, Andrei Alexandrescu wrote:
> On 12/1/12 2:35 AM, Ali Çehreli wrote:
>> Quote: "I'd just throw in that we have a (almost) precise GC that is
>> used by at least one large project (the VisualD apparently). Though
>> there were some problems with it. Anyway I'd expect to see it in
>> upstream by 2.062 at least.".
>>
>> Ali
>
> Unfortunately Antti-Ville, the student who worked on the GSoC project,
> is not to be found. I pinged him to no avail. Hopefully nothing bad
> happened to him.
>
> It would be great if someone else in the community took over his github
> work.
>
>
> Andrei

https://github.com/rainers/druntime/tree/precise_gc2 started as a bug 
fix fork of the GSoC project, but not a lot was kept from it in the end 
but the main concept. I'm a little disappointed that it didn't catch 
more interest so far.

Precise garbage collection of the heap only does not help Visual D a 
lot, the data segment needs to be scanned precisely as well, because it 
contains a lot of text, tables (e.g. std.uni), COM GUIDs, etc. that make 
good false pointers. Even worse than for the heap, you don't have a 
NO_SCAN flag available to skip arrays that contain no pointers at all.

So I patched the compiler to generate type info for the data segment as 
well emitting (adress,typeinfo) pairs into a separate segment. There is 
no pull request yet, because it is Windows specific so far (shouldn't be 
too hard to transfer to other platforms) and it is very specific to the 
implementation (in contrast to the concept of RTInfo).

To avoid the latter I tried to generate it as the output of an 
RDInfo(alias var) template to be defined together with RTInfo, but that 
doesn't work, because

- data inside templates generated into libraries end up as comdats that 
never get linked in
- references to TLS variables cannot be generated at compile time
- placing the data into a special section to sort it together by the 
linker is not possible

Any ideas how this could be implemented?


More information about the Digitalmars-d mailing list