srg321
srg321

Reputation: 115

What is diff between JVMTI_EVENT_COMPILED_METHOD_* and JVMTI_EVENT_DYNAMIC_CODE_GENERATED?

Help me to understand difference between JVMTI_EVENT_COMPILED_METHOD_* and JVMTI_EVENT_DYNAMIC_CODE_GENERATED for OpenJDK 8.
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.
Can you explain when this events occurred.

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

Upvotes: 0

Views: 240

Answers (1)

apangin
apangin

Reputation: 98350

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.

Upvotes: 3

Related Questions