Skip to main content

Dynamically Adaptable Software with Metacomputations in a Staged Language

  • Conference paper
  • First Online:

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

Abstract

Profile-driven compiler optimizations take advantage of information gathered at runtime to re-compile programs into more efficient code. Such optimizations appear to be more easily incorporated within a semantics-directed compiler structure than within traditional compiler structure.We present a case study in which a metacomputationbased reference compiler for a small imperative language converts easily into a compiler which performs a particular profile-driven optimization: local register allocation. Our reference compiler is implemented in the staged, functional language MetaML and takes full advantage of the synergy between metacomputation-style language definitions and the staging constructs of MetaML. We believe that the approach to implementing profile-driven optimizations presented here suggests a useful, formal model for dynamically adaptable software

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

Buying options

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

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. V. Aho, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques, and Tools. Reading, Mass.: Addison-Wesley, 1985.

    Google Scholar 

  2. C. Consel and F. Noäl. A general approach for run-time specialization and its application to C. In ACM, editor, Conference record of POPL ‘96, 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages: papers presented at the Symposium: St. Petersburg Beach, Florida, 21-24 January 1996, pages 145–156, New York, NY, USA, 1996. ACM Press.

    Chapter  Google Scholar 

  3. O. Danvy. Type-directed partial evaluation. In ACM, editor, Conference record of POPL ‘96, 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages: papers presented at the Symposium: St. Petersburg Beach, Florida, 21-24 January 1996, pages 242–257, New York, NY, USA, 1996. ACM Press.

    Chapter  Google Scholar 

  4. O. Danvy and R. Vestergaard. Semantics-based compiling: A case study in typedirected partial evaluation. Lecture Notes in Computer Science, 1140:182–209, 1996.

    Google Scholar 

  5. R. Glück and J. Jørgensen. Efficient multi-level generating extensions for program specialization. In S. D. Swierstra and M. Hermenegildo, editors, Programming Languages: Implementations, Logics and Programs (PLILP‘95), volume 982 of Lecture Notes in Computer Science, pages 259–278. Springer-Verlag, 1995.

    Chapter  Google Scholar 

  6. W. Harrison. Modular Compilers and Their Correctness Proofs. PhD thesis, University of Illinois at Urbana-Champaign, 2001.

    Google Scholar 

  7. W. Harrison and S. Kamin. Metacomputation-based compiler architecture. In Mathematics of Program Construction-MPC200, Proc. 5th International Conference on the Mathematics of Program Construction, Ponte de Lima, Portugal, volume 1837 of Lecture Notes in Computer Science, pages 213–229. Springer-Verlag, 2000.

    Google Scholar 

  8. W. L. Harrison and S. N. Kamin. Modular compilers based on monad transformers. In Proceedings of the 1998 International Conference on Computer Languages, pages 122–131. IEEE Computer Society Press, 1998.

    Google Scholar 

  9. P. Hudak, S. P. Jones, P. Wadler, B. Boutel, J. Fairbairn, J. Fasel, M. M. Guzman, K. Hammond, J. Hughes, T. Johnsson, D. Kieburtz, R. Nikhil, W. Partian, and J. Peterson. Report on the programming language haskell, version 1.2. Sigplan, 27(5), May 1992. Hudak, Wadler, Arvind, Boutel, Fairbairn, Fasel, Hughes, Johnsson, Kieburtz, Nikhil, Peyton Jones, Reeve, Wise, Young; Version 1.0: Functional Programming (Languages?) and Computer Architecture 89, pp123, 1989.

    Google Scholar 

  10. M. P. Jones. A system of constructor classes: Overloading and implicit higherorder polymorphism. In Proceedings of the Conference on Functional Programming Languages and Computer Architecture, pages 52–64, New York, NY, USA, June 1993. ACM Press.

    Google Scholar 

  11. N. D. Jones, C. K. Gomard, and P. Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall International, International Series in Computer Science, June 1993. ISBN number 0-13-020249-5 (pbk).

    Google Scholar 

  12. P. Lee. Realistic Compiler Generation. Foundations of Computing Series. MIT Press, 1989.

    Google Scholar 

  13. M. Leone and P. Lee. A declarative approach to run-time code generation. In Workshop on Compiler Support for System Software (WCSSS), Feb. 1996.

    Google Scholar 

  14. S. Liang, P. Hudak, and M. Jones. Monad transformers and modular interpreters. In ACM, editor, Conference record of POPL’ 95, 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages: papers presented at the Symposium: San Francisco, California, January 22-25, 1995, pages 333–343, New York, NY, USA, 1995. ACM Press.

    Google Scholar 

  15. S. S. Muchnick. Advanced compiler design and implementation. Morgan Kaufmann Publishers, 2929 Campus Drive, Suite 260, San Mateo, CA 94403, USA, 1997.

    Google Scholar 

  16. M. Odersky and K. Läufer. Putting type annotations to work. In ACM, editor, Conference record of POPL’ 96, 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages: papers presented at the Symposium: St. Petersburg Beach, Florida, 21-24 January 1996, pages 54–67, New York, NY, USA, 1996. ACM Press.

    Google Scholar 

  17. J. Peterson, K. Hammond, et al. Report on the programming language haskell, a non-strict purely-functional programming language, version 1.3. Technical report, Yale University, May 1996.

    Google Scholar 

  18. Calton Pu and Jonathan Walpole. A study of dynamic optimization techniques: Lessons and directions in kernel design. Technical Report OGI-CSE-93-007, Oregon Graduate Institute of Science and Technology, 1993.

    Google Scholar 

  19. C. Pu, H. Massalin, and J. Ioannidis. The synthesis kernel. Usenix Journal, Computing Systems, 1(1):11, Winter 1988.

    Google Scholar 

  20. J. C. Reynolds. The essence of algol. In J. W. de Bakker and J. C. van Vliet, editors, Algorithmic Languages, pages 345–372, Amsterdam, 1981. North-Holland.

    Google Scholar 

  21. T. Sheard, Z. El-Abidine Benaissa, and E. Pasalic. DSL implementation using staging and monads. In Proceedings of the 2nd Conference on Domain-Specific Languages, pages 81–94, Berkeley, CA, Oct. 3-5 1999. USENIX Association.

    Google Scholar 

  22. J. E. Stoy. Denotational Semantics: The Scott-Strachey Approach to Programming Language Semantics. MIT Press, Cambridge, Massachusetts, 1977.

    Google Scholar 

  23. W. Taha. Multi-Stage Programming: Its Theory and Applications. PhD thesis, Oregon Graduate Institute of Science and Technology, 1999.

    Google Scholar 

  24. W. Taha and T. Sheard. Multi-stage programming with explicit annotations. In Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM-97), volume 32, 12 of ACM SIGPLAN Notices, pages 203–217, New York, June 12–13 1997. ACM Press.

    Article  Google Scholar 

  25. P. Wadler. Comprehending monads. Mathematical Structures in Computer Science, 2:461–493, 1992.

    Article  MATH  MathSciNet  Google Scholar 

  26. P. Wadler. The essence of functional programming. In ACM, editor, Conference record of POPL ‘92, 19th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages: papers presented at the Symposium: Albuquerque, New Mexico, January 1992, pages 1–15.

    Google Scholar 

  27. P. Wadler. Monads for functional programming. Lecture Notes in Computer Science, 925:24–52, 1995.

    Google Scholar 

  28. M. Wand. Deriving target code as a representation of continuation semantics. ACM Transactions on Programming Languages and Systems, 4(3):496–517, July 1982.

    Article  MATH  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2001 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Harrison, B., Sheard, T. (2001). Dynamically Adaptable Software with Metacomputations in a Staged Language. In: Taha, W. (eds) Semantics, Applications, and Implementation of Program Generation. SAIG 2001. Lecture Notes in Computer Science, vol 2196. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44806-3_10

Download citation

  • DOI: https://doi.org/10.1007/3-540-44806-3_10

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-42558-8

  • Online ISBN: 978-3-540-44806-8

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics