Implementation of a Java just-in-time compiler in Haskell / von Bernhard Urban
VerfasserUrban, Bernhard
Begutachter / BegutachterinKrall, Andreas
UmfangX, 72 S.
HochschulschriftWien, Techn. Univ., Dipl.-Arb., 2013
Zsfassung in dt. Sprache
Schlagwörter (DE)Just-In-Time Compilation / JVM / LSRA / Haskell / DFA / Backend
Schlagwörter (EN)Just-In-Time Compilation / JVM / LSRA / Haskell / DFA / Backend
URNurn:nbn:at:at-ubtuw:1-56149 Persistent Identifier (URN)
 Das Werk ist frei verfügbar
Implementation of a Java just-in-time compiler in Haskell [0.61 mb]
Zusammenfassung (Englisch)

Just-in-time compilation became popular lately, among others, due to the success of the Java programming language. In this thesis we successfully demonstrate a modern prototype of the Java virtual machine implemented as method-based just-in-time compiler in the purely functional programming language Haskell. Motivated by the powerful abstraction mechanism provided by the language, we were able to build a sophisticated compiler. Since a high-level language is used, we had to solve problems regarding the interface between Haskell and native code.

Existing libraries from the Haskell community are used. hs-java for processing Java class files. Hoopl to implement a sophisticated compiler, that supports data-flow analysis on an intermediate representation by making extensive use of the type system. Harpy is used to generate machine code for the target architecture x86 in the manner of a domain specific language. We tried to keep as much as possible in pure code to gain the elegance of Haskell. The compilation pipeline, e.g. JVM stack elimination or linear scan register allocation, is presented in detail in this thesis.

Basic features of a run-time system in order to complete a JVM, such as method invocation, lazy class loading, dynamic type checking or exception handling, are presented.

Although implemented in Haskell and therefore at a high abstraction level, our prototype performs well. The performance is compared to mainstream JVMs.