This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

replacing nested functions "findidx" with non-nested.


Hello,

The glibc code has two header files, locale/weight.h and locale/weightwc.h,
that define a body of a local function "findidx" and that are later
included here:
posix/fnmatch_loop.c
posix/regcomp.c
posix/regex_internal.h
posix/regexec.c
string/strcoll_l.c
string/strxfrm_l.c

Both functions are declared as "auto inline int32_t __attribute
((always_inline))"
so they are force-inlined by the compiler into ~18 call sites.

I would like to un-nest these functions
(https://sourceware.org/ml/libc-alpha/2014-05/msg00400.html)
and will need your advice on how to do that.

One option is to leave the functions defined in their header files and
change them
to "static inline int32_t __attribute ((always_inline))".
This will have minimal impact on the generated code and the patch will me small.

Another option is to move the function bodies into a .c file (e.g.
locale/coll-lookup.c).
This way findidx will not get inlined but we will save on code size.
On x86_64 linux the file size saving for libc.a is about 75Kb (0.3%).

Which would be more preferable?
I've attached two draft patches (not ready for detailed review, but
they should give the feeling)

Thanks in advance,

--kcc

Attachment: findidx-large.txt
Description: Text document

Attachment: findidx-small.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]