Re: the Evil Effects of Inlining

gateley@rice.edu (John Gateley)
Fri, 03 May 91 20:07:39 GMT

          From comp.compilers

Related articles
the Evil Effects of Inlining preston@ariel.rice.edu (1991-05-02)
Re: the Evil Effects of Inlining ressler@cs.cornell.edu (1991-05-03)
Re: the Evil Effects of Inlining daniel@quilty.Stanford.EDU (1991-05-03)
Re: the Evil Effects of Inlining gateley@rice.edu (1991-05-03)
Re: the Evil Effects of Inlining boehm@parc.xerox.com (1991-05-03)
Re: the Evil Effects of Inlining mac@eleazar.dartmouth.edu (1991-05-03)
Re: the Evil Effects of Inlining pardo@june.cs.washington.edu (1991-05-03)
Re: the Evil Effects of Inlining compres!chris@crackers.clearpoint.com (1991-05-04)
Re: the Evil Effects of Inlining carter@cs.wisc.edu (1991-05-05)
Re: the Evil Effects of Inlining pardo@june.cs.washington.edu (1991-05-05)
[2 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: gateley@rice.edu (John Gateley)
In-Reply-To: preston@ariel.rice.edu's message of 2 May 91 18:05:20 GMT
Keywords: Lisp, design, optimize
Organization: Rice University
References: <9104262025.AA21840@enuxva.eas.asu.edu> <7524@ecs.soton.ac.uk> <1991May1.035622.25021@daffy.cs.wisc.edu> <1991May2.180508.17100@rice.edu>
Date: Fri, 03 May 91 20:07:39 GMT

In article <1991May2.180508.17100@rice.edu> preston@ariel.rice.edu (Preston Briggs) writes:
      carter@cs.wisc.edu (Gregory Carter) writes:
      [wondering about inlining the world]
      Don't forget to be careful of recursion!


Homework assignment: figure out how to inline with recursion (Yes, I
did it. Turned out to be pretty neat :^).


      and the moderator notes


      >[GCC and some other C compilers permit you do declare a procedure "inline"
      >so that it is expanded wherever it is called. That gives pretty much the
      >same effect, faster but larger code. -John]


      Locally, we're pretty down on naive inlining. I think there are some
      cases where it pays, but they are much rarer than imagined. So, here's a
      list of reasons not to inline:


I have found several places where inlining is very useful, but they all
seem to be in the Lisp world. In the compiler (for CL/Scheme) I worked on
we used inlining quite heavily to optimize the language runtimes. However,
we were careful about it - we would only inline a procedure if it didn't
cause code explosion or if there was some reason the extra code would get
folded away. For example, if we saw an "aref" call (CL's general purpose
array reference) and we could determine that the argument was a simple
vector, we would fold it away producing a simple vector ref. We didn't
just blindly inline the whole mess (which was 50-100 lines of code) and
hope that it would go away.


John
gateley@rice.edu
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.