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

1

6

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?

Ventriloquism answered 6/7, 2015 at 16:36 Comment(5)
the diagnostic messages of hotspot are described in wikis.oracle.com/display/HotSpotInternals/…. Did you look at this doc?Blacklist
@Blacklist I had already seen that, but unfortunately it did not take me to any conclusion. 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?Ventriloquism
the code is inlined, when it is small and can be replaced rather than doing a call to a function .... please, check ressources about Java Bytecode analysis like this podcast : podcastchart.com/podcasts/webobjects-podcasts/episodes/…Trencher
@LatencyGuy: For me it reads that your method was not inlined because its compiled size exceeds the threshold size of InlineSmallCode. Can you verify this for your method?Blacklist
@Blacklist It was inlined in other places. I see hot (inlined) in the logs but also already compiled into a big method in other places for the same method. Could it be that one of the callers of my method is too big and because of that it is not including my hot method?Ventriloquism
B
8

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.

Blacklist answered 7/7, 2015 at 8:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.