(Semi) precise GC [was: Re: Std Phobos 2 and logging library?]

Leandro Lucarella llucax at gmail.com
Wed Apr 15 07:47:15 PDT 2009


Fawzi Mohamed, el 15 de abril a las 14:57 me escribiste:
> >Well, if it turns out to be a win, I'm sure we could put it into LDC.
> >DMD would be up to Walter.
> 
> and tango will also for sure welcome a new gc implementation.

Well, right now I'm working on a minimal, naive, fully documented GC
implementation, as an exercise mostly, but I think it can be great for
educational / "documentational" purposes. I plan to submit it to
Tango/druntime when it's done.

> Most of the issues, and how to modify to get the that were already discussed. 
> Personally I like a blocked approach (i.e. flag+size), more than a full bitmap, 
> in the future one can think of compiler clustering pointer types,... together to 
> reduce the number of blocks. Subclassing means that you will always have some 
> blocks, but it is still probably better than the bitmap, I don't like that at 
> the moment typeinfo takes up so much space (at least the size of the type).
> To get all the info offTi aside (which are correct only on LDC as far as I know) 
> tango.core.RuntimeTraits could be useful.
> 
> 
> add support for weak pointers (that at the moment are normally stored as
> non pointers), fvbommel had a place for them in its enum values
> 
> at the moment the values in the registers are dumped, but not read back,
> either you change that, or all those values should be pinned (just as
> all union/maibe pointer)
> 
> tango io uses void[] arrays to take advantage of the auto cast, but
> these are not pointers (and the gc knows this because at the moment the
> flag used for an array are the one used to allocate it the first time.
> 
> during the collection you need to stop the threads (at least in the
> moving gc algorithms, and in the current mark an sweep).  While the
> threads are stopped you have very stringent constraints, basically the
> same constraints as for a signal handler.
> You cannot call any non signal safe function, not even acquire posix locks.
> So try to do the least possible in that phase, and be very careful.

Thanks for all the suggestions, they are very useful.

-- 
Leandro Lucarella (luca) | Blog colectivo: http://www.mazziblog.com.ar/blog/
----------------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------------



More information about the Digitalmars-d mailing list