A Lightweight Method for Generating Multi-Tier JIT Compilation Virtual Machine in a Meta-Tracing Compiler Framework (Extended Version)

Yusuke Izawa, Hidehiko Masuhara, Carl Friedrich Bolz-Tereick · 2025

Read A Lightweight Method for Generating Multi-Tier JIT Compilation Virtual Machine in a Meta-Tracing Compiler Framework (Extended Version) by Yusuke Izawa, Hidehiko Masuhara, Carl Friedrich Bolz-Tereick (2025) in the Tower of Babel, a free online library of public-domain works preserved in clean, searchable text. No sign-up. The full text is served as a plain-text file at a predictable URL, where text is present: https://antarctic-labs.com/tower-of-babel/arxiv-2504-17460.txt.

Introduction

Izawa, Masuhara, and Bolz-Tereick add multi tier compilation to virtual machines generated by meta compiler frameworks. Such frameworks build fast language runtimes from interpreter definitions, yet they lack the staged compilation that hand built runtimes use to balance startup speed and peak speed. Their 2025 method avoids rebuilding the compiler back end.

Instead, it steers the existing heavy optimizing compiler to emit quick, plain code early, driven by directives planted in the interpreter definition. A test machine with two tiers starts with a threaded code generator, then hands hot loops to the tracing compiler. On a realistic workload, warm up improved by fifteen percent while peak speed fell only five percent. The authors call the approach lightweight.

Catalog record

CREATORYusuke Izawa, Hidehiko Masuhara, Carl Friedrich Bolz-Tereick
YEAR2025
COLLECTIONPAPERS
FORMATTXT
FILE SIZE84 KB
VERSION1.0
LICENSEhttp://creativecommons.org/licenses/by/4.0/
RIGHTSCC BY
SOURCEarXiv

Source: https://arxiv.org/abs/2504-17460

Browse the full library · About the Tower of Babel

Full text

The opening of the work, from the library's hosted text:

