Search code examples
javajvmjvm-arguments

What this parameter does "-XX:+UseInterpreter"?


I was wondering what this parameter does -XX:+UseInterpreter, I did some research on the internet and i found that

Use interpreter for non-compiled methods

I just don't understand what this parameter really does, can someone explain to me?


Solution

  • -XX:+UseInterpreter is ON by default, so this option does nothing.

    If you turn it off by -XX:-UseInterpreter, every time a new method is called, it will be added to a compilation queue. This option alone is almost useless. However, it serves as a part of -Xcomp flag, which is basically a shortcut for

    -XX:-UseInterpreter
    -XX:-BackgroundCompilation
    -XX:-ClipInlining
    -XX:Tier3InvokeNotifyFreqLog=0
    -XX:Tier4InvocationThreshold=0
    

    In this case JVM will not run Java methods in interpreter, i.e. methods will be forcibly JIT-compiled before use.