Setting JVMTI Capabilities when VM is in "Live Phase"
Daniel D. Daugherty
daniel.daugherty at oracle.com
Fri Aug 12 23:04:25 UTC 2016
On 8/12/16 4:21 PM, Leela Mohan wrote:
> Hi experts,
> It looks like, we don't disallow setting capabilities when VM is in
> "JVMTI_PHASE_LIVE". And, I notice, for every new compilation of method,
> ciEnv caches the JVMTI state and expects those assumptions to be true
> during the compilation. Otherwise, dump the compiled method.
> However, we don't seem to do anything with the methods which were compiled
> before setting the capability.
> What is the understanding?
I'm guessing that you are talking about this capability:
and this event:
The can_generate_compiled_method_load_events capability needs to be added
in order to generate CompiledMethodLoad events. Capabilities are added via
which can be called from different JVM/TI phases. Different VM
can require that certain capabilities can only be added in certain
However, if AddCapabilities() does not return a JVM/TI error when a
is added in a phase, e.g., the live phase, then you can safely assume that
the capability has been added.
In your example, it sounds like the capability is added in the live phase
because you are seeing events generated for newly compiled methods. In order
to see synthetic events for methods that were compiled before you added the
capability, your agent needs to use a different function:
The documentation for Compiled Method Load has this line:
> These events can be sent after their initial occurrence with
and that sounds just like your situation.
Hope this helps.
More information about the hotspot-runtime-dev