Unboxed Compilation of Floating Point Arithmetic in a Dynamically Typed Language Environment
- 188 Downloads
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.
KeywordsBasic Block Single Precision Functional Language Point Arithmetic Point Instruction
Unable to display preview. Download preview PDF.
- 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
- 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
- 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