jvm 关于分段代码缓存的小问题(http://openjdk.java.net/jeps/197)

ovfsdjhp  于 2022-11-07  发布在  Java
关注(0)|答案(1)|浏览(71)

我看到这个JEP(http://openjdk.java.net/jeps/197)引入了3种类型的代码缓存。
对我来说最明显的是-XX:NonNMethodCodeHeapSize,它处理JVM内部数据。
我不明白的是NonProfiledCodeHeapSizeProfiledCodeHeapSize之间的区别是什么。该文件说:
分层编译还引入了一种新的编译代码类型:检测的编译代码(分析的代码)。
我的理解是,这里的“instrumented”意味着“with counters”,因此,假设这真的是C1编译的代码,而另一个是C2,这是一种逻辑吗?

uwopmtnx

uwopmtnx1#

在分层编译中,* 已分析的代码 * 表示收集执行统计信息(计数器和类型信息)的JIT编译方法,这些统计信息以后可用于在不同层上重新编译。

  • 未分析的代码 * 不仅是C2代码,它还包括本机方法的已编译 Package ,以及由C1编译但没有执行统计信息的方法(第1层),例如,不会从重新编译中受益的简单方法,如getter/setter。

请参阅codeBlob.hpp

// CodeBlob Types
// Used in the CodeCache to assign CodeBlobs to different CodeHeaps
struct CodeBlobType {
  enum {
    MethodNonProfiled   = 0,    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
    MethodProfiled      = 1,    // Execution level 2 and 3 (profiled) nmethods
    NonNMethod          = 2,    // Non-nmethods like Buffers, Adapters and Runtime Stubs
    All                 = 3,    // All types (No code cache segmentation)
    NumTypes            = 4     // Number of CodeBlobTypes
  };
};

相关问题