JEP 475 : Late Barrier Expansion for G1
Last updated
Last updated
In G1 GC, write barriers are added whenever object fields are updated. These barriers are expanded early by the JIT (C2 compiler), resulting in:
β±οΈ More CPU time spent during compilation
π§ More memory usage by the compiler
π’ Slower startup and warmup, especially in cloud environments
Each G1 barrier becomes 100+ IR nodes and ~50 x86 instructions β per field write!
It delays the expansion of G1 barriers until the last possible moment during JIT compilation.
This gives the compiler a chance to:
π§Ή Eliminate unnecessary barriers
π§ Optimize barrier code better
π Reduce compilation overhead
π Faster warmup and smaller JIT footprint
π» Less CPU & memory overhead from compilation
βοΈ Better fit for short-lived apps, microservices, and containers
"JEP 475 makes the JIT smarter about G1 barriers β reducing JVM overhead without changing your code."