Automatic JIT Compiler Generation with Runtime Partial Evaluation
Carl Friedrich Bolz, Volker Aurich, Michaël Leuschel · 2008
Dynamic languages are enjoying increasing popularity recently, due to their power, simplicity and flexibility. However, since many popular dynamic languages are implemented using straightforward interpreters, their performance is not up to par with more static languages. This situation can be improved with just-in-time compilers, but those are hard to implement, hard to maintain and hard to change. Partial evaluation is a technique to make the construction of compilers easier. It can automatically generate a compiler for a certain language, given an interpreter for the same language. Despite considerable apparent promise it has so far failed to make a large impact due to various problems. In addition, it can only be used for ahead-of-time compilation, which does not work well for dynamic languages. In this thesis we explore the use of partial evaluation at runtime for interpreters written in Prolog. For this we wrote a Prolog prototype that performs partial evaluation interleaved with actual program execution. Doing so solves some problems of classical partial evaluation and makes it at the same time applicable to dynamic languages.