gpt4 book ai didi

java - 对于 HotSpot JIT, "already compiled into a big method"是什么意思?

转载 作者:搜寻专家 更新时间:2023-11-01 02:23:48 24 4
gpt4 key购买 nike

我正在查看 JIT HotSpot 编译器日志(-XX:+PrintCompilation -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining)以确保正在优化/编译重要/热门方法。方法显示:

already compiled into a big method

这是什么意思? JIT 是否正确优化/内联了我的方法?

来自 Oracle wiki 的解释并没有让我得出任何结论:

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

这是什么意思?这是否意味着我的代码已经过优化/内联,或者 HotSpot 现在正在跳过它,因为它是在其他地方编译的?

最佳答案

查看hotspot source (搜索“already compiled into a big method”)很明显,如果用于内联的候选方法已经编译成 native 代码并且 native 代码大小超过阈值 InlineSmallCode(取决于平台,可以通过-XX:InlineSmallCode=n).因此,此消息不依赖于调用者。

怎么可能 - 正如您评论的那样 - 方法 a() 有时是内联的,有时不是(带有消息“已经编译成一个大方法”)?

一个可能的解释是 a() 调用了另一个方法 b() 并且优化运行如下:

  1. 对 a() 的调用是内联的
  2. 现在 a() 本身已经过优化,它内联了对 b() 的调用,使其 native 代码大小比 InlineSmallCode 更大
  3. 随后对 a() 的调用不会被内联

也许你可以根据你的内联日志来验证这个理论。

关于java - 对于 HotSpot JIT, "already compiled into a big method"是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31251155/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com