Selectively disabling the JIT compiler

If the failure of your Java™ program appears to come from a problem with the JIT compiler, you can try to narrow down the problem further.

About this task

By default, the JIT compiler optimizes methods at various optimization levels; that is, different selections of optimizations are applied to different methods, based on their call counts. Methods that are called more frequently are optimized at higher levels. By changing JIT compiler parameters, you can control the optimization level at which methods are optimized, and determine whether the optimizer is at fault and, if it is, which optimization is problematic.

You specify JIT parameters as a comma-separated list, appended to the -Xjit option. The syntax is -Xjit:<param1>,<param2>=<value>. For example:
java -Xjit:verbose,optLevel=noOpt HelloWorld
runs the HelloWorld program, enables verbose output from the JIT, and makes the JIT generate native code without performing any optimizations.

Follow these steps to determine which part of the compiler is causing the failure:

Procedure
  1. Set the JIT parameter count=0 to change the compilation threshold to zero. This causes each Java method to be compiled before it is run. Use count=0 only when diagnosing problems because significantly more rarely-called methods are compiled, which uses more computing resources for compilation, slowing down your application. With count=0, your application should fail immediately when the problem area is reached. In some cases, using count=1 can reproduce the failure more reliably.
  2. Add disableInlining to the JIT compiler parameters. disableInlining disables the generation of larger and more complex code. More aggressive optimizations are not performed. If the problem no longer occurs, use -Xjit:disableInlining as a workaround while the Java service team analyzes and fixes the compiler problem.
  3. Decrease the optimization levels by adding the optLevel parameter, and re-run the program until the failure no longer occurs or you reach the "noOpt" level. For a JIT compiler problem, start with "scorching" and work down the list. The optimization levels are, in decreasing order:
    1. scorching
    2. veryHot
    3. hot
    4. warm
    5. cold
    6. noOpt

What to do next

If one of these settings causes your failure to disappear, you have a workaround that you can use while the Java service team analyzes and fixes the compiler problem. If removing disableInlining from the JIT parameter list does not cause the failure to reappear, do so to improve performance. Follow the instructions in Locating the failing method to improve the performance of the workaround.

If the failure still occurs at the "noOpt" optimization level, you must disable the JIT compiler as a workaround.



© Copyright IBM Corporation 2005, 2010. All Rights Reserved.
© Copyright Sun Microsystems, Inc. 1997, 2007, 901 San Antonio Rd., Palo Alto, CA 94303 USA. All rights reserved.
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
This information center is powered by Eclipse technology. (http://www.eclipse.org/)