Abstract
We have solved the problem of constructing a fully automatic online program specializer for an untyped functional language (specifically, the functional subset of Scheme). We designed our specializer, called Fuse, as an interpreter that returns a trace of suspended computations. The trace is represented as a graph, rather than as program text, and each suspended computation indicates the type of its result. A separate process translates the graph into a particular programming language. Producing graphs rather than program text solves problems with code duplication and premature reduce/residualize decisions. Fuse's termination strategy, which employs online generalization, specializes conditional recursive function calls, and unfolds all other calls. This strategy is shown to be both powerful and safe.
This research supported in part by NSF Contract No. MIP-8902764, and in part by Defense Advanced Research Projects Agency Contract No. N00014-87-K-0828. Erik Ruf is supported by an AT&T Bell Laboratories Ph.D. Scholarship.
Preview
Unable to display preview. Download preview PDF.
References
H. Abelson, G. J. Sussman, and J. Sussman. Structure and Interpretation of Computer Programs. MIT Press, 1985.
L. Beckman et al. A partial evaluator and its use as a programming tool. Artificial Intelligence, 7(4):291–357, 1976.
A. Berlin. A compilation strategy for numerical programs based on partial evaluation. Master's thesis, Massachusetts Institute of Technology, Cambridge, MA, July 1989. Published as Artificial Intelligence Laboratory Technical Report TR-1144.
A. Berlin. Partial evaluation applied to numerical computation. In Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, Nice, France, 1990.
A. Berlin and D. Weise. Compiling scientific programs using partial evaluation. IEEE Computer Magazine, 23(12):25–37, December 1990.
A. Bondorf. Automatic autoprojection of higher order recursive equations. In N. Jones, editor, Proceedings of the 3rd European Symposium on Programming, pages 70–87. Springer-Verlag, LNCS 432, 1990.
A. Bondorf. Self-Applicable Partial Evaluation. PhD thesis, DIKU, University of Copenhangen, Copenhagen, Denmark, December 1990.
A. Bondorf and O. Danvy. Automatic autoprojection for recursive equations with global variables and abstract data types. DIKU Report 90/04, University of Copenhagen, Copenhagen, Denmark, 1990.
R. M. Burstall and J. Darlington. A transformation system for developing recursive programs. Journal of the ACM, 24(1):44–67, January 1977.
C. Consel. New insights into partial evaluation: the SCHISM experiment. In Proceedings of the 2nd European Symposium on Programming, pages 236–246. Springer-Verlag, LNCS 300, 1988.
C. Consel. Binding time analysis for higher order untyped functional languages. In Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, pages 264–272, Nice, France, 1990.
C. Consel and O. Danvy. Partial evaluation of pattern matching in strings. Information Processing Letters, 30(2):79–86, 1989.
C. Consel and O. Danvy. From interpreting to compiling binding times. In N. Jones, editor, Proceedings of the 3rd European Symposium on Programming, pages 88–105. Springer-Verlag, LNCS 432, 1990.
A. P. Ershov. On the partial computation principle. Information Processing Letters, 6(2):38–41, April 1977.
Y. Futamura. Partial evaluation of computation process—an approach to a compiler-compiler. Systems, Computers, Controls, 2(5):45–50, 1971.
M. A. Guzowski. Towards developing a reflexive partial evaluator for an interesting subset of LISP. Master's thesis, Dept. of Computer Engineering and Science, Case Western Reserve University, Cleveland, Ohio, January 1988.
A. Haraldsson. A Program Manipulation System Based on Partial Evaluation. PhD thesis, Linköping University, 1977. Published as Linköping Studies in Science and Technology Dissertation No. 14.
N. D. Jones. Automatic program specialization: A re-examination from basic principles. In D. Bjørner, A. P. Ershov, and N. D. Jones, editors, Partial Evaluation and Mixed Computation, pages 225–282. North-Holland, 1988.
N. D. Jones, P. Sestoft, and H. Søndergaard. An experiment in partial evaluation: The generation of a compiler generator. In Rewriting Techniques and Applications, pages 124–140. Springer-Verlag, LNCS 202, 1985.
N. D. Jones, P. Sestoft, and H. Søndergaard. Mix: A self-applicable partial evaluator for experiments in compiler generation. Lisp and Symbolic Computation, 1(3/4):9–50, 1988.
K. M. Kahn. A partial evaluator of Lisp written in Prolog. Technical Report 17, UPMAIL, Department of Computing Science, Uppsala University, Uppsala, Sweden, February 1983.
L. A. Lombardi and B. Raphael. Lisp as the language for an incremental computer. In Berkeley and Bobrow, editors, The Programming Language Lisp, pages 204–219. MIT Press, Cambridge, MA, 1964.
T. Mogensen. Partially static structures. In D. Bjørner, A. P. Ershov, and N. D. Jones, editors, Partial Evaluation and Mixed Computation, pages 325–347. North-Holland, 1988.
T. Mogensen. Binding Time Aspects of Partial Evaluation. PhD thesis, DIKU, University of Copenhangen, Copenhagen, Denmark, March 1989.
M. Perlin. Call-graph caching: Transforming programs into networks. In Proceedings of the 11th International Joint Conference on Artificial Intelligence, pages 122–128, 1989.
E. Ruf and D. Weise. Using types to avoid redundant specialization. In Proceedings of the 1991 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, New Haven, CN, June 1991.
R. Schooler. Partial evaluation as a means of language extensibility. Master's thesis, MIT, Cambridge, MA, August 1984. Published as MIT/LCS/TR-324.
P. Sestoft. Automatic call unfolding in a partial evaluator. In D. Bjørner, A. P. Ershov, and N. D. Jones, editors, Partial Evaluation and Mixed Computation, pages 485–506. North-Holland, 1988.
G. L. Steele Jr. Rabbit: A compiler for Scheme. Technical Report AI-TR-474, MIT Artificial Intelligence Laboratory, Cambridge, MA, 1978.
V. Turchin. The concept of a supercompiler. ACM Transactions on Programming Languages and Systems, 8(3):292–325, 1986.
D. Weise and E. Ruf. Computing types during program specialization. Technical Report CSL-TR-90-441, Computer Systems Laboratory, Stanford University, Stanford, CA, 1990.
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 1991 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Weise, D., Conybeare, R., Ruf, E., Seligman, S. (1991). Automatic online partial evaluation. In: Hughes, J. (eds) Functional Programming Languages and Computer Architecture. FPCA 1991. Lecture Notes in Computer Science, vol 523. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3540543961_9
Download citation
DOI: https://doi.org/10.1007/3540543961_9
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-54396-1
Online ISBN: 978-3-540-47599-6
eBook Packages: Springer Book Archive