“JVMTI_EVENT_COMPILED_METHOD_*”和”JVMTI_EVENT_DYNAMIC_CODE_GENERATED”之间的区别是什么?

huangapple go评论90阅读模式
英文:

What is diff between JVMTI_EVENT_COMPILED_METHOD_* and JVMTI_EVENT_DYNAMIC_CODE_GENERATED?

问题

帮助我理解JVMTI_EVENT_COMPILED_METHOD_*和JVMTI_EVENT_DYNAMIC_CODE_GENERATED在OpenJDK 8中的区别。
我在Grafana上统计这些事件,但仍然不完全理解它们。
也许涉及到"解释器"、"C2/C1"之类的内容。
你能解释一下这些事件发生的时机吗?
我已经阅读了https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#CompiledMethodLoad,但仍然无法理解它们的区别。
谢谢。

英文:

Help me to understand difference between JVMTI_EVENT_COMPILED_METHOD_* and JVMTI_EVENT_DYNAMIC_CODE_GENERATED for OpenJDK 8.<br/>
I counts this events for visualization at Grafana but don't understand them to the end.

Maybe it is "Interpretator" and "C2/C1" or somethings also.<br/>
Can you explain when this events occurred.<br/>

I've read https://docs.oracle.com/javase/8/docs/platform/jvmti/jvmti.html#CompiledMethodLoad but I still cannot understand differents.<br/>
Thanks.

答案1

得分: 2

CompiledMethodLoad 事件对应于 Java 方法 的 JIT 编译。

DynamicCodeGenerated 事件在 JVM 为非 Java 方法生成代码时发送:各种运行时存根、处理程序、适配器等。在 HotSpot 中,字节码解释器也是在 VM 启动时动态生成的,因此在生成解释器时也会发送相同的事件。

以下是一些会触发 DynamicCodeGenerated 事件的代码块示例:

  • Interpreter(解释器)
  • flush_icache_stub(刷新指令缓存存根)
  • DeoptimizationBlob(去优化代码块)
  • I2C/C2I adapters(I2C/C2I 适配器)
  • AbstractMethodError throw_exception(抽象方法错误抛出异常)
  • jlong_disjoint_arraycopy(长整型不连续数组拷贝)
  • slow_subtype_check Runtime1 stub(慢子类型检查 Runtime1 存根)
  • itable stub(itable 存根)
  • 等等。

JIT 编译器线程不参与生成这些代码块。这些代码块是在 VM 引导期间生成的,或者是在 VM 运行时函数的需要时生成的。

尝试使用来自 jvmti-toolsvmtrace 代理工具 - 它将向您显示所有 CompiledMethodLoadDynamicCodeGenerated 事件,以及其他一些 JVM TI 事件。

英文:

CompiledMethodLoad event corresponds to JIT compilation of a Java method.

DynamicCodeGenerated event is sent when the JVM generates code for something that is not a Java method: various runtime stubs, handlers, adapters and so on. The bytecode interpreter in HotSpot is also generated dynamically at the VM startup, so the same event is sent when the Interpreter is generated.

Some examples of code blobs, for which DynamicCodeGenerated event is sent:

  • Interpreter
  • flush_icache_stub
  • DeoptimizationBlob
  • I2C/C2I adapters
  • AbstractMethodError throw_exception
  • jlong_disjoint_arraycopy
  • slow_subtype_check Runtime1 stub
  • itable stub
  • etc.

JIT compiler threads are not involved in generation of these blobs. These code blobs are produced either during VM bootstrap, or on demand from a VM runtime function.

Try vmtrace agent from jvmti-tools - it will show you all CompiledMethodLoad and DynamicCodeGenerated events, as well as some other JVM TI events.

huangapple
  • 本文由 发表于 2020年10月12日 23:47:09
  • 转载请务必保留本文链接:https://go.coder-hub.com/64321066.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定