-XX:-TieredCompilation 究竟是做什么的?

2023-08-24Java开发问题
5

本文介绍了-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.

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

The End

相关推荐

如何使用 JAVA 向 COM PORT 发送数据?
How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)...
2024-08-25 Java开发问题
21

如何使报表页面方向更改为“rtl"?
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)...
2024-08-25 Java开发问题
19

在 Eclipse 项目中使用西里尔文 .properties 文件
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)...
2024-08-25 Java开发问题
18

有没有办法在 Java 中检测 RTL 语言?
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)...
2024-08-25 Java开发问题
11

如何在 Java 中从 DB 加载资源包消息?
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)...
2024-08-25 Java开发问题
13

如何更改 Java 中的默认语言环境设置以使其保持一致?
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)...
2024-08-25 Java开发问题
13