Integrating Partial Evaluators into Interpreters

  • Kenichi Asai
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2196)

Abstract

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.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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
  2. 2.
    Asai, K. “Binding-Time Analysis for Both Static and Dynamic Expressions,” In A. Cortesi and G. Filé, editors, Static Analysis (LNCS) 1694), pp. 117–133 (September 1999).CrossRefGoogle Scholar
  3. 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
  4. 4.
    Asai, K., S. Matsuoka, and A. Yonezawa “Duplication and Partial Evaluation-For a Better Understanding of Reflective Languages-,” Lisp and Symbolic Computation, Vol. 9, Nos. 2/3, pp. 203–241, Kluwer Academic Publishers (May/June 1996).CrossRefGoogle Scholar
  5. 5.
    Balat, V., and O. Danvy “Strong Normalization by Type-Directed Partial Evaluation and Run-Time Code Generation,” In X. Leroy and A. Ohori editors, Types in Compilation (LNCS 1473) pp. 240–252 (March 1998).CrossRefGoogle Scholar
  6. 6.
    Bondorf, A., and O. Danvy “Automatic autoprojection of recursive equations with global variables and abstract data types,” Science of Computer Programming, Vol.16, pp. 151–195, Elsevier (1991).MATHCrossRefGoogle Scholar
  7. 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. 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. 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. 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. 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. 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. 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
  14. 14.
    Glück, R., and J. Jørgensen “An Automatic Program Generator for Multi-Level Specialization,” Lisp and Symbolic Computation, Vol. 10, No. 2, pp. 113–158, Kluwer Academic Publishers (July 1997).CrossRefGoogle Scholar
  15. 15.
    Guenter, B., T. B. Knoblock, E. Ruf “Specializing Shaders,” Proceedings of SIGGRAPH 95 (Computer Graphics Proceedings) pp. 343–350 (1995).Google Scholar
  16. 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. 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. 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
  19. 19.
    Jones, N. D., C. K. Gomard, and P. Sestoft Partial Evaluation and Automatic Program Generation, New York: Prentice-Hall (1993).MATHGoogle Scholar
  20. 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. 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. 22.
    Mogensen, T. Æ. “The Application of Partial Evaluation to Ray-Tracing,” Master’s thesis, DIKU, University of Copenhagen (1986).Google Scholar
  23. 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. 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. 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. 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. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2001

Authors and Affiliations

  • Kenichi Asai
    • 1
  1. 1.Department of Information Science, Faculty of ScienceUniversity of TokyoJapan

Personalised recommendations