gpt4 book ai didi

java - -XX :+PrintCompilation output? 中的这个新列是什么

转载 作者:塔克拉玛干 更新时间:2023-11-03 04:15:01 25 4
gpt4 key购买 nike

最近在使用 -XX:+PrintCompilation (JDK 8r111) 检查方法编译时,我注意到一个新列没有出现在 documentation 中。我可以find关于主题:

          this column
|
|
v
600 1 s 3 java.util.Hashtable::get (69 bytes)
601 4 3 java.lang.Character::toLowerCase (6 bytes)
601 8 3 java.io.UnixFileSystem::normalize (75 bytes)
602 12 3 java.lang.ThreadLocal::get (38 bytes)
602 14 3 java.lang.ThreadLocal$ThreadLocalMap::getEntry (42 bytes)
602 18 2 java.lang.String::startsWith (72 bytes)
602 10 4 java.lang.String::equals (81 bytes)
602 2 % 4 java.lang.String::hashCode @ 24 (55 bytes)
602 16 s! 3 sun.misc.URLClassPath::getLoader (197 bytes)
603 23 n 0 java.lang.System::arraycopy (native) (static)
604 27 n 0 sun.misc.Unsafe::getObjectVolatile (native)

知道这是什么意思吗?它似乎在 0 和 3 之间变化,本地方法始终为 0,而其他方法始终为非零。

最佳答案

这是分层编译模式下的

  • 在第 1、2、3 层,代码由 C1 编译,具有不同数量的额外分析。这听起来可能违反直觉,但其中最优化的是第 1 层,因为它没有分析开销(也没有机会进一步优化)。
  • 在第 4 层,代码由 C2 编译。要生成高度优化的代码,C2 需要在第 3 层或解释期间收集执行统计信息。

这是分层编译流程的样子。您可以在 this answer 中找到解释。 .

HotSpot Tiered Compilation

更多详细信息可以在 HotSpot source code comments 中找到,它定义了如下级别:

  • 0 级 - 口译员
  • 1 级 - 完全优化的 C1(无分析)
  • 2 级 - 具有调用和后台计数器的 C1
  • 3 级 - 具有完整分析的 C1(2 级 + MDO)
  • 4 级 - C2

关于java - -XX :+PrintCompilation output? 中的这个新列是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41134037/

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