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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
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.
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.
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.
Intel Corporation. Intel Pentium 4 and Intel Xeon Processor Optimization Reference Manual, 2002. Document number 248966-05.
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.
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.
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.
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.
X. Leroy. The effectiveness of type-based unboxing. In Workshop Types in Compilation’97, June 1997.
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/.
S. S. Muchnick. Advanced Compiler Design & Implementation. Morgan Kaufman Publishers, San Fransisco, CA, 1997.
M. Pettersson. A staged tag scheme for Erlang. Technical Report 029, InformationTechnology Department, Uppsala University, Nov. 2000.
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.
M. Poletto and V. Sarkar. Linear scan register allocation. ACM Trans. Prog. Lang. Syst., 21(5): 895–913, Sept. 1999.
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.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights 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