This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: ggc_alloc_rtvec_sized allocates spaces more than necessary?
- From: Richard Guenther <richard dot guenther at gmail dot com>
- To: çä <netcasper at gmail dot com>
- Cc: gcc at gcc dot gnu dot org, Laurynas Biveinis <laurynas dot biveinis at gmail dot com>
- Date: Mon, 15 Aug 2011 14:20:21 +0200
- Subject: Re: ggc_alloc_rtvec_sized allocates spaces more than necessary?
- References: <CAO+NnCbQHLxWucv4hUrHUBNjg1u=9iJte_c_gy6-wniz-iHA3Q@mail.gmail.com>
On Mon, Aug 15, 2011 at 2:16 PM, çä <netcasper@gmail.com> wrote:
> Hi,
>
> Current implementation of ggc_alloc_rtvec_sized is
>
> #define ggc_alloc_rtvec_sized(NELT) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> Â Â(ggc_alloc_zone_vec_rtvec_def (sizeof (rtx), Â Â Â Â Â Â Â Â Â Â Â Â\
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â sizeof (struct rtvec_def) + ((NELT) - 1), \
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â &rtl_zone))
>
> The size it allocates is
>
> Â(sizeof (struct rtvec_def) + ((NELT) - 1)) * sizeof (rtx)
This looks indeed bogus.
> Â Â // (1)
>
> Originally, the allocated size is
>
> Âsizeof (struct rtvec_def) + ((NELT) - 1) * sizeof (rtx)
> Â Â// (2)
This one is correct.
Laurynas?
> So current implementation allocates more spaces than before.
>
> I replace the second parameter of ggc_alloc_zone_vec_rtvec_def with
>
> Â(sizeof (struct rtvec_def) + sizeof (rtx) - 1) / sizeof (rtx) +
> ((NELT) - 1) Â // (3)
>
> It bootstraps on x86 successfully. ÂSo I guess the extra spaces are
> not used. ÂDid I miss something?
>
> Thanks,
> Liang.
>