Integrating Partial Evaluators into Interpreters
This paper describes our first step towards the integration of partial evaluation into standard interpretation. The two main issues in this integration are the treatment of heap objects and side-effects. To enable specialization with respect to the heap objects that are allocated beforehand in standard evaluation, specialization is performed with respect to the heap state at specialization time rather than based on a program text input so far. To avoid duplication of heap objects, direct references to heap objects are allowed in the specialized programs, in addition to the use of the conventional let-insertion technique. Despite our modest approach on side-effects that we allow partial evaluation of only side-effect free portions of a program, the resulting system covers some typical cases, such as the use of partial evaluation during an interactive debugging session. It also enables us to specialize a (side-effect free) program with respect to cyclic data structures, which was not easy before. We formalize this integration using store semantics and state its correctness. The system is implemented in Scheme and various examples are tested. Among them, we show specialization of a ray tracing program.
Unable to display preview. Download preview PDF.
- 1.Andersen, P. H. “Partial Evaluation Applied to Ray Tracing,” Software Engineering in Scientific Computing, pp. 78–85, DIKU report D-289 (1996).Google Scholar
- 3.Asai, K., H. Masuhara, and A. Yonezawa “Partial Evaluation of Call-by-value λ-calculus with Side-effects,” ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM '97), pp. 12–21 (June 1997).Google Scholar
- 7.Consel, C. “A Tour of Schism: A Partial Evaluation System for Higher-Order Applicative Languages,” Proceedings of the Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM‘93), pp. 145–154 (June 1993).Google Scholar
- 8.Consel, C., P. Jouvelot, and P. Ørbæk “Separate Polyvariant Binding Time Reconstruction,” Ecole des Mines, CRI Report A/261 (October 1994).Google Scholar
- 9.Consel, C., and F. Noёl “A General Approach for Run-Time Specialization and its Application to C,” Conference Record of the 23rd Annual ACM Symposium on Principles of Programming Languages, pp. 145–156 (January 1996).Google Scholar
- 10.Danvy, O. “Type-Directed Partial Evaluation,” Conference Record of the 23rd Annual ACM Symposium on Principles of Programming Languages, pp. 242–257 (January 1996).Google Scholar
- 11.Danvy, O., and A. Filinski “Abstracting Control,” Proceedings of the 1990 ACM Conference on Lisp and Functional Programming, pp. 151–160(June 1990).Google Scholar
- 12.Flanagan, C., A. Sabry, B. F. Duba, and M. Felleisen “The Essence of Compiling with Continuations,” Proceedings of the ACM SIGPLAN ‘93 Conference on Programming Language Design and Implementation (PLDI), pp. 237–247 (June 1993).Google Scholar
- 13.Futamura, Y. “Partial evaluation of computation process-an approach to a compiler-compiler,” Systems, Computers, Controls, Vol. 2, No. 5, pp. 45–50, (1971), reprinted as Higher-Order and Symbolic Computation, Vol. 12, No. 4, pp. 381-391, Kluwer Academic Publishers (December 1999).Google Scholar
- 15.Guenter, B., T. B. Knoblock, E. Ruf “Specializing Shaders,” Proceedings of SIGGRAPH 95 (Computer Graphics Proceedings) pp. 343–350 (1995).Google Scholar
- 16.Hatcliff, J. “An Introduction to Online and Offline Partial Evaluation Using a Simple Flowchart Language,” In J. Hatcliff, T. Æ. Mogensen, and P. Thiemann editors, Partial Evaluation, Practice and Theory (LNCS 1706), pp. 20–82 (1999).Google Scholar
- 17.Hölzle, U., C. Chambers, and D. Ungar “Debugging Optimized Code with Dynamic Deoptimization,” Proceedings of the ACM SIGPLAN ‘92 Conference on Programming Language Design and Implementation (PLDI), pp. 32–43 (June 1992).Google Scholar
- 18.Hornof, L., C. Consel, and J. Noyé “Effective Specialization of Realistic Programs via Use Sensitivity,” In Van Hentenryck P., editor, Static Analysis (LNCS 1302), pp. 63–73 (1997).Google Scholar
- 20.Lawall, J. L., and O. Danvy “Continuation-Based Partial Evaluation,” Proceedings of the 1994 ACM Conference on Lisp and Functional Programming, pp. 227–238 (June 1994).Google Scholar
- 21.Lee, P., and M. Leone “Optimizing ML with run-time code generation,” Proceedings of the ACM SIGPLAN ‘96 Conference on Programming Language Design and Implementation (PLDI), pp. 137–148 (May 1996).Google Scholar
- 22.Mogensen, T. Æ. “The Application of Partial Evaluation to Ray-Tracing,” Master’s thesis, DIKU, University of Copenhagen (1986).Google Scholar
- 23.Ruf, E. Topics in Online Partial Evaluation, Ph.D. thesis, Stanford University (March 1993). Also published as Stanford Computer Systems Laboratory technical report CSL-TR-93-563.Google Scholar
- 24.Taha, W. Multi-Stage Programming: Its Theory and Applications, Ph.D. thesis, Oregon Graduate Institute of Science and Technology (November 1999).Google Scholar
- 25.Thiemann, P. J. “Cogen in Six Lines,” Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP'96), pp. 180–189 (May 1996).Google Scholar
- 26.Thiemann, P. J., and D. Dussart “Partial Evaluation for Higher-Order Languages with State,” Available at http://www.informatik.uni-freiburg.de/~thiemann/papers/mlpe.ps.gz.
- 27.Volanschi, E. N., C. Consel, G. Muller, and C. Cowan “Declarative Specialization of Object-Oriented Program,” Proceedings of the 1997 ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA ‘97), pp. 286–300, (October 1997).Google Scholar