Re: Detailed algorithms on inline optimization

Martin Rodgers <mcrodgers@gmail.com>
Sun, 24 Jan 2010 20:38:32 +0000

          From comp.compilers

Related articles
[6 earlier articles]
Re: Detailed algorithms on inline optimization rangsynth@gmail.com (Robin Holmes) (2010-01-20)
Re: Detailed algorithms on inline optimization jeremy.wright@microfocus.com (Jeremy Wright) (2010-01-20)
Re: Detailed algorithms on inline optimization dot@dotat.at (Tony Finch) (2010-01-21)
Re: Detailed algorithms on inline optimization bear@sonic.net (Ray) (2010-01-21)
Re: Detailed algorithms on inline optimization bobduff@shell01.TheWorld.com (Robert A Duff) (2010-01-21)
Re: Detailed algorithms on inline optimization cdodd@acm.org (Chris Dodd) (2010-01-23)
Re: Detailed algorithms on inline optimization mcrodgers@gmail.com (Martin Rodgers) (2010-01-24)
Re: Detailed algorithms on inline optimization anton@mips.complang.tuwien.ac.at (2010-01-25)
Re: Detailed algorithms on inline optimization monnier@iro.umontreal.ca (Stefan Monnier) (2010-01-25)
Re: Detailed algorithms on inline optimization kkylheku@gmail.com (Kaz Kylheku) (2010-01-28)
Re: Detailed algorithms on inline optimization martin@gkc.org.uk (Martin Ward) (2010-01-28)
Re: Detailed algorithms on inline optimization anton@mips.complang.tuwien.ac.at (2010-01-31)
Re: Detailed algorithms on inline optimization dot@dotat.at (Tony Finch) (2010-02-02)
[1 later articles]
| List of all articles for this month |

From: Martin Rodgers <mcrodgers@gmail.com>
Newsgroups: comp.compilers
Date: Sun, 24 Jan 2010 20:38:32 +0000
Organization: Compilers Central
References: 10-01-058 10-01-061
Keywords: optimize
Posted-Date: 25 Jan 2010 00:29:46 EST

Robert A Duff wrote:


> You can inline recursive calls if you limit the depth.
>
> - Bob
> [True. Does anyone do that, inline the first few times though and then punt to the
> normal routine? -John]


Chez Scheme does it. See this paper for details:
Fast and Effective Procedure Inlining (Waddell, Dybvig)
http://citeseer.ist.psu.edu/waddell97fast.html


They use effort, size and fold counters to limit code growth. This
works better than just limiting the call depth, as they do constant
folding as they inline. They give results for an effort counter limit
of 1000. This may sound like a lot, but they claim extensive caching
helps exploit the effort expended even on calls that ultimately exheed
a counter limit and fail to inline.


Implementing the basic inlining procedure with counters in one of my
own compilers suggested that this can indeed work very well. There are
many enhancements suggested in the paper, but I didn't have time to
implement them. I expect Chez Scheme uses them, however.


Another interesting aspect of their technique is the different
handling of contexts. They distinguish between value, call, test and
unused references. The caching also exploits this, of course. The
caching leads to specialisation of procedures, so even residual calls
can benefit from this technique.


-- Martin Rodgers http://www.wildcard.demon.co.uk



Post a followup to this message

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