some char * optimizations in kernel

Ph. Marek (marek@mail.bmlv.gv.at)
Thu, 22 Feb 2001 12:32:07 +0100


Hello everybody,

looking through the sources I found several pieces like
lib/vsprintf.c, line 111:
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";

As tested with egcs-2.91.60 even with -O3 there is a difference
between
const char *digits="0123456789abcdefghijklmnopqrstuvwxyz";
and
const char digits[]="0123456789abcdefghijklmnopqrstuvwxyz";

in the resulting assembler code.

Usage of this pointer results in it being loaded in a register, and then
pushed on the stack (for subrouting using); if it's an array, the address
is pushed directly.

Furthermore, in the "char *"-case the pointer is stored in memory.

As I'm not at home I can't give a complete reference of all these cases.
(But it's trivial [at least for me :-)] using perl).

So if this changes are approved and I have the time I can post a diff in
the next few days.

BTW: For which size of patch is it possible to get included in the "Hall of
fame" (has helped with linux kernel)?
And, btw too, where can I find a maintainer of a specific file? eg., one of
these cases is in init/version.c which has "Copyright (C) 1992 Theodore
Ts'o" - but I have to guess it's tytso@valinux.com.
Is there something like Documentation/maintainers?

Regards,

Phil

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/