-XX:-TieredCompilation 究竟是做什么的?
使用 java -XX:+PrintFlagsFinal
我找到了 TieredCompilation
标志,并在网上阅读了一下.
Using java -XX:+PrintFlagsFinal
I found the TieredCompilation
flag, and I read about it a bit online.
然而,我仍然不知道确切将它设置为 false
时会发生什么.
Yet, I still don't know exactly what happens when setting it to false
.
我知道编译系统支持5个执行级别,基本上分为解释器、C1和C2:
I know that the compilation system supports 5 execution levels, basically splitted into interpreter, C1 and C2:
- 0 级 - 口译员
- 1 级 - 完全优化的 C1(无分析)
- 2 级 - C1 带调用和后端计数器
- 3 级 - 具有完整分析的 C1(2 级 + MDO)
- 4 级 - C2
来源:http:///hg.openjdk.java.net/jdk8u/jdk8u/hotspot/file/2b2511bd3cc8/src/share/vm/runtime/advancedThresholdPolicy.hpp#l34
两个问题:
(1) 通过设置-XX:-TieredCompilation
,是否只是禁用了某些级别?如果是,是哪个?
(1) By setting -XX:-TieredCompilation
, are some of this levels just disabled? If yes, which?
(2) 是否有一些标志来决定是否禁用 C1 或 C2,或者根本不编译?
(2) Is there some flag to decide whether to disable C1 or C2, or to not compile at all?
推荐答案
-XX:-TieredCompilation
禁用中间编译层(1、2、3),以便解释或编译方法处于最大优化级别 (C2).
-XX:-TieredCompilation
disables intermediate compilation tiers (1, 2, 3), so that a method is either interpreted or compiled at the maximum optimization level (C2).
作为副作用,TieredCompilation
标志还会更改编译器线程的数量、编译策略和默认代码缓存大小.请注意,禁用 TieredCompilation
As a side effect TieredCompilation
flag also changes the number of compiler threads, the compilation policy and the default code cache size. Note that with TieredCompilation
disabled
- 编译器线程会更少;
- 将选择简单的编译策略(基于方法调用和后端计数器)而不是 高级编译策略;
- 默认保留代码缓存大小将为 小 5 倍.
要禁用 C2 编译器并只保留 C1 而没有额外开销,请设置 -XX:TieredStopAtLevel=1
.
To disable C2 compiler and to leave only C1 with no extra overhead, set -XX:TieredStopAtLevel=1
.
要禁用所有 JIT 编译器并在解释器中运行所有内容,请使用 -Xint
.
To disable all JIT compilers and to run everything in interpreter, use -Xint
.
相关文章