Skip to main content

Unboxed Compilation of Floating Point Arithmetic in a Dynamically Typed Language Environment

  • Conference paper
  • First Online:
  • 254 Accesses

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

Abstract

In the context of the dynamically typed concurrent functional programming language Erlang, we describe a simple static analysis for identifying variables containing floating point numbers, how this information is used by the BEAM compiler, and a scheme for efficient (just-in-time) compilation of floating point bytecode instructions to native code. The attractiveness of the scheme lies in its implementation simplicity. It has been fully incorporated in Erlang/OTP R9, and improves the performance of Erlang programs manipulating floats considerably. We also show that by using this scheme, Erlang/OTP, despite being an implementation of a dynamically typed language, achieves performance which is competitive with that of state-of-the-art implementations of strongly typed strict functional languages on floating point intensive programs.

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. R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Trans. Prog. Lang. Syst., 13(4):451–490, Oct. 1991.

    Article  Google Scholar 

  2. P. H. Hartel et al. Benchmarking imlementations of functional languages with “pseudoknot”, a float intensive program. Journal of Functional Programming, 6(4):621–655, July 1996.

    Article  Google Scholar 

  3. F. Henglein and J. Jørgensen. Formally optimal boxing. In Conference Record of the ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 213–226. ACM Press, Jan. 1994.

    Google Scholar 

  4. Intel Corporation. Intel Pentium 4 and Intel Xeon Processor Optimization Reference Manual, 2002. Document number 248966-05.

    Google Scholar 

  5. E. Johansson, M. Pettersson, and K. Sagonas. HiPE: A High Performance Erlang system. In Proceedings of the ACM SIGPLAN Conference on Principles and Practice of Declarative Programming, pages 32–43. ACM Press, Sept. 2000.

    Google Scholar 

  6. E. Johansson and K. Sagonas. Linear scan register allocation in a high performance Erlang compiler. In Practical Applications of Declarative Languages: Proceedings of the PADL’2002 Symposium, number 2257 in LNCS, pages 299–317. Springer, Jan. 2002.

    Chapter  Google Scholar 

  7. S. L. P. Jones and J. Launchbury. Unboxed values as first class citizens in a non-strict functional language. In J. Hughes, editor, Proceedings of the 5th ACM Conference on Functional Languages and Computer Architecture, number 523 in LNCS, pages 636–666. Springer, Aug. 1991.

    Google Scholar 

  8. X. Leroy. Unboxed values and polymorphic typing. In Conference Record of the Nineteenth Annual ACM Symposium on Principles of Programming Languages, pages 177–188. ACM Press, Jan. 1992.

    Google Scholar 

  9. X. Leroy. The effectiveness of type-based unboxing. In Workshop Types in Compilation’97, June 1997.

    Google Scholar 

  10. A. Leung and L. George. Some notes on the new MLRISC x86 floating point code generator (draft). Unpublished technical report available from: http://cm.bell-labs.com/cm/cs/what/smlnj/compiler-notes/.

  11. S. S. Muchnick. Advanced Compiler Design & Implementation. Morgan Kaufman Publishers, San Fransisco, CA, 1997.

    Google Scholar 

  12. M. Pettersson. A staged tag scheme for Erlang. Technical Report 029, InformationTechnology Department, Uppsala University, Nov. 2000.

    Google Scholar 

  13. M. Pettersson, K. Sagonas, and E. Johansson. The HiPE/x86 Erlang compiler: System description and performance evaluation. In Z. Hu and M. Rodríguez-Artalejo, editors, Proceedings of the Sixth International Symposium on Functional and Logic Programming, number 2441 in LNCS, pages 228–244. Springer, Sept. 2002.

    Google Scholar 

  14. M. Poletto and V. Sarkar. Linear scan register allocation. ACM Trans. Prog. Lang. Syst., 21(5): 895–913, Sept. 1999.

    Article  Google Scholar 

  15. Z. Shao and A. W. Appel. A type-based compiler for Standard ML. In Proceedings of the ACM SIGPLAN’ 95 Conference on Programming Language Design and Implementation, pages 116–129. ACM Press, June 1995.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2003 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Lindahl, T., Sagonas, K. (2003). Unboxed Compilation of Floating Point Arithmetic in a Dynamically Typed Language Environment. In: Peña, R., Arts, T. (eds) Implementation of Functional Languages. IFL 2002. Lecture Notes in Computer Science, vol 2670. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-44854-3_9

Download citation

  • DOI: https://doi.org/10.1007/3-540-44854-3_9

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-40190-2

  • Online ISBN: 978-3-540-44854-9

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics