Automatic Cross-Library Optimization

The library construct added to Scheme by the Revised 6 Report on Scheme (R6RS) provides a natural boundary for compilation units, particularly for separate compilation. Unfortunately, using the library as the compilation unit for Scheme programs can interfere with optimizations such as inlining that are important for good performance of compiled programs. Our Scheme system provides a way for specifying larger compilation units, the library group, which allows the source code from several libraries and, optionally, a program to be compiled as a single compilation unit. The library group form works well, but is not a good fit for situations where all of the source code is not available at compile time, particularly in the case where a library is distributed in binary form to be used by other library or application developers. In order to handle situations like this, we have introduced a new, automatic, cross-library optimization mechanism. The automatic cross-library optimization mechanism provides some of the benefits of the library group form without requiring modifications to the program and without requiring libraries to be compiled together. Cross-library optimization is supported by recording additional information in the library binary that can be used when the library is imported by another library or program. This paper describes our automatic cross-library optimization and compares it with the existing library group system.

[1]  Andrew W. Appel,et al.  Standard ML of New Jersey , 1991, PLILP.

[2]  R. Kent Dybvig,et al.  Fast and Effective Procedure Inlining , 1997, SAS.

[3]  R. Kent Dybvig,et al.  Enabling cross-library optimization and compile-time error checking in the presence of procedural macros , 2010 .

[4]  Joel S. Cohen,et al.  Computer Algebra and Symbolic Computation: Elementary Algorithms , 2002 .

[5]  Andrew W. Appel,et al.  Lambda-splitting: a higher-order approach to cross-module optimizations , 1997, ICFP '97.

[6]  Zhong Shao Typed cross-module compilation , 1998, ICFP '98.

[7]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..

[8]  W. Wilson Ho,et al.  Optimizing the Performance of Dynamically-Linked Programs , 1995, USENIX.

[9]  R. Kent Dybvig,et al.  Revised6 Report on the Algorithmic Language Scheme , 2009 .

[10]  R. Kent Dybvig,et al.  A sufficiently smart compiler for procedural records , 2012, Scheme '12.

[11]  Joel S. Cohen,et al.  Computer Algebra and Symbolic Computation: Mathematical Methods , 2003 .

[12]  Simon Peyton Jones,et al.  The Glasgow Haskell Compiler , 2012 .

[13]  Harold Abelson,et al.  Revised5 report on the algorithmic language scheme , 1998, SIGP.

[14]  Dominique Boucher GOld: a link-time optimizer for Scheme , 2000 .

[15]  R. Kent Dybvig,et al.  Optimizing closures in O(0) time , 2012, Scheme '12.

[16]  R. Kent Dybvig,et al.  The Scheme Programming Language , 1995 .