jvm - 关于代码缓存区
jvm - About code cache area
这里有一些关于 JVM 中 缓存区 的问题: (for hotspot Java8)
- jvm 可以 运行 存储的所有机器代码都存储在这个区域,还是只存储一些热代码?
- 从某本书上说,客户端编译器 (C1) 更有可能 运行 缓存区域内存不足,而服务器编译器 (C2) 则不会。我对此有点困惑。那是因为服务器编译器只编译热的部分,而中断了另一部分?在那种情况下,服务器编译器不应该很慢吗?
- 在 C1 和 C2 分别编译和缓存它们之前,代码 运行 了多少次?
请注意,这个问题的答案可能因实施而异:
Does all machine code that jvm could run stored in this area, or only
some hot code is stored here?
代码缓存几乎总是用于缓存热门方法(或曾经被C1 + C2认为热门的方法(分层编译)
From some book, it says client compiler (C1) is more likely to run out
of memory in cache area, while server compiler (C2) don't. I am a
little confused about that. Is that because the server compiler only
compile the hot part, and interrupt the other part? In that case,
shouldn't the server compiler be slow?
C1 编译器编译一切。 C2 一直等到它找到一些可以应用的优化,然后应用这些优化并编译方法(并非总是如此,但大多数情况下)。
注意C1可以多次编译同一个方法
How many times the code is run before C1 & C2 would compile them
respectively?
如果C1/C2发现需要很长时间运行,一个方法即使只调用一次也能编译通过运行。
您可以使用 JITWatch 查看 C1 和 C2 的运行情况。
这里有一些关于 JVM 中 缓存区 的问题: (for hotspot Java8)
- jvm 可以 运行 存储的所有机器代码都存储在这个区域,还是只存储一些热代码?
- 从某本书上说,客户端编译器 (C1) 更有可能 运行 缓存区域内存不足,而服务器编译器 (C2) 则不会。我对此有点困惑。那是因为服务器编译器只编译热的部分,而中断了另一部分?在那种情况下,服务器编译器不应该很慢吗?
- 在 C1 和 C2 分别编译和缓存它们之前,代码 运行 了多少次?
请注意,这个问题的答案可能因实施而异:
Does all machine code that jvm could run stored in this area, or only some hot code is stored here?
代码缓存几乎总是用于缓存热门方法(或曾经被C1 + C2认为热门的方法(分层编译)
From some book, it says client compiler (C1) is more likely to run out of memory in cache area, while server compiler (C2) don't. I am a little confused about that. Is that because the server compiler only compile the hot part, and interrupt the other part? In that case, shouldn't the server compiler be slow?
C1 编译器编译一切。 C2 一直等到它找到一些可以应用的优化,然后应用这些优化并编译方法(并非总是如此,但大多数情况下)。
注意C1可以多次编译同一个方法
How many times the code is run before C1 & C2 would compile them respectively?
如果C1/C2发现需要很长时间运行,一个方法即使只调用一次也能编译通过运行。
您可以使用 JITWatch 查看 C1 和 C2 的运行情况。