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

  • Tobias Lindahl
  • Konstantinos Sagonas
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2670)


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.


Basic Block Single Precision Functional Language Point Arithmetic Point Instruction 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 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.CrossRefGoogle Scholar
  2. 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.CrossRefGoogle Scholar
  3. 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. 4.
    Intel Corporation. Intel Pentium 4 and Intel Xeon Processor Optimization Reference Manual, 2002. Document number 248966-05.Google Scholar
  5. 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. 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.CrossRefGoogle Scholar
  7. 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. 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. 9.
    X. Leroy. The effectiveness of type-based unboxing. In Workshop Types in Compilation’97, June 1997.Google Scholar
  10. 10.
    A. Leung and L. George. Some notes on the new MLRISC x86 floating point code generator (draft). Unpublished technical report available from:
  11. 11.
    S. S. Muchnick. Advanced Compiler Design & Implementation. Morgan Kaufman Publishers, San Fransisco, CA, 1997.Google Scholar
  12. 12.
    M. Pettersson. A staged tag scheme for Erlang. Technical Report 029, InformationTechnology Department, Uppsala University, Nov. 2000.Google Scholar
  13. 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. 14.
    M. Poletto and V. Sarkar. Linear scan register allocation. ACM Trans. Prog. Lang. Syst., 21(5): 895–913, Sept. 1999.CrossRefGoogle Scholar
  15. 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

Copyright information

© Springer-Verlag Berlin Heidelberg 2003

Authors and Affiliations

  • Tobias Lindahl
    • 1
  • Konstantinos Sagonas
    • 1
  1. 1.Computing Science, Dept. of Information TechnologyUppsala UniversitySweden

Personalised recommendations