|
ABSTRACT
Large functional programs are often constructed by decomposing each big task into smaller tasks which can be performed by simpler functions. This hierarchical style of developing programs has been found to improve programmers' productivity because smaller functions are easier to construct and reuse. However, programs written in this way tend to be less efficient. Unnecessary intermediate data structures may be created. More function invocations may be required.
To reduce such performance penalties, Wadler proposed a transformation algorithm, called deforestation, which could automatically fuse certain composed expressions together in order to eliminate intermediate tree-like data structures. However, his technique is only applicable to a subset of first-order expressions.
This paper will generalise the deforestation technique to make it applicable to all first-order and higher-order functional programs. Our generalisation is made possible by the adoption of a model for safe fusion which views each function as a producer and its parameters as consumers. Through this model, static program properties are proposed to classify producers and consumers as either safe or unsafe. This classification is used to identify sub-terms that can be safely fused/eliminated. We present the generalised transformation algorithm as a set of syntax-directed rewrite rules, illustrate it with examples, and provide an outline of its termination proof.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
Aug85
|
|
 |
BD77
|
|
| |
BEJ88
|
D. Bjorner, AP. Ershov, and ND Jones. Workshop on Partial Evaluation and Mixed Computations. G1 Avarnes, Denmark, North-Holland, 1988.
|
| |
CD92
|
Wei-Ngan Chin and John Darlington. Higher-order removal transformation technique for functional programs. In 15th Australian Computer Science Conference, Austrahan CS Comm Vol ld, No i, pages 181-194, Hobart, Tasmania, January 1992.
|
| |
Chi90
|
Wei-Ngan Chin. Automatic Methods for Program Transformation. PhD thesis, Imperial College, University of London, March 1990.
|
| |
Chi91
|
Wei-Ngan Chin. Generalising deforestation for all first-order functional programs, in Workshop on Static Analysis of Equational, Functional and Logic Programmzng Languages, BIGRE 7~, pages 173-181, Bordeaux,France, October 1991.
|
 |
Con90
|
|
 |
Fea82
|
|
| |
FW88
|
AB Ferguson and Phil Wadler. When will deforestation stop? In Proc of 1988 Glasgow Workshop on Functional Programming (as Research Report 89/R$ of Glasgow University), pages 39-56, Rothesay, Isle of Bute, August 1988.
|
| |
Hol91
|
|
| |
Jon88
|
Neil J. Jones. Automatic program specialisalion: A re-examination from basic principles. In Workshop on Partial Evaluation and Mixed Computations, pages 225-282, GI Avarnes, Denmark, North-Holland, 1988.
|
| |
JSS89
|
ND Jones, P Sestoft, and H Sondergaard. An experiment in partial evaluation: the generation of a compiler generator. Journal of LISP and Symbolic Computation, 2(1):9-50, 1989.
|
 |
Tur86
|
|
 |
Wad84
|
|
| |
Wad85
|
|
| |
Wad87
|
Phil Wadler. Efficient compilation of patternmatching. In The Implementation of Functional Programming Languages (by Simon Peyton- Jones), chapter 5. Prentice-Hall International, 1987.
|
| |
Wad88
|
|
 |
Wat91
|
|
CITED BY 17
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Yong Meng Teo , Wei-Ngan Chin , Soon Huat Tan, Deriving efficient parallel programs for complex recurrences, Proceedings of the second international symposium on Parallel symbolic computation, p.101-110, July 20-22, 1997, Maui, Hawaii, United States
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|