This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Go Garbage Collection Roots
- From: Ian Lance Taylor <iant at google dot com>
- To: Matt Davis <mattdavis9 at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 29 Sep 2011 23:04:07 -0700
- Subject: Re: Go Garbage Collection Roots
- References: <20110930025038.GA4039@excelsa.csse.unimelb.edu.au>
Matt Davis <mattdavis9@gmail.com> writes:
> As some of you might know, I have been researching and working on a region-based
> memory management plugin for GCC. My target is specifically the Go language.
> With that said, I have been making a fair amount of progress. More recently, I
> have been benchmarking my work, and it came to my attention that I need to
> handle types defined in an external object files. For instance, when a new List
> object is created, the external package for List, calls "new" and returns us a
> nice sparkly new List object. The runtime of Go implements "new" as "__go_new,"
> which calls the runtime's special allocator to produce an object that is garbage
> collected. This is causing some snags in my system. Mainly, I want to use my
> own allocator, since there is only a special case when I want to use garbage
> collection in my region system. Is there a way/interface to register data as a
> root in the garbage collector, so that its not in conflict with my allocation?
>
> The other option would be to try to override "__go_new" with my own
> implementation, but keeping the same symbol name so that the linker does the
> dirty work.
There isn't really any way to do it right now, but it would be
straightforward to add something to libgo/runtime/mgc0.c along the lines
of __go_register_gc_roots. The existing __go_register_gc_roots isn't
really suitable as it does not do any locking.
Ian