Haskell’s use of lazy evaluation and type classes has endowed it with enhanced expressiveness, but also poses difficult challenges for compiler writers if high performance is a requirement. Most research so far has used static compilation techniques to solve these issues.
In this work, we argue that an implementation based on a virtual machine with a dynamic optimizer based on trace-compilation may be able to remove Haskell’s execution overheads with similar efficacy. This could improve on static techniques in the following ways: (1) more predictable optimization in hot spots, (2) cross-module optimization while retaining binary compatibility, and (3) no need to compile multiple module variants for profiling or debugging.
We present a work-in-progress prototype that implements a trace-based just-in-time compiler for Haskell and identify the missing pieces of the puzzle required to achieve an implementation that can be competitive with state of the art ahead-of-time Haskell compilers.