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?


çä <netcasper@gmail.com> writes:

> 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)
>      // (1)
>
> Originally, the allocated size is
>
>   sizeof (struct rtvec_def) + ((NELT) - 1) * sizeof (rtx)
>     // (2)
>
> 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)

I think it was meant to be this:

#define ggc_alloc_rtvec_sized(NELT)                                     \
  ggc_alloc_zone_rtvec_def (sizeof (struct rtvec_def)			\
			    + ((NELT) - 1) * sizeof (rtx),		\
			    &rtl_zone)

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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