Date: Tue, 22 Jul 2003 10:47:21 -0700 From: David Schultz <das@FreeBSD.ORG> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: Bruce Evans <bde@zeta.org.au> Subject: Re: cvs commit: src/sys/dev/lnc if_lnc.c Message-ID: <20030722174721.GA8358@HAL9000.homeunix.com> In-Reply-To: <13094.1058892140@critter.freebsd.dk> References: <20030722163007.GA6080@HAL9000.homeunix.com> <13094.1058892140@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Jul 22, 2003, Poul-Henning Kamp wrote: > In message <20030722163007.GA6080@HAL9000.homeunix.com>, David Schultz writes: > > >The cost of not inlining is insignificant on i386, but it can be > >very significant on architectures with sliding register windows, > >such as sparc64. On sparc64, a trap is taken every time the > >procedure call depth changes by more than 6. An inlining can mean > >the difference between super-efficient procedure calls and having > >to slide the register window back and forth at great penalty. > > Fine, but if you are not able to measure the difference and the > code is bigger, is it worth it ? Inlining C++ code on sparc64 is a huge win, but that's mostly because C++ is very heavy on function calls. I don't know exactly what the impact would be on most parts of the FreeBSD kernel. > >[1] In practice, just about any contentious case of inlining is > > going to be a wash anyway, and neither side of the argument > > is entirely without merit. I'm mostly opposed to a new policy > > on the grounds that it's just another stupid rule, complete > > with technicolor bikesheds, to throw in the faces of people > > trying to do something useful. > > I far prefer to just fix the problems, but clearly the sort of > inline (and register) use we have in the tree indicates that at > least some of our contributors are in need of a guideline for > when to inline things. If you want to add a few lines to style(9) to the effect of ``be careful, inlining allows you to shoot yourself in the foot with exponentially more bullets than you expected'', that's fine with me. But I'd rather see inlines fixed or complained about only when someone really did screw up. I worry that if people are prevented from using inlines, they will not decompose their code into separate functions as much in the first place, regardless of whether the optimization was justified. If the inline doesn't increase code size, it is certainly the lesser of two evils, and, in my opinion, not worth fussing about.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030722174721.GA8358>