JVM 中 _all_dependency_are_recorded 标志的用途是什么

问题描述 投票:0回答:1

是下面的评论,但是我找不到这个flag的任何用法

  // Flag to indicate if the compiler has recorded all dependencies. When the
  // can_redefine_classes capability is enabled in the OnLoad phase then the compiler
  // records all dependencies from startup. However if the capability is first
  // enabled some time later then the dependencies recorded by the compiler
  // are incomplete. This flag is used by RedefineClasses to know if the
  // dependency information is complete or not.
  static bool _all_dependencies_are_recorded;

搜索了jvm代码库,但什么也没找到

jvm
1个回答
0
投票

如引用注释中所写,该标志用于确定

RedefineClasses
是否需要仅对依赖于重新定义的类的编译方法进行去优化(如果是
_all_dependencies_are_recorded == true
),或者对所有已编译方法进行去优化(如果不是所有 nmethod 依赖项)已记录)。

VM_RedefineClasses::flush_dependent_code:

中检查该标志
  // This is the first redefinition, mark all the nmethods for deoptimization
  if (!JvmtiExport::all_dependencies_are_recorded()) {
    CodeCache::mark_all_nmethods_for_evol_deoptimization(&deopt_scope);
    log_debug(redefine, class, nmethod)("Marked all nmethods for deopt");
  } else {
    CodeCache::mark_dependents_for_evol_deoptimization(&deopt_scope);
    log_debug(redefine, class, nmethod)("Marked dependent nmethods for deopt");
  }

JDK-8324241 中查找有关根本问题的更多详细信息。

最近针对此问题的修复添加了 JVM 标志

-XX:+AlwaysRecordEvolDependencies
(默认情况下打开),该标志强制 JVM 从一开始就无条件记录所有 nmethod 依赖项。一旦始终启用此新行为,就不再需要
_all_dependencies_are_recorded
标志。

© www.soinside.com 2019 - 2024. All rights reserved.