ggc_alloc_rtvec_sized allocates spaces more than necessary?
Richard Guenther
richard.guenther@gmail.com
Mon Aug 15 12:20:00 GMT 2011
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.
>
More information about the Gcc
mailing list