public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT
@ 2001-04-06  4:49 dewar
  2001-04-06  5:00 ` Alexandre Oliva
  0 siblings, 1 reply; 25+ messages in thread
From: dewar @ 2001-04-06  4:49 UTC (permalink / raw)
  To: dewar, egcs; +Cc: aoliva, gcc

Well I would say that ancient architectures like Z80 can afford to pay
0.5 bytes/extra per function if they have to :-)

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT
@ 2001-04-06  5:05 dewar
  2001-04-06  5:10 ` Jamie Lokier
  0 siblings, 1 reply; 25+ messages in thread
From: dewar @ 2001-04-06  5:05 UTC (permalink / raw)
  To: aoliva, dewar; +Cc: egcs, gcc

<<I think that's not the main problem.  The problem is that we have an
implicit assumption hidden deep inside the C++ front-end, and there's
no validation anywhere preventing a definition of FUNCTION_BOUNDARY
from breaking violating this assumption.
>>

Well that's a very fair comment, most certainly this assumption needs to
be documented at the top level, and an explicit check of FUNCTION_BOUNDARY
as well as large documentation surrounding it is most appropriate :-)

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT
@ 2001-04-06  3:34 dewar
  2001-04-06  4:41 ` Jamie Lokier
  2001-04-06  6:02 ` Joern Rennecke
  0 siblings, 2 replies; 25+ messages in thread
From: dewar @ 2001-04-06  3:34 UTC (permalink / raw)
  To: aoliva, gcc

are there really architectures where there is no penalty for having
odd-aligned function addresses? Hard to believe! Of course there are
architectures where there is no *hard requirement* for alignment, but
one would almost certainly expect a performance penalty. On the x86
for example, it is quite important to give decent alignment to jump
targets from an efficiency point of view.

^ permalink raw reply	[flat|nested] 25+ messages in thread
* C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT
@ 2001-04-06  3:14 Alexandre Oliva
  2001-04-06 10:53 ` Neil Booth
  2001-04-06 13:05 ` Jim Wilson
  0 siblings, 2 replies; 25+ messages in thread
From: Alexandre Oliva @ 2001-04-06  3:14 UTC (permalink / raw)
  To: gcc

The C++ ABI v3 uses the least significant bit of the pfn to tell
non-virtual from virtual functions.  The problem is that, on
architectures that don't impose any alignment requirements on
beginning of functions, the assumption that pfn&1 == 0 for pointers to
non-virtual member functions doesn't always hold.  This breaks C++ on
at least avr, elxsi, mn10200, mn10300 and pj.

I suppose we could just bump FUNCTION_BOUNDARY up, but I'd rather not
do it on targets in which code size is an important issue.  That's the
case of mn10300.

It would be great if we could enforce 2-byte alignment only on
non-virtual member functions whose addresses were taken to construct
pointers to member functions, but, since we can't tell in advance
whether the address of a non-virtual member function was taken, we'd
have to assume at least all non-virtual member functions have to be
aligned to 2 * BITS_PER_UNIT.

Another possibility I see is to arrange for the bit used to tell
non-virtual from virtual member functions in pointers to members be
moved to the delta field of the pointer to member, in case
FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT.  This would be a diversion from
the IA64 C++ ABI, but it makes more sense to me, for targets in which
function addresses are not guaranteed to be even addresses.

Opinions?

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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

end of thread, other threads:[~2001-05-16  7:18 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-06  4:49 C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT dewar
2001-04-06  5:00 ` Alexandre Oliva
  -- strict thread matches above, loose matches on Subject: below --
2001-04-06  5:05 dewar
2001-04-06  5:10 ` Jamie Lokier
2001-04-06  3:34 dewar
2001-04-06  4:41 ` Jamie Lokier
2001-04-06  6:02 ` Joern Rennecke
2001-04-06  3:14 Alexandre Oliva
2001-04-06 10:53 ` Neil Booth
2001-04-06 11:03   ` Alexandre Oliva
2001-04-07  4:52   ` Richard Earnshaw
2001-04-07 10:12     ` Dave Korn
2001-04-06 13:05 ` Jim Wilson
2001-04-06 14:45   ` DJ Delorie
2001-04-09  8:19   ` Alexandre Oliva
2001-04-09 12:28     ` Joern Rennecke
2001-04-09 13:12       ` Alexandre Oliva
2001-04-09 13:43         ` Joern Rennecke
2001-04-18  5:48         ` Richard Earnshaw
2001-04-18 12:11           ` Alexandre Oliva
2001-04-10  9:27     ` C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 *BITS_PER_UNIT Mark Mitchell
2001-04-17 10:38     ` C++ ptrmemfun break if FUNCTION_BOUNDARY < 2 * BITS_PER_UNIT Andrew Cagney
2001-04-17 13:02       ` Daniel Berlin
2001-05-16  4:53         ` Jason Merrill
2001-05-16  7:18           ` Daniel Berlin

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