This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ggc_alloc_rtvec_sized allocates spaces more than necessary?


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.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]