We describe an algorithm for automatic inline expansion across module
boundaries that works in the presence of higher-order functions and fr
ee variables; it rearranges bindings and scopes as necessary to move n
onexpansive code from one module to another. We describe-and implement
-the algorithm as transformations on lambda-calculus. Our inliner inte
racts well with separate compilation and is efficient, robust, and pra
ctical enough for everyday use in the SML/NJ compiler. Inlining improv
es performance by 4-8% on existing code, and makes it possible to use
much more data abstraction by consistently eliminating penalties for m
odularity.