Mail Archives: pgcc/2000/01/29/23:11:55
On Sun, Jan 30, 2000 at 01:14:44AM +0100, Jan Hubicka wrote:
> Yes. We was discussing this recently with Richard and we probably will change this bit.
> The rationale behind is to place string into as few cache lines as possible.
> (when the string starts near end of cache line, it may go cross one extra).
> But this needs some tunning.
Is it possible for gcc to look for gaps to put short strings into? Often,
programs have some strings in the under-5-byte range, and they could be put
between two functions instead of whatever is usually used when it doesn't
have to be nops. (I'm assuming that normally the space opened up by moving
a function along the the next alignment boundary is wasted. I'm saying gcc
should see if there are any strings which will fit in that space.) Any
comments on whether this is even a good idea?
For the string optimization, it would be really good to be able to do
cross-file optimization, because then the short strings could all find
homes... OTOH, putting a string right after the ret from a function which
uses the string, (or passes its addr to another function, which can be
assumed to use it) makes a _lot_ of sense (to me...). Such strings should
maybe get priority over strings which are exactly the right length, but from
an unrelated file. Since the CPU has separate insn and data caches at the
L1 level, this only helps by getting the function into the L2 cache. That
is still a Good Thing, though. Doing this makes it possible to align
functions to 32 bytes without wasting too much memory.
Similarly, if you have two functions, each of which are about 1.5 cache
lines long, then does it make sense to put them back-to-back, so that their
combination uses 3 cache lines instead of 4? Maybe it would be worth doing
if one called the other.
--
#define X(x,y) x##y
DUPS Secretary ; http://is2.dal.ca/~dups/
Peter Cordes ; e-mail: X(peter AT cordes DOT phys. , dal.ca)
"The gods confound the man who first found out how to distinguish the hours!
Confound him, too, who in this place set up a sundial, to cut and hack
my day so wretchedly into small pieces!" -- Plautus, 200 BCE
- Raw text -