Exploiting specifications to improve program performance

Many approaches to programming emphasize the use of interfaces. The basic idea is to decompose programs into modules and specifying how each module's interface behaves. This makes it easier to reason about programs because one can rely on a module's specification rather than examining its implementation, which is more complicated. Although programmers benefit from interface specifications when reasoning about programs, existing compilers do not. In this thesis, I discuss how to incorporate specifications into a programming language to improve performance. I use specifications in two ways: (1) to allow programmers to define new optimizations that make general interfaces more efficient to use, and (2) to enhance conventional optimizations. The specifications can be written incrementally, so programmers can choose to write only the parts of specifications needed to improve performance. I demonstrate my approach using Speckle, a statically typed, imperative programming language that incorporates specifications. Users define optimizations in Speckle by providing multiple implementations for a single procedure. One implementation must be general enough to work in any context. The other implementations are more efficient but require an additional precondition specified by the user. The compiler uses specifications to prove that particular calls to the procedure can use the specialized implementations. The prototype Speckle compiler (PSC) incorporates primitive automated theorem-proving technology to optimize programs. In addition to user-defined optimizations, PSC identifies opportunities to perform three kinds of conventional optimizations: eliminating common subexpressions, moving code out of loops, and eliminating dead code. Because specifications are simpler than code, PSC detects optimizations that most compilers cannot, such as hoisting a procedure call out of a loop. Also, because specifications contain information not found in code, PSC detects optimizations that are impossible without specifications. (Copies available exclusively from MIT Libraries, Rm. 14-0551, Cambridge, MA 02139-4307. Ph. 617-253-5668; Fax 617-253-1690.)

[1]  Robert W. Floyd,et al.  Assigning Meanings to Programs , 1993 .

[2]  Neil D. Jones,et al.  Flow analysis and optimization of LISP-like structures , 1979, POPL.

[3]  Cliff B. Jones,et al.  Systematic software development using VDM , 1986, Prentice Hall International Series in Computer Science.

[4]  Prakash Panangaden,et al.  Computation of aliases and support sets , 1987, POPL '87.

[5]  Cliff B. Jones,et al.  Software development - a rigorous approach , 1980, Prentice Hall international series in computer science.

[6]  Rajiv Gupta A fresh look at optimizing array bound checking , 1990, PLDI '90.

[7]  Jeannette M. Wing A TWO-TIERED APPROACH TO SPECIFYING PROGRAMS , 1983 .

[8]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[9]  John Banning,et al.  : An Efficient , 2022 .

[10]  M. Wegman,et al.  Global value numbers and redundant computations , 1988, POPL '88.

[11]  Butler W. Lampson,et al.  Hints for Computer System Design , 1983, IEEE Software.

[12]  James R. Larus,et al.  Detecting conflicts between structure accesses , 1988, PLDI '88.

[13]  James J. Horning,et al.  Report on the Larch Shared Language Version 2.3 , 1990 .

[14]  Donald E. Knuth,et al.  An empirical study of FORTRAN programs , 1971, Softw. Pract. Exp..

[15]  Steven M German Verifying the Absence of Common Runtime Errors in Computer Programs , 1981 .

[16]  Bernhard Steffen,et al.  Efficient Code Motion and an Adaption to Strength Reduction , 1991, TAPSOFT, Vol.2.

[17]  Etienne Morel,et al.  Global optimization by suppression of partial redundancies , 1979, CACM.

[18]  J. J. Horning,et al.  Report on the programming language Euclid , 1977, SIGP.

[19]  Stephen J. Garland,et al.  A Guide to LP, The Larch Prover , 1991 .

[20]  Micha Sharir,et al.  Experience with the SETL Optimizer , 1983, TOPL.

[21]  Gary T. Leavens,et al.  Preliminary Design of Larch/C++ , 1992, Larch.

[22]  Richard Lee Sites,et al.  Proving that computer programs terminate cleanly. , 1974 .

[23]  Jeannette M. Wing Writing Larch interface language specifications , 1987, TOPL.

[24]  Keith D. Cooper,et al.  Analyzing aliases of reference formal parameters , 1985, POPL.

[25]  Richard A. Lerner,et al.  Specifying objects of concurrent systems , 1991 .

[26]  Chris Hankin,et al.  Abstract Interpretation of Declarative Languages , 1987 .

[27]  David Lorge Parnas,et al.  Information Distribution Aspects of Design Methodology , 1971, IFIP Congress.

[28]  Joe D. Warren,et al.  The program dependence graph and its use in optimization , 1987, TOPL.

[29]  Joannes M. Lucassen Types and Effects Towards the Integration of Functional and Imperative Programming. , 1987 .

[30]  Stephen J. Garland,et al.  Debugging Larch Shared Language Specifications , 1990, IEEE Trans. Software Eng..

[31]  Michel Bidoit Pluss, un langage pour le développement de spécifications algébriques modulaires , 1989 .

[32]  Mark T. Vandevoorde Specifications Can Make Programs Run Faster , 1993, TAPSOFT.

[33]  David Gries,et al.  The Science of Programming , 1981, Text and Monographs in Computer Science.

[34]  Katherine Yelick A GENERALIZED APPROACH TO EQUATIONAL UNIFICATION , 1985 .

[35]  John Cocke,et al.  Programming languages and their compilers: Preliminary notes , 1969 .