Matt Davis <mattdav...@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

Reply via email to