究竟什么-XX:-TieredCompilation呢? [英] What exactly does -XX:-TieredCompilation do?

查看:2134
本文介绍了究竟什么-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

  • level 0 - interpreter
  • level 1 - C1 with full optimization (no profiling)
  • level 2 - C1 with invocation and backedge counters
  • level 3 - C1 with full profiling (level 2 + MDO)
  • level 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 flag还会更改编译器线程的数量,编译策略和默认代码缓存大小。请注意,使用 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倍

  • there will be less compiler threads;
  • simple compilation policy (based on method invocation and backedge counters) will be chosen instead of advanced compilation policy;
  • default reserved code cache size will be 5 times smaller.

要禁用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.

这篇关于究竟什么-XX:-TieredCompilation呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