This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Allocate all target globals using GC for SWITCHABLE_TARGETs
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Richard Henderson <rth at redhat dot com>
- Cc: Jakub Jelinek <jakub at redhat dot com>, Richard Sandiford <rdsandiford at googlemail dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Sun, 12 Jan 2014 14:23:21 +0100
- Subject: Re: [PATCH] Allocate all target globals using GC for SWITCHABLE_TARGETs
- Authentication-results: sourceware.org; auth=none
- References: <DUB122-W8CEA24B3CD3CF0DE08FBAE4F70 at phx dot gbl> <87iotxv211 dot fsf at talisman dot default> <20140107193939 dot GY892 at tucnak dot redhat dot com> <CAFiYyc1CWvKmhf12XRep3AwKGaVxC4QerHsco8kJVkZD7xxa5g at mail dot gmail dot com> <20140108124540 dot GG892 at tucnak dot redhat dot com> <20140108183415 dot GK892 at tucnak dot redhat dot com> <52CECD7B dot 8040707 at redhat dot com> <20140109163539 dot GI892 at tucnak dot redhat dot com> <52CED15B dot 5020401 at redhat dot com> <20140109233458 dot GN892 at tucnak dot redhat dot com> <52D02FEF dot 9060001 at redhat dot com>
On Fri, Jan 10, 2014 at 6:37 PM, Richard Henderson <rth@redhat.com> wrote:
> On 01/09/2014 03:34 PM, Jakub Jelinek wrote:
>> 2014-01-09 Jakub Jelinek <jakub@redhat.com>
>>
>> * target-globals.c (save_target_globals): Allocate < 4KB structs using
>> GC in payload of target_globals struct instead of allocating them on
>> the heap and the larger structs separately using GC.
>> * target-globals.h (struct target_globals): Make regs, hard_regs,
>> reload, expmed, ira, ira_int and lra_fields GTY((atomic)) instead
>> of GTY((skip)) and change type to void *.
>> (reset_target_globals): Cast loads from those fields to corresponding
>> types.
>>
>> --- gcc/target-globals.h.jj 2014-01-09 19:24:20.000000000 +0100
>> +++ gcc/target-globals.h 2014-01-09 19:39:43.879348712 +0100
>> @@ -41,17 +41,17 @@ extern struct target_lower_subreg *this_
>>
>> struct GTY(()) target_globals {
>> struct target_flag_state *GTY((skip)) flag_state;
>> - struct target_regs *GTY((skip)) regs;
>> + void *GTY((atomic)) regs;
>
> I'm not entirely fond of this either, for the obvious reason. Clearly a
> deficiency in gengtype, but after 2 hours of poking around I can see that
> it isn't a quick fix.
>
> I guess I'm ok with the patch, since the use of the target_globals structure
> is so restricted.
Yeah. At some time we need a way to specify a finalization hook called
if an object is collected and eventually a hook that walks extra roots
indirectly
reachable via an object (so you can have GC -> heap -> GC memory layouts
more easily).
Richard.
>
> r~
>