Profile Image
vishnupriya

What is Java Forced Compilation Mode: -Xcomp?

What is Java Forced Compilation Mode: -Xcomp? Have you used this JVM argument before? What are the pros & cons of using this Java argument? Can you share your perspective/experience in using this JVM argument?

  • jvm-argument

  • xcomp

  • comp

  • Java Forced Compilation Mode

Please Sign In or to post your comment or answer

Profile Image

Pavel Khodakovsky

Usage:


• -Xcomp


Description:


The -Xcomp flag forces Hotspot to compile each method on first invocation,
rather than running the method in interpreted mode until the Just-in-time (JIT)
compiler has produced a native code implementation.


This flag is often used in conjunction with -Xbatch to both force immediate
compilation of every method and also to make that compilation occur in the
foreground thread.


The -Xcomp flag can have a negative impact on the performance of an application.
In normal mode, the JIT compiler can choose to never compile infrequently used
methods, because it would cost more time to compile them than the amortized
time saved by running them in compiled mode. Also in normal mode he JIT
compiler can use profiling data from running a method in interpreted mode to
determine the most optimal way to compile it.
Most applications should therefore avoid using -Xcomp.


Default Value:


-Xcomp is off by default.


Errors:


-Xcomp should not be used with either -Xint or -Xmixed because they are
contradictory. However, no error is thrown if two or more of these options are
used. The last parameter on the command line determines the actual mode used.
For example if the following command is run:
java -Xmixed -Xint -Xcomp
then the JVM shall run in forced-compilation mode.


Arguments Related to -Xcomp:


TODO: link to -Xbatch, -Xint, -Xmixed TODO: link to -XX:CompileThreshold


NOTE:


If you have additional comments, interesting experiences or even point of disagreement with this JVM argument description, please leave a comment. Your
insights will help the entire 10+ million java developer community to develop
one standard source of documentation for all the JVM arguments.

Got something else on mind? Post Your Question

Not the answer you're looking for? Browse other questions tagged
  • jvm-argument

  • xcomp

  • comp

  • Java Forced Compilation Mode