[pypy-dev] Re: [pypy-svn] r21163 - pypy/dist/pypy/translator/backendopt

Armin Rigo arigo at tunes.org
Thu Dec 15 09:04:40 CET 2005


Hi Carl,

On Wed, Dec 14, 2005 at 11:40:23PM +0100, cfbolz at codespeak.net wrote:
> Modified:
>    pypy/dist/pypy/translator/backendopt/inline.py
> Log:
> make functions that are called exactly once more likely to get inlined.

I'm concerned about functions that look like:

def _ll_list_resize_ge(l, newsize):
    if len(l.items) >= newsize:
        l.length = newsize
    else:
        _ll_list_resize_really(l, newsize)

It's a stub that we would like to see inlined in its many callers, but
the _ll_list_resize_really() should not be inlined.  With your new
weighting formula, it's likely that _ll_list_resize_really() would get
inlined into _ll_list_resize_ge() first, and then the intended effect is
lost.  (The example is not good because _ll_list_resize_really() is
actually called from two other places as well...  it's just an example).

Maybe it would be better to do two independent passes in
auto_inlining(): with the old formula, and then once again --
recomputing the callers/callees as well -- with the modified formula
favoring functions that are *still* called only once.


A bientot,

Armin



More information about the Pypy-dev mailing list