A Lightweight Method for Generating Multi-Tier JIT Compilation Virtual Machine in a Meta-Tracing Compiler Framework (Extended Version) Yusuke Izawa, Hidehiko Masuhara, Carl Friedrich Bolz-Tereick Abstract Meta-compiler frameworks, such as RPython and Graal/Truffle, generate high-performance virtual machines (VMs) from interpreter definitions. Although they generate VMs with high-quality just-in-time (JIT) compilers, they still lack an important feature that dedicated VMs (i.e., VMs that are developed for specific languages) have, namely multi-tier compilation . Multi-tier compilation uses light-weight compilers at early stages and highly optimizing compilers at later stages in order to balance between compilation overheads and code quality. We propose a novel approach to enabling multi-tier compilation in the VMs generated by a meta-compiler framework. Instead of extending the JIT compiler backend of the framework, our approach drives an existing (heavyweight) compiler backend in the framework to quickly generate unoptimized native code by merely embedding directives and compile-time operations into interpreter definitions. As a validation of the approach, we developed 2SOM, a Simple Object Machine with a two-tier JIT compiler based on RPython. 2SOM first applies the tier-1 threaded code generator that is generated by our proposed technique, then, to the loops that exceed a threshold, applies the tier-2 tracing JIT compiler that is generated by the original RPython framework. Our performance evaluation that runs a program with a realistic workload showed that 2SOM improved, when compared against an RPython-based VM, warm-up performance by 15%, with merely a 5% reduction in peak performance. Tokyo Metropolitan University, Japan [email protected] https://orcid.org/0009-0005-4170-9977 Institute of Science Tokyo, Japan [email protected] https://orcid.org/0000-0002-8837-5303 Heinrich-Heine-Universität Düsseldorf, Germany [email protected] https://orcid.org/0000-0003-4562-1356 {CCSXML} ¡ccs2012¿ ¡concept¿ ¡concept_id¿10011007.10010940.10010941.10010942.10010943¡/concept_id¿ ¡concept_desc¿Software and its engineering Interpreters¡/concept_desc¿ ¡concept_significance¿500¡/concept_significance¿ ¡/concept¿ ¡concept¿ ¡concept_id¿10011007.10011006.10011041.10011044¡/concept_id¿ ¡concept_desc¿Software and its engineering Just-in-time compilers¡/concept_desc¿ ¡concept_significance¿500¡/concept_significance¿ ¡/concept¿ ¡/ccs2012¿ We would like to thank Stefan Marr for his valuable advice on the measurement methodology and the evaluation results of 2SOM. We are also grateful to the anonymous reviewers for their insightful comments, which helped improve this manuscript. ccs Software and its engineering Interpreters ccs Software and its engineering Just-in-time compilers keywords virtual machine, JIT compiler, multi-tier JIT compiler, meta-tracing JIT compiler, RPython † † runningtitle: A Lightweight Method for Generating Multi-Tier JIT Compilation VM in a .. † † runningauthor: Y.Izawa et al. † † copyright: Yusuke Izawa, Hidehiko Masuhara, and Carl Friedrich Bolz-Tereick † † supplement: Software: https://doi.org/10.5281/zenodo.15286979 † † supplement: Software: https://doi.org/10.5281/zenodo.15286954 † † supplement: Software: https://doi.org/10.5281/zenodo.15287001 † † funding: This research was supported by KAKENHI grant nos. 25K21180, 24K23866, 23H03368, and 23K28058, and JST ACT-X grant no. JPMJAX2003. † † editors: Jonathan Aldrich and Alexandra Silva † † event-title: 39th European Conference on Object-Oriented Programming (ECOOP 2025) † † event-shorttitle: ECOOP 2025 † † event-acronym: ECOOP † † year: 2025 † † event-date: June 30–July 2, 2025 † † event-location: Bergen, Norway † † series-volume: 333 † † articleno: 8 1 Introduction A meta-compiler framework [ 7 , 38 ] is a system that generates high-performance virtual machines (VMs) from interpreter definitions. Traditionally, VMs were manually implemented by VM developers from scratch, including interpreters, just-in-time (JIT) compilers, and garbage collectors. However, by using a meta-compiler framework, it is possible to generate a VM of comparable quality to traditional VMs simply by defining the interpreter. Currently, there are two frameworks in this domain: RPython [ 6 ] and Graal/Truffle [ 39 ] . These frameworks have demonstrated their practical effectiveness by generating high-performance VMs such as PyPy [ 36 ] , Pycket [ 33 ] , TruffleSqueak [ 31 ] , and TruffleRuby [ 38 ] . Given the importance of multi-tier JIT compilation VMs, efforts have been made with Graal/Truffle to enable a meta-compiler framework to perform multi-tier JIT compilation [ 35 ] . The multi-tier JIT compilation VM has multiple execution tiers using different compilation methods or optimization levels to balance code quality and compilation time [ 1 ] . In Graal/Truffle’s methodology, a single JIT backend is used, and first-tier and second-tier compilations are achieved by gradually enabling or disabling optimizations. However, it has not yet achieved the incorporation of tiers with fundamentally different compilation methods, as has been done in traditional VMs. Furthermore, as with traditional VMs, enabling a meta-compiler framework to generate a multi-tier JIT compilation VM requires a significant development effort. In traditional VMs, developing a multi-tier JIT compilation VM is more complex than simply implementing multiple compilers. At the least, a VM developer develops multiple compilers with different compilation behaviors—a compiler for rapid compilation speed but generating code with moderate quality, and a compiler for generating quality code—plus a profiler to gather runtime information for switching between different compilers, and a mechanism to transition between code generated by different compilers. Therefore, a framework developer needs to implement these components at the level of a meta-compiler framework. To address the implementation cost, we propose a novel methodology that enables a meta-compiler framework to generate a multi-tier JIT compilation VM without requiring the development of new JIT compilation backends. Our methodology treats interpreter definitions not only as semantic specifications of the source language but also as specifications of compilation strategies of the meta-compiler. Under our methodology, a VM developer provides interpreter definitions for each compilation tier. Then, RPython can automatically generate the necessary components for multi-tier JIT compilation. Specifically, the proposed methodology: (Multiple compilers:) generates a lightweight compiler for rapid code generation during the warm-up phase of a source program, and a heavyweight compiler for optimizing the hot spots of a source program, (Profiling mechanism:) generates profiling code fragments that dynamically identify hot spots and trigger tier transitions, and (Transition mechanism:) switches between code generated by different compilers. To validate our methodology, we implemented a two-level Simple Object Machine, which we call 2SOM for short, on top of the RPython framework. 2SOM is an extended version of PySOM [ 27 ] that is an implementation of Simple Object Machine [ 19 ] by RPython. 2SOM has two JIT compilers: (Tier-1:) A threaded code generator, which quickly generates subroutine-threaded code for frequently invoked methods. The threaded code generator is generated by using the RPython’s mechanism based on the seminal ideas of Izawa et al. [ 25 ] along with several techniques proposed in this paper to make it practical. (Tier-2:) A tracing JIT compiler, which is generated by RPython [ 6 , 16 , 17 ] and compiles traces with aggressive optimizations to frequently executed loops in the threaded code. Our approach effectively enables multi-tier JIT compilation for meta-compiler frameworks. Although this paper demonstrates an application to SOM, the proposed approach should also be applicable to other RPython-based language implementations. To evaluate the effectiveness of the proposed approach, we analyzed the performance of 2SOM with respect to (1) improvement of the warm-up performance for a realistic workload, (2) degradation of peak performance, and (3) quality of the threaded code generator. Our evaluation demonstrates that (1) two-level compilation runs about 15% faster than tracing JIT-only compilation, (2) the degradation is up to about 5% compared to tracing JIT-only compilation, and (3) our contribution improves the code quality of about 10% compared to interpreter execution. This paper makes the following contributions: • A novel approach for creating a multi-tier JIT compilation VM using the RPython framework by extending interpreter definitions. • The optimization of

Read the complete text