public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* ggc_alloc_rtvec_sized allocates spaces more than necessary?
@ 2011-08-15 12:17 王亮
  2011-08-15 12:20 ` Richard Guenther
  2011-08-15 17:22 ` Andreas Schwab
  0 siblings, 2 replies; 7+ messages in thread
From: 王亮 @ 2011-08-15 12:17 UTC (permalink / raw)
  To: gcc

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)

It bootstraps on x86 successfully.  So I guess the extra spaces are
not used.  Did I miss something?

Thanks,
Liang.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-08-16  9:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-15 12:17 ggc_alloc_rtvec_sized allocates spaces more than necessary? 王亮
2011-08-15 12:20 ` Richard Guenther
2011-08-16  5:52   ` Laurynas Biveinis
2011-08-16  9:37     ` Liang Wang
2011-08-15 17:22 ` Andreas Schwab
2011-08-16  5:52   ` Laurynas Biveinis
2011-08-16  7:24     ` Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).