Visit Support

Reducing Uninitialized Deoptimizations

In some applications, uninitialized deoptimizations are common. This problem typically occurs in applications with a warm-up phase that does not compile all the necessary methods. Resolving dependencies in the Java thread as compilation is being scheduled is key. It removes many trapping situations and by combining eager initialization with eager resolution, traps can often be eliminated completely, even for new objects and static field and method access.

Using UseEnhancedClassResolution as a Flag

To reduce uninitialized deoptimizations, Azul Zing Builds of OpenJDK (Zing) provide the flag UseEnhancedClassResolution. This flag reduces uninitialized deoptimizations when the class is already loaded and initialized, but has not been resolved within a particular class

This optimization only applies to allocation sites and might not help applications that are deliberated design to avoid garbage collection.

Using UseEnhancedClassResolution as an Option

The UseEnhancedClassResolution option can be used on per method basis in the CompileCommandFile, but given the low impact on throughput, this is usually unnecessary.

Using EagerInitializeDuringEarlyClassLoading as a Flag

If UseEarlyClassLoading is already being used and UseEnhancedClassResolution failed to reduce uninitialized deoptimizations, using the flag EagerInitializeDuringEarlyClassLoading may help.