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]

[RFC] space saving optimizations.


Hello,

A mempcpy it optimization to use stub to set return value and jump into 
memcpy has wider applicability. What I write also applies to other
architectures, if they already do that comments are welcome.

I would like to make convention about this interface.

On x64 implementation is that first instruction sets return value by
moving into rax and do not modifying afterwards. I need some mean to 
jump after that instruction.

There is problem how treat ifuncs. There are three possibilities,
First is parametrize function by target ifunc choosed.
Second is use indirect jump with similar selector as ifunc.
Third is jump to fixed implementation.

This can be used in
mempcpy:         jump to memcpy
strcat,strncat:  jump into strcpy.
strncpy,stpncpy: jump into memset to zero rest of bytes. 
memmove:         When strings do not overlap we could jump to memcpy
                 as done in string/memmove.c

I could decrease space usage bit more by function
memcpy_small(dest,src,no,ret)
that handles at most 16 bytes. It would be shared by strcpy/memcpy.

Comments?


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