Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

For the HotSpot JIT, what does "already compiled into a big method" mean?

I am going through the JIT HotSpot compiler logs (-XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining) to make sure an important/hot method is being optimized/compiled. The method shows:

already compiled into a big method

What does that mean? Is my method being correctly optimized/inlined by JIT?

This explanation from the Oracle wiki did not take me to any conclusion:

already compiled into a big method: there is already compiled code for the method that is called from the call site and the code that was generated for is larger than InlineSmallCode

What does that mean? Does it mean my code was optimized/inlined or the HotSpot is now skipping it because it is compiled somewhere else?

like image 290
LatencyGuy Avatar asked Jul 06 '15 16:07

LatencyGuy


1 Answers

Looking at hotspot source (search for "already compiled into a big method") it is clear that the message appears if a candidate method for inlining is already compiled into native code and the native code size exceeds the threshold InlineSmallCode (which is platform dependent and can be set via -XX:InlineSmallCode=n). Therefore this message does not depend on the caller.

How can it be - as you commented - that a method a() is sometimes inlined and sometimes not (with message "already compiled into a big method")?

One possible explanation is that a() calls another method b() and the optimization runs as follows:

  1. calls to a() are inlined
  2. now a() itself is optimized and it inlines the call to b(), making its native code size bigger than InlineSmallCode
  3. subsequent calls to a() are then not inlined

Maybe you can check this theory given your inline logs.

like image 84
wero Avatar answered Sep 19 '22 00:09

wero