An improved MicroJIT for templated compilation in OpenJ9

Loading...
Thumbnail Image

Date

2025-03

Journal Title

Journal ISSN

Volume Title

Publisher

University of New Brunswick

Abstract

Programs that run on a Java virtual machine (JVM) are initially interpreted. To improve performance, Just-in-Time (JIT) compilers may be employed at run time to translate the program to native code that can be executed directly. In certain environments, the overhead of an optimizing compiler may be too high to be useful, and a non-optimizing compiler could improve performance over interpreted-only mode with limited overhead, memory footprint and compile times. Furthermore, adding a non-optimizing compiler between the interpreter and an optimizing compiler may reduce warm-up times. This is achieved by performing lightweight, template-based compilations to generate native code that runs faster than interpreting the source code, but slower than the optimized code generated by a full JIT compilation. This work proposes an improved compiler for template-based compilations and evaluates its effectiveness. The aim is to reduce the overhead associated with compiling methods and improving the overall runtime performance. The specific improvements include improving bytecode coverage, supporting static and special methods, handling polymorphism in a template-based compiler and incorporating exception handling. The Eclipse OpenJ9 implementation of the JVM is used as a proof-of-concept to illustrate the solution, coined as MicroJIT. Improving bytecode coverage will allow compiling more methods with MicroJIT, leading to early switching from interpreted to compiled code. The static, special and polymorphic methods are executed using method invocation bytecodes in Java. The method invocation bytecodes provide powerful capabilities for the Java platform and JVM languages. With support missing for these vital reference bytecodes, the initial MicroJIT implementation signals compilation failure when it encounters an unsupported bytecode. Exception handling helps maintain the normal desired flow in case of unexpected events. A thorough performance testing of MicroJIT was carried out to understand its effectiveness, limitations, performance discrepancies and necessary improvements to combat those. The evaluation reveals promising results, showcasing notable performance gains in terms of reduced compilation times and memory footprint, faster warm-up and improved overall execution efficiency. In terms of average execution times, MicroJIT achieves 35%, 3% and 13% gains over the no-optimizing compiler, default compiler run at MicroJIT invocation threshold and quickstart configuration respectively.

Description

Keywords

Citation