Towards Better Inlining Decisions Using Inlining Trials

Jeffrey Dean and Craig Chambers
Inlining trials are a general mechanism for making better automatic
decisions about whether a routine is profitable to inline. Unlike
standard source-level inlining heuristics, an inlining trial captures
the effects of optimizations applied to the body of the inlined
routine when calculating the costs and benefits of inlining. The
results of inlining trials are stored in a persistent database to be
reused when making future inlining decisions at similar call sites.
Type group analysis can determine the amount of available static
information exploited during compilation, and the results of analyzing
the compilation of an inlined routine help decide when a future call
site would lead to substantially the same generated code as a given
inlining trial. We have implemented inlining trials and type group
analysis in an optimizing compiler for SELF, and by making wiser
inlining decisions we were able to cut compilation time and compiled
code space with virtually no loss of execution speed. We believe that
inlining trials and type group analysis could be applied effectively
to many high-level languages where procedural or functional
abstraction is used heavily.
Lisp & Functional Programming '94 Conference Proceedings, Orlando, Florida, June, 1994.