java – JIT自动内联的方法大小是多少?

我听说JIT自动内联小方法,比如getter(它们大约有5个字节).边界是什么?有没有JVM标志?

解决方法

HotSpot JIT内联策略相当复杂.它涉及许多启发式方法,如调用方法大小,被调用方法大小,IR节点计数,内联深度,调用计数,调用站点计数,投掷计数,方法签名等.

对于访问器方法(getter / setter)和普通方法(字节码计数小于6),会跳过某些限制.

相关的源代码大多在bytecodeInfo.cpp.
请参阅InlineTree :: try_to_inline,should_inline,should_not_inline函数.

用于控制内联的主要JVM标志是

-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)

相关文章

最近看了一下学习资料,感觉进制转换其实还是挺有意思的,尤...
/*HashSet 基本操作 * --set:元素是无序的,存入和取出顺序不...
/*list 基本操作 * * List a=new List(); * 增 * a.add(inde...
/* * 内部类 * */ 1 class OutClass{ 2 //定义外部类的成员变...
集合的操作Iterator、Collection、Set和HashSet关系Iterator...
接口中常量的修饰关键字:public,static,final(常量)函数...