This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Compiler support for write barrier insertion ?
- From: Andrew Haley <aph-gcc at littlepinkcloud dot COM>
- To: Dmitry Antipov <dmantipov at yandex dot ru>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 23 Jul 2007 16:30:23 +0100
- Subject: Re: Compiler support for write barrier insertion ?
- References: <46A4C6B6.2000507@yandex.ru>
Dmitry Antipov writes:
>
> with write barrier inside ? The short answers are:
> 1) If 'struct obj' has 100 trapped members, having 100 set_XXX functions
> or macros just to set the fields is ugly;
> 2) Migration from explicit memory management to garbage collection - if you
> have 1M lines of code which uses 'XXX->next = ...', it's quite hard
> to rewrite all stuff even with the help of modern refactoring tools.
>
> I realize that the whole thing is very specific and probably will never used
> by the most of compiler users. But, anyway, is it technically possible to
> implement such thing ? How much overhead it may introduce ?
It wouldn't be very hard to do something like this in the gimplify
stage immediately after the langauge front-end has done its job: for
every write through a magic pointer, call the barrier.
But I'd have to question your motives for doing this. Standard C++
can already do this stuff with smart pointers and no compiler hacking
at all. It's a much better tool for the job.
Andrew.