Skip to main content

On Jones-Optimal Specialization for Strongly Typed Languages

  • Conference paper
  • First Online:
Semantics, Applications, and Implementation of Program Generation (SAIG 2000)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1924))

Abstract

The phrase “optimal program specialization” was defined by Jones et al. in 1993 to capture the idea of a specializer being strong enough to remove entire layers of interpretation. As it has become clear that it does not imply “optimality” in the everyday meaning of the word, we propose to rename the concept “jones-optimality”. We argue that the 1993 definition of Jones-optimality is in principle impossible to fulfil for strongly typed languages due to necessary encodings on the inputs and outputs of a well-typed self-interpreter. We propose a technical correction of the definition which allows Jones-optimality to remain a meaningful concept for typed languages. We extend recent work by Hughes and by Taha and Makholm on the long-unsolved problem of Jones-optimal specialization for strongly typed languages. The methods of Taha and Makholm are enhanced to allow “almost optimal” results when a self-interpreter is specialized to a typeincorrect program; how to do this has been an open problem since 1987. Neither Hughes’ nor Taha—Makholm’s methods are by themselves suffi- cient for Jones-optimal specialization when the language contains primitive operations that produce or consume complex data types. A simple postprocess is proposed to solve the problem. An implementation of the proposed techniques has been produced and used for the first successful practical experiments with truly Jones-optimal specialization for strongly typed languages.

Supported in part by the Danish National Science Research Council via project PLT (Programming Language Technology)

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Andersen, L. O.: Program Analysis and Specialization for the C Programming Language. PhD thesis, Department of Computer Science, University of Copenhagen (1994). DIKU-TR-94/19

    Google Scholar 

  2. Birkedal, L. and Welinder, M.: Hand-writing program generator generators. In: ei]Hermenegildo, M. and Penjam, J. (eds.): Programming Language Implementation and Logic Programming: 6th International Symposium, PLILP ’94. Lecture Notes in Computer Science, Vol. 844. Springer-Verlag, Berlin Heidelberg New York, 198–214. http://ftp.diku.dk/diku/semantics/papers/D-199.dvi.Z

    Google Scholar 

  3. Bjørner, D., Ershov, A. P., and Jones, N. D. (eds.): Partial Evaluation and Mixed Computation: selected papers from the IFIP TC2Workshop, October 1987. Special issue of New Generation Computing 6:2–3

    Google Scholar 

  4. Danvy, O.: Type-directed partial evaluation. In: Principles of Programming Languages: 23rd ACM SIGPLAN-SIGACT Symposium, POPL ’96. ACM Press, New York, NY, USA, 242–257. http://ftp.daimi.au.dk/pub/empl/danvy/Papers/danvy-popl96.ps.gz

  5. Futamura, Y.: Partial evaluation of computation process-an approach to a compiler-compiler. Systems, Computers, Controls 2 (1971) 45–50. Reprinted as [6]

    Google Scholar 

  6. Futamura, Y.: Partial evaluation of computation process-an approach to acompiler-compiler. Higher-Order and Symbolic Computation 14 (1999) 381–391. Reprint of [5]

    Google Scholar 

  7. Glenstrup, A. J.: Terminator II: Stopping Partial Evaluation of Fully Recursive Programs. Master’s thesis, Department of Computer Science, University of Copenhagen (1999). DIKU-TR-99/8. http://www.diku.dk/~panic/TerminatorII/

  8. Glenstrup, A. J. and Jones, N. D.: BTA algorithms to ensure termination of off-line partial evaluation. In: Bjørner, D., Broy, M., and Pottosin, I. V. (eds.): Perspectives of System Informatics: 2nd International Andrei Ershov Memorial Conference, PSI’ 96. Lecture Notes in Computer Science, Vol. 1181. Springer-Verlag, Berlin Heidelberg New York, 273–284.http://ftp.diku.dk/diku/semantics/papers/D-274.ps.gz

    Google Scholar 

  9. Gomard, C. K. and Jones, N. D.: A partial evaluator for the untyped lambdacalculus. Journal of Functional Programming 1 (1991) 21–69

    Article  MATH  MathSciNet  Google Scholar 

  10. Henglein, F.: Global tagging optimization by type inference. In: Lisp and Functional Programming: 1992 ACM Conference, LFP ’92. Special issue of ACM LISP Pointers 5:1. ACM Press, New York, NY, USA, 205–215

    Google Scholar 

  11. Hughes, J.: Type specialization for the λ-calculus; or, A new paradigm for partial evaluation based on type inference. In: ei]Danvy, O., Glück, R., and Thiemann, P. (eds.): Partial Evaluation: International Seminar. Lecture Notes in Computer Science, Vol. 1110. Springer-Verlag, Berlin Heidelberg New York (1996) 183–251. http://www.cs.chalmers.se/~rjmh/Papers/typed-pe.ps

    Google Scholar 

  12. Hughes, J.: An introduction to program specialization by type inference. In: Glasgow Workshop on Functional Programming. Glasgow University (1996). http://www.cs.chalmers.se/~rjmh/Papers/glasgow-96.dvi

  13. Hughes, J.: The correctness of type specialization. In: Smolka, G. (ed.): 9th European Symposium on Programming: ESOP ’00. Lecture Notes in Computer Science, Vol. 1782. Springer-Verlag, Berlin Heidelberg New York, 215–229

    Google Scholar 

  14. Jones, N. D. et al.: Challenging problems in partial evaluation and mixed computation. In: ei]Bjørner, D., Ershov, A. P., and Jones, N. D. (eds.): Partial Evaluation and Mixed Computation: IFIP TC2 Workshop. North-Holland, Amsterdam, The Netherlands (1987) 1–14. Also pages 291–303 of [3]

    Google Scholar 

  15. Jones, N. D., Gomard, C. K., and Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice Hall, Englewood Cliff, NJ, USA (1993). http://www.dina.kvl.dk/~sestoft/pebook/pebook.html

    MATH  Google Scholar 

  16. Launchbury, J.: A strongly-typed self-applicable partial evaluator. In: ei]Hughes, J. (ed.): Functional Programming Languages and Computer Architecture: 5th ACM Conference, FPCA ’91. Lecture Notes in Computer Science, Vol. 523. Springer-Verlag, Berlin Heidelberg New York, 145–164

    Google Scholar 

  17. Mogensen, T. Æ.: Constructor specialization. In: ei]Schmidt, D. (ed.): Partial Evaluation and Semantics-Based Program Manipulation: ACM SIGPLAN Symposium, PEPM ’93. 22–32

    Google Scholar 

  18. Romanenko, S. and Sestoft, P.: Moscow ML version 1.44. A light-weight implementation of Standard ML (1999). http://www.dina.kvl.dk/~sestoft/mosml.html

  19. Taha, W. and Makholm, H.: Tag elimination; or, Type specialisation is a type-indexed effect. In: Subtyping & Dependent Types in Programming: APPSEM Workshop, DTP ’00. INRIA technical report. http://www-sop.inria.fr/oasis/DTP00/Proceedings/taha.ps

  20. Welinder, M.: Partial Evalutation and Correctness. PhD thesis, Department of Computer Science, University of Copenhagen (1998). DIKU-TR-98/13

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2000 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Makholm, H. (2000). On Jones-Optimal Specialization for Strongly Typed Languages. In: Taha, W. (eds) Semantics, Applications, and Implementation of Program Generation. SAIG 2000. Lecture Notes in Computer Science, vol 1924. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45350-4_11

Download citation

  • DOI: https://doi.org/10.1007/3-540-45350-4_11

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-41054-6

  • Online ISBN: 978-3-540-45350-5

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics