Subject: Re: CVS commit: src/lib/libc/arch/i386/string
To: None <jtc@acorntoolworks.com>
From: Perry E. Metzger <perry@piermont.com>
List: tech-kern
Date: 02/04/2005 10:44:24
jtc@acorntoolworks.com (J.T. Conklin) writes:
>> Note that for many calls, mem* is now being inlined by gcc using its
>> built in code (unless you do -fno-builtin etc.)
>>
>> Or, at least I *think* it is...
>
> I haven't looked at gcc's builtin mem* and str* implementations in a
> long time, but it used to inline calls only when it knew enough from
> the arguments (pointer alignments, constant lengths, constant 0 fill
> for memset(), etc.) that the inline beneficial.  In other cases, the
> extern function is still called.
>
> That being said, I think -ffreestanding, which is used for kernel
> builds, also turns off gcc's builtin inlining.

Ah. True enough. That's probably a lose -- it would be good to get the
inlining because it would improve performance in a bunch of
places. Maybe we should change the definitions of the built in
functions to be things like

#define memcpy(a, b, c)    __builtin_memcpy((a), (b), (c))

etc. as the GCC manual suggests so that we'll get the builtins.

We do, of course, want -ffreestanding because this is not a hosted
environment, but getting builtins would be nice for performance.

-- 
Perry E. Metzger		perry@piermont.com