且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

HotSpot JIT内联策略:自上而下或下至上

更新时间:2023-09-24 23:52:34

MaxInlineSize 会影响至少执行一次但小于 MinInliningThreshold 次数的方法的编译。对于执行超过 MinInliningThreshold 的方法,有一个不同的设置 -XX:FreqInlineSize = ... 具有更大的(平台相关) ) 默认值。无论 MaxInlineSize ,热点仍然是内联的。您可以通过运行带有 -XX的应用程序来测试它:+ UnlockDiagnosticVMOptions -XX:+ PrintInlining -XX:MaxInlineSize = 0 。它仍将报告热点的内联(这些与评论(热))。只有先前报告的方法与评论已执行< MinInliningThreshold时间可能会使评论太大。如果您设置 FreqInlineSize ,您可能会收到hot method too big之类的评论。我从未在默认设置下看到它们。

The MaxInlineSize affects compilations of methods executed at least one time but less than MinInliningThreshold times only. For methods executed more than MinInliningThreshold there is a different setting -XX:FreqInlineSize=… having a far bigger (platform dependent) default value. Hotspots are still inlined regardless of the MaxInlineSize. You may test it by running an application with -XX:+UnlockDiagnosticVMOptions -XX:+PrintInlining -XX:MaxInlineSize=0. It will still report inlining of hot spots (these with the comment "(hot)"). Only methods formerly reported as inlined with the comment "executed < MinInliningThreshold times" might then get the comment to "too big". If you set down the FreqInlineSize you might receive comments like "hot method too big". I never saw them with the default setting.