Ahead-of-Time compilation in a language-independent environment

Thumbnail Image



Journal Title

Journal ISSN

Volume Title


University of New Brunswick


Language runtime environments provide support for executing high-level programming language functionality. They can be equipped with compilers, which allow accelerating the program execution at the expense of paying the cost of generating machine code. Existing research and industrial grade compilers can be split into two kinds based on their mode of operation. The first kind is known as Just-in-Time (JIT) compilation, generating high-performance native code by using real-time program execution. However, JIT compilers require the program to be running for a sufficiently long time to be able to perform its optimizations. Moreover, the process of compilation must be repeated during every program execution when JIT compilation is used. The second kind of compilation is Ahead-of-Time (AOT) compilation. Ahead-of-Time compilers allow addressing the drawbacks that the JIT compilers have at a cost of producing less optimal code, or extra time spent on compilation before executing the user program. The research on Ahead-of-Time compilers is a well-established research area; there are many implementations of AOT compilers available, including the language-independent AOT compilers like LLVM. This research proposes an infrastructure that can be used for creating AOT compilers as an extension of the Eclipse OMR runtime development toolkit. This infrastructure is used to construct a WebAssembly compiler to evaluate its performance. The results are compared to the performance of Node.js, an industry-quality runtime environment for executing JavaScript and WebAssembly programs. This dissertation showcases the problem of invoking runtime-generated functions from an interpreter, proposes an Eclipse-OMR based solution and compares it to possible alternatives. Another contribution of this research is an algorithm that drives the procedure of making compilation and loading decisions by conducting a run-time program analysis based on the program structure. This algorithm serves as a base for creating compilation scheduling strategies, which allows for partial compilations and reducing the work performed by the compiler within program individual runs. The proposed compilation strategies also allow combining AOT and JIT compilers for program execution optimization. Finally, this dissertation contains an evaluation of execution duration of multiple programs based on the selected heuristic approach to compilation decision and user parameters.