Disabling the JIT or AOT compiler

If you suspect that a problem is occurring in the JIT or AOT compiler, disable compilation to see if the problem remains. If the problem still occurs, you know that the compiler is not the cause of it.

About this task

The JIT compiler is enabled by default. The AOT compiler is also enabled by default but is active only when shared classes are enabled (for more information about shared classes, see Introduction to class data sharing in the OpenJ9 user documentation). For efficiency reasons, not all methods in a Java™ application are compiled. The JVM maintains a call count for each method in the application; every time a method is called and interpreted, the call count for that method is incremented. When the count reaches the compilation threshold, the method is compiled and executed natively.

The call count mechanism spreads compilation of methods throughout the life of an application, giving higher priority to methods that are used most frequently. Some infrequently used methods might never be compiled at all. As a result, when a Java program fails, the problem might be in the JIT or AOT compiler or it might be elsewhere in the JVM.

The first step in diagnosing the failure is to determine where the problem is. To do this, you must first run your Java program in purely interpreted mode (that is, with the JIT and AOT compilers disabled).

Procedure

  1. Remove any -Xjit and -Xaot options (and accompanying parameters) from your command line.
  2. Use the -Xint command-line option to disable the JIT and AOT compilers.
    For performance reasons, do not use the -Xint option in a production environment.

What to do next

Running the Java program with the compilation disabled leads to one of the following situations:

  • The failure remains. The problem is not in the JIT or AOT compiler. In some cases, the program might start failing in a different manner; nevertheless, the problem is not related to the compiler.
  • The failure disappears. The problem is most likely in the JIT or AOT compiler.
    If you are not using shared classes, the JIT compiler is at fault. If you are using shared classes, you must determine which compiler is at fault by running your application with only JIT compilation enabled. Run your application with the -Xnoaot option instead of the -Xint option. This leads to one of the following situations:
    • The failure remains. The problem is in the JIT compiler. You can also use the -Xnojit instead of the -Xnoaot option to ensure that only the JIT compiler is at fault.
    • The failure disappears. The problem is in the AOT compiler.