Re: why not inline all functions?

mcdirmid@beaver.cs.washington.edu (Sean McDirmid)
11 Jun 1998 16:59:26 -0400

          From comp.compilers

Related articles
why not inline all functions? sanvitam@std.teradyne.com (Mark Sanvitale) (1998-06-09)
Re: why not inline all functions? cliff.click@Eng.Sun.COM (Clifford Click) (1998-06-11)
Re: why not inline all functions? p.toland@computer.org (Phillip Toland) (1998-06-11)
Re: why not inline all functions? f81@ix.urz.uni-heidelberg.de (Joerg Schoen) (1998-06-11)
Re: why not inline all functions? bje@cygnus.com (Ben Elliston) (1998-06-11)
Re: why not inline all functions? ayers@incert.com (Andy Ayers) (1998-06-11)
Re: why not inline all functions? mcdirmid@beaver.cs.washington.edu (1998-06-11)
Re: why not inline all functions? portland@uswest.net (Thomas Niemann) (1998-06-11)
Re: why not inline all functions? wclodius@aol.com (1998-06-11)
Re: why not inline all functions? ian@five-d.com (1998-06-18)
Re: why not inline all functions? hawa@celsiustech.se (Hans Walheim) (1998-06-18)
RE: why not inline all functions qjackson@wave.home.com (Quinn Tyler Jackson) (1998-06-19)
Re: why not inline all functions chase@naturalbridge.com (David Chase) (1998-06-19)
[1 later articles]
| List of all articles for this month |

From: mcdirmid@beaver.cs.washington.edu (Sean McDirmid)
Newsgroups: comp.compilers
Date: 11 Jun 1998 16:59:26 -0400
Organization: Computer Science & Engineering, U of Washington, Seattle
References: 98-06-032
Keywords: optimize

Mark Sanvitale (sanvitam@std.teradyne.com) wrote:


: Now, a "inline everything" scheme might run into some roadblocks when
: it comes to external functions which are resolved at link time and the
: notion of dynamic linking is not compatible with such a method.
: Still, I think compilers should try to inline every function it can
: without depending on the programmer to specify a function as "inline"
: (C++).


Hmm, you forgot to mention recursive functions and virtual methods in
C++. In C++, sometimes you execute a method that can only be determined
at runtime. That's why, if you "inline" a method that can be invoked
virtually, the compiler will probably just compile it to a function for
external accesses.


Of course, there are tools like Vortex that are attempting to solve this
problem through extreme global analysis. See:


http://www.cs.washington.edu/research/projects/cecil/


: Perhaps compilers already take advantage of the idea I have outlined or
: perhaps there are some problems with the idea which I don't know about
: (an old C++ book I have says, "Compiler limits prevent complicated
: functions from being inlined," but no further explanation is given.


Over "inlining" leads to greater code bloat. This could adversely affect
your instruction cache (or maybe not...). Whenever you optimize here, you
might deoptimize somewhere else (isn't computer science fun!).


: What do you all think?


: NOTE - During my quest for a CS degree I did not have the chance to take
: a compilers course (it was a tech elective which never fit in my
: schedule) so if my assertion is totally pointless please just point out
: the reason I am wrong and spare me the "Are you stupid/crazy/lost"
: comments. In the area of compilers I admit to being fairly ignorant (as
: far as professional programmers go).


A compilers course probably would not have gone into these issues. Maybe
an architecture course...


Sean
--


Post a followup to this message

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