Subject: Re: Proposal: eliminate all macros in the kernel
To: None <tech-kern@netbsd.org>
From: Jed Davis <jdev@panix.com>
List: tech-kern
Date: 11/22/2005 21:18:55
Thor Lancelot Simon <tls@rek.tjls.com> writes:

> On Tue, Nov 22, 2005 at 08:51:32AM +0100, Tonnerre LOMBARD wrote:
>> Salut,
>> 
>> On Mon, Nov 21, 2005 at 08:30:08PM -0500, Jed Davis wrote:
>> > It Would Be Nice If the compiler could attempt to decide on its own
>> > whether a particular function should be inlined, since it's likely to
>> > know more about the situation on a given architecture than we do.
>> 
>> That's exactly what happens. See -finline-limit.
>
> Yes, but only within a compilation unit.  There are compilers that do
> better as part of interprocerdural optimization during the link stage
> for an executable but our current GCC is not one.

For an example of "better", if there's some inlinable function that,
replacing a macro, is in a header file included by multiple
compilation units that call it out-of-line, then (as far as I know)
we'll get multiple copies of the function in the kernel image.

-- 
(let ((C call-with-current-continuation)) (apply (lambda (x y) (x y)) (map
((lambda (r) ((C C) (lambda (s) (r (lambda l (apply (s s) l))))))  (lambda
(f) (lambda (l) (if (null? l) C (lambda (k) (display (car l)) ((f (cdr l))
(C k)))))))    '((#\J #\d #\D #\v #\s) (#\e #\space #\a #\i #\newline)))))