skip to main content
10.1145/3310232.3310234acmotherconferencesArticle/Chapter ViewAbstractPublication PagesiflConference Proceedingsconference-collections
research-article

HiPErJiT: A Profile-Driven Just-in-Time Compiler for Erlang

Published: 05 September 2018 Publication History

Abstract

We introduce HiPErJiT, a profile-driven Just-in-Time compiler for the BEAM ecosystem based on HiPE, the High Performance Erlang compiler. HiPErJiT uses runtime profiling to decide which modules to compile to native code and which of their functions to inline and type-specialize. HiPErJiT is integrated with the runtime system of Erlang/OTP and preserves aspects of Erlang's compilation which are crucial for its applications: most notably, tail-call optimization and hot code loading at the module level. We present HiPErJiT's architecture, describe the optimizations that it performs, and compare its performance with BEAM, HiPE, and Pyrlang. HiPErJiT offers performance which is about two times faster than BEAM and almost as fast as HiPE, despite the profiling and compilation overhead that it has to pay compared to an ahead-of-time native code compiler. But there also exist programs for which HiPErJiT's profile-driven optimizations allow it to surpass HiPE's performance.

References

[1]
Matthew Arnold, Stephen Fink, David Grove, Michael Hind, and Peter F Sweeney. 2000. Adaptive Optimization in the Jalapeño JVM. In Proceedings of the 15th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (OOPSLA '00). ACM, New York, NY, USA, 47--65.
[2]
Stavros Aronis and Konstantinos Sagonas. 2013. On Using Erlang for Parallelization --- Experience from Parallelizing Dialyzer. In Trends in Functional Programming, 13th International Symposium, TFP 2012, Revised Selected Papers (LNCS), Vol. 7829. Springer, 295--310.
[3]
John Aycock. 2003. A Brief History of Just-in-time. ACM Comput. Surv. 35, 2 (2003), 97--113.
[4]
Andrew Ayers, Richard Schooler, and Robert Gottlieb. 1997. Aggressive Inlining. In Proceedings of the ACM SIGPLAN 1997 Conference on Programming Language Design and Implementation (PLDI '97). ACM, New York, NY, USA, 134--145.
[5]
Carl Friedrich Bolz, Antonio Cuni, Maciej Fijalkowski, and Armin Rigo. 2009. Tracing the Meta-level: PyPy's Tracing JIT Compiler. In Proceedings of the 4th Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS '09). ACM, New York, NY, USA, 18--25.
[6]
Frej Drejhammar and Lars Rasmusson. 2014. BEAMJIT: A Just-in-time Compiling Runtime for Erlang. In Proceedings of the Thirteenth ACM SIGPLAN Workshop on Erlang (Erlang '14). ACM, New York, NY, USA, 61--72.
[7]
Brian Grant, Matthai Philipose, Markus Mock, Craig Chambers, and Susan J Eggers. 1999. An Evaluation of Staged Run-time Optimizations in DyC. In Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation (PLDI '99). ACM, New York, NY, USA, 293--304.
[8]
Mor Harchol-Balter and Allen B Downey. 1997. Exploiting Process Lifetime Distributions for Dynamic Load Balancing. ACM Trans. Comput. Syst. 15, 3 (1997), 253--285.
[9]
Kim Hazelwood and David Grove. 2003. Adaptive Online Context-sensitive Inlining. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization (CGO '03). IEEE Computer Society, Washington, DC, USA, 253--264. http://dl.acm.org/citation.cfm?id=776261.776289
[10]
Urs Hölzle and David Ungar. 1994. Optimizing Dynamically-dispatched Calls with Run-time Type Feedback. In Proceedings of the ACM SIGPLAN 1994 Conference on Programming Language Design and Implementation (PLDI '94). ACM, New York, NY, USA, 326--336.
[11]
Ruochen Huang, Hidehiko Masuhara, and Tomoyuki Aotani. 2016. Improving Sequential Performance of Erlang Based on a Meta-tracing Just-In-Time Compiler. In Post-Proceeding of the 17th Symposium on Trends in Functional Programming. https://tfp2016.org/papers/TFP{_}2016{_}paper{_}16.pdf
[12]
Erik Johansson and Christer Jonsson. 1996. Native Code Compilation for Erlang. Technical Report. Computing Science Department, Uppsala University.
[13]
Erik Johansson, Mikael Pettersson, and Konstantinos Sagonas. 2000. A High Performance Erlang System. In Proceedings of the 2nd ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP '00). ACM, New York, NY, USA, 32--43.
[14]
Madhukar N Kedlaya, Jared Roesch, Behnam Robatmili, Mehrdad Reshadi, and Ben Hardekopf. 2013. Improved Type Specialization for Dynamic Scripting Languages. In Proceedings of the 9th Symposium on Dynamic Languages (DLS '13). ACM, New York, NY, USA, 37--48.
[15]
Chris Lattner and Vikram Adve. 2004. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization (CGO '04). IEEE Computer Society, Washington, DC, USA, 75---. http://dl.acm.org/citation.cfm?id=977395.977673
[16]
Tobias Lindahl and Konstantinos Sagonas. 2003. Unboxed Compilation of Floating Point Arithmetic in a Dynamically Typed Language Environment. In Proceedings of the 14th International Conference on Implementation of Functional Languages (IFL'02). Springer Berlin Heidelberg, Berlin, Heidelberg, 134--149. http://dl.acm.org/citation.cfm?id=1756972.1756981
[17]
Tobias Lindahl and Konstantinos Sagonas. 2004. Detecting Software Defects in Telecom Applications Through Lightweight Static Analysis: A War Story. In Programming Languages and Systems: Second Asian Symposium, APLAS 2004, Taipei, Taiwan, November 4--6, 2004. Proceedings, Wei-Ngan Chin (Ed.). Springer-Verlag, Berlin, Heidelberg, 91--106.
[18]
Tobias Lindahl and Konstantinos Sagonas. 2005. TypEr: A Type Annotator of Erlang Code. In Proceedings of the 2005 ACM SIGPLAN Workshop on Erlang (Erlang '05). ACM, New York, NY, USA, 17--25.
[19]
Tobias Lindahl and Konstantinos Sagonas. 2006. Practical Type Inference Based on Success Typings. In Proceedings of the 8th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP '06). ACM, New York, NY, USA, 167--178.
[20]
Daniel Luna, Mikael Pettersson, and Konstantinos Sagonas. 2004. HiPE on AMD64. In Proceedings of the 2004 ACM SIGPLAN Workshop on Erlang. ACM, New York, NY, USA, 38--47.
[21]
Mikael Pettersson, Konstantinos Sagonas, and Erik Johansson. 2002. The HiPE/x86 Erlang Compiler: System Description and Performance Evaluation. In Functional and Logic Programming, 6th International Symposium, FLOPS 2002, Proceedings (LNCS), Vol. 2441. Springer, Berlin, Heidelberg, 228--244.
[22]
Simon Peyton Jones and Simon Marlow. 2002. Secrets of the Glasgow Haskell Compiler Inliner. J. Funct. Program. 12, 5 (2002), 393--434.
[23]
Konstantinos Sagonas, Mikael Pettersson, Richard Carlsson, Per Gustafsson, and Tobias Lindahl. 2003. All You Wanted to Know About the HiPE Compiler: (but Might Have Been Afraid to Ask). In Proceedings of the 2003 ACM SIGPLAN Workshop on Erlang (Erlang '03). ACM, New York, NY, USA, 36--42.
[24]
Konstantinos Sagonas, Chris Stavrakakis, and Yiannis Tsiouris. 2012. ErLLVM: an LLVM Backend for Erlang. In Proceedings of the Eleventh ACM SIGPLAN Workshop on Erlang Workshop. ACM, New York, NY, USA, 21--32.
[25]
Andre Santos. 1995. Compilation by transformation for non-strict functional languages. Ph.D. Dissertation. University of Glasgow, Scotland. https://www.microsoft.com/en-us/research/publication/compilation-transformation-non-strict-functional-languages/
[26]
Manuel Serrano. 1997. Inline expansion: When and how?. In Programming Languages: Implementations, Logics, and Programs: 9th International Symposium, PLILP '97 Including a Special Track on Declarative Programming Languages in Education Southampton, UK, September 3--5, 1997 Proceedings. Springer Berlin Heidelberg, Berlin, Heidelberg, 143--157.
[27]
Toshio Suganuma, Toshiaki Yasue, and Toshio Nakatani. 2002. An Empirical Study of Method In-lining for a Java Just-in-Time Compiler. In Proceedings of the 2nd Java Virtual Machine Research and Technology Symposium. USENIX Association, Berkeley, CA, USA, 91--104. http://dl.acm.org/citation.cfm?id=648042.744889
[28]
Oscar Waddell and R Kent Dybvig. 1997. Fast and effective procedure inlining. In Static Analysis, Pascal Van Hentenryck (Ed.). Springer Berlin Heidelberg, Berlin, Heidelberg, 35--52.

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
IFL '18: Proceedings of the 30th Symposium on Implementation and Application of Functional Languages
September 2018
143 pages
ISBN:9781450371438
DOI:10.1145/3310232
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 05 September 2018

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Erlang
  2. HiPE
  3. Just-in-Time compilation
  4. profile-driven optimization

Qualifiers

  • Research-article
  • Research
  • Refereed limited

Conference

IFL 2018

Acceptance Rates

Overall Acceptance Rate 19 of 36 submissions, 53%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • 0
    Total Citations
  • 90
    Total Downloads
  • Downloads (Last 12 months)9
  • Downloads (Last 6 weeks)1
Reflects downloads up to 02 Mar 2025

Other Metrics

Citations

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media