Content area
The Java programming language utilizes automatic memory management in the form of garbage collection. The Java Virtual Machine includes many different garbage collector implementations to accommodate different platform and performance requirements. Garbage collectors use a mechanism known as a barrier to synchronize memory accesses of allocated objects. The Java Virtual Machine also performs optimizations during the execution of programs by compiling hot code paths into machine instructions through just-in-time compilation. However, this process creates a noticeable warm-up overhead. To remedy this, much work has been done to compile programs ahead-of-time instead. However, it is unclear what code should be generated for the garbage collector barriers at compile time as the garbage collector is not selected until runtime.
This thesis designs and implements a garbage collector-agnostic write barrier that can be compiled ahead-of-time for the G1, ZGC, Serial, and Parallel garbage collectors for the Java Virtual Machine.
Statistical evaluation of the proposed implementation exhibits minor performance regressions in multiple metrics, such as throughput and p90 latency, across a variety of benchmarks. Analysis also revealed a moderate increase in generated code size.
The results of this work indicate that GC-agnostic write barriers can be implemented in the HotSpot JVM with minimal performance impact in most scenarios, enabling the Java Virtual Machine to move towards ahead-of-time compilation in the future.