A Pragmatic Approach to Replay Compilation
A Pragmatic Approach to Replay Compilation
01 June 2025
Dynamic compilers generate code based on information provided by a virtual machine (VM). Due to the environment's non-deterministic nature, every compilation result is typically unique. This is a problem when reproducibility is desired, such as when debugging a crash of the JIT compiler, diagnosing performance problems, or in other applications. As a solution, we present a pragmatic approach to replay compilation that is suitable for integration in a production-grade VM. Our approach is based on instrumenting the VM's compiler interface, allowing us to record the compiler's queries and their results to the VM. We serialize them and use them to replicate the compiler's query results in a replayed compilation. Assuming the compiler is deterministic, this approach systematically ensures that the replayed compilation result is equivalent to the recorded one. The dynamic compiler is invoked directly without needing to execute the original application. A compiler developer can replay a compilation with additional diagnostic options or evaluate metrics such as compilation speed. We developed a functional prototype for GraalVM, showing that replay compilation can be implemented without requiring extensive compiler or VM changes. We are working with the GraalVM developers to integrate it into the open-source compiler to unlock these benefits and new use cases for the community.
Venue : MoreVMs workshop co-located with
File Name : replay_compilation_morevms_25.pdf