Implementing a Java JIT compiler in Haskell: case study

  • Authors:
  • Bernhard Urban;Harald Steinlechner

  • Affiliations:
  • Johannes Kepler University, Austria;Vienna University of Technology

  • Venue:
  • Proceedings of the 2013 International Conference on Principles and Practices of Programming on the Java Platform: Virtual Machines, Languages, and Tools
  • Year:
  • 2013

Quantified Score

Hi-index 0.00

Visualization

Abstract

We present a JVM prototype implemented in the purely-functional language Haskell. It exploits several features of the language, such as strong static typing to implement an intermediate representation, and abstraction mechanism to express machine code generation in the manner of a domain specific language. The compiler consists of (i) a pass to transform Java bytecode to a register-based intermediate representation, (ii) application of an existing data-flow analysis framework to our intermediate representation and (iii) machine code generation that targets the x86 architecture. The implementation follows a compile-only approach. To implement certain Java features efficiently, code patching is used. Various code samples demonstrate the elegance of our prototype. Results prove reasonable performance compared to real-world implementations.