我看到这个 JEP ( http://openjdk.java.net/jeps/197 ) 引入了 3 种类型的代码缓存。
对我来说最明显的是 -XX:NonNMethodCodeHeapSize
。这是处理 JVM 内部数据的数据。
我不明白的是 NonProfiledCodeHeapSize
和 ProfiledCodeHeapSize
之间有什么区别。该文件说:
Tiered compilation also introduces a new compiled code type: instrumented compiled code (profiled code).
我的理解是,这里的“instrumented”意思是“带计数器”,所以假设这真的是 C1
编译代码的逻辑是什么?而另一个是C2
?
最佳答案
在分层编译中,剖析代码是指收集执行统计信息(计数器和类型信息)的 JIT 编译方法,稍后可用于在不同层上重新编译。
非剖析代码 不仅是 C2 代码。它还包括本地方法的已编译包装器,以及由 C1 编译但没有执行统计信息 (Tier 1) 的方法,例如像 getters/setters 这样的简单方法不会从重新编译中获益。
参见 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
};
};
关于java - 关于分段代码缓存的小问题 (http ://openjdk. java.net/jeps/197),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69262935/