What is the size of the methods that JIT automatically embeds?

I heard that JIT automatically includes small methods like getters (they have about 5 bytes). What is the border? Is there any JVM flag?

+5
source share
2 answers

The HotSpot JIT installation policy is rather complicated. It includes many heuristics, such as caller method size, caller method size, number of IR node, depth of depth, number of calls, number of call sites, number of throws, method signatures, etc.

Some restrictions are skipped for accessors (getters / seters) and for trivial methods (the number of bytecodes is less than 6).

The related source code is mainly located in bytecodeInfo.cpp .
See InlineTree::try_to_inline Functions InlineTree::try_to_inline , should_inline , should_not_inline .

The main JVM flags for managing inlining are

 -XX:MaxInlineLevel (maximum number of nested calls that are inlined) -XX:MaxInlineSize (maximum bytecode size of a method to be inlined) -XX:FreqInlineSize (maximum bytecode size of a frequent method to be inlined) -XX:MaxTrivialSize (maximum bytecode size of a trivial method to be inlined) -XX:MinInliningThreshold (min. invocation count a method needs to have to be inlined) -XX:LiveNodeCountInliningCutoff (max number of live nodes in a method) 
+10
source

https://docs.oracle.com/javase/8/embedded/develop-apps-platforms/codecache.htm#BABGGHJE

MaxInlineSize

Default: 35

The maximum bytecode size of the method to be embedded

See Java HotSpot VM Settings for JDK 7 and earlier.

+3
source

Source: https://habr.com/ru/post/1246981/


All Articles