From: Jan Hubicka <hubicka@ucw.cz>
To: Jakub Jelinek <jakub@redhat.com>
Cc: Richard Biener <richard.guenther@gmail.com>,
Jan Hubicka <hubicka@ucw.cz>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Jason Merrill <jason@redhat.com>
Subject: Re: [C++ patch] Reduce vtable alignment
Date: Mon, 19 May 2014 14:57:00 -0000 [thread overview]
Message-ID: <20140519145656.GC7114@kam.mff.cuni.cz> (raw)
In-Reply-To: <20140519091043.GH10386@tucnak.redhat.com>
> > Hmm, but if the optimizers or the target can rely on DATA_ABI_ALIGNMENT
> > then we can't really lower it. Because we can make the vtable escape
> > to another unit that sees it as just an array of pointers?
>
> Sure, they can rely on DATA_ABI_ALIGNMENT (if that macro is defined), but
> anything beyond that (such as what DATA_ALIGNMENT returns) is optimization
> only. So, Honza's patch looks good for me.
Yep, DATA_ALIGNMENT is computed when type is finalized, so I think this should
be safe.
>
> > So this looks unsafe to me. (same may apply to the idea of
> > having TARGET_VTABLE_ENTRY_ALIGN at all, if that possibly
> > conflicts with ABI alignment requirements present otherwise).
>
> Right now the intersection of targets overriding TARGET_VTABLE_ENTRY_ALIGN and
> targets defining DATA_ABI_ALIGNMENT is empty. In any case, even in that
> case one should (if DATA_ABI_ALIGNMENT is defined) apply DATA_ABI_ALIGNMENT
> (on top of TARGET_VTABLE_ENTRY_ALIGN and/or TYPE_ALIGN, dunno how those two
> exactly mix together) and not DATA_ALIGNMENT. But this patch is about
> tinfo, not vtable.
There are two patches, one is for RTTI and other is for vtables. Vtables are
fully compiler controlled structures, as such I think we do not need to align
them as usual arrays. C++ ABI does not really speak about alignment of these,
but I believe it is safe to stop aligning them, since all we do is random
accesses at given offset of the symbol - nothing where we can use the
alignment.
We can bump it down to DATA_ALIGNMENT boundary like I do for RTTI, but it
would still waste several percent of the data segment. (Clang indeed aligns
to 16 byte boundary here)
Honza
next prev parent reply other threads:[~2014-05-19 14:57 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-16 18:04 Jan Hubicka
2014-05-16 19:12 ` Jan Hubicka
2014-05-19 8:52 ` Richard Biener
2014-05-19 9:10 ` Jakub Jelinek
2014-05-19 14:57 ` Jan Hubicka [this message]
2014-05-23 17:30 ` Jan Hubicka
2014-05-23 21:52 ` Jason Merrill
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140519145656.GC7114@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=jason@redhat.com \
--cc=richard.guenther@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).