Could the JIT be started before JVMTI agents are loaded?
Alan Bateman
Alan.Bateman at Sun.COM
Thu Jun 25 07:55:19 PDT 2009
Volker Simonis wrote:
> Hi,
>
> we currently have some problems with long startup times due to JVMTI
> agents loaded with -javaagent. While investigating the problem we
> realized that the JIT compiler is only started AFTER the agent was
> loaded and initialized and therefore the whole agent initialization
> takes place in interpreted mode. Here is the corresponding code from
> thread.cpp:
>
> 3137 // Notify JVMTI agents that VM initialization is complete
> - nop if no agents.
> 3138 JvmtiExport::post_vm_initialized();
> 3139
> 3140 Chunk::start_chunk_pool_cleaner_task();
> 3141
> 3142 // initialize compiler(s)
> 3143 CompileBroker::compilation_init();
>
> Is there any particualr reason that the JIT gets initialized only
> after the agent initialization or could it be done just as well
> before? A short test where we placed
> "CompileBroker::compilation_init()" just before
> "JvmtiExport::post_vm_initialized()" succeeded with a considerable
> startup speedup, but we are not sure if this change would be valid in
> general.
>
I agree it would be desirable to have the compiler enabled before the
agent's premain is invoked. I haven't worked in this area for some time,
and don't recall the reasoning for the ordering. One possible side
effort is when you have multiple agents, say a java agent and native
agent that enables CompieldMethodLoad. Depending on the ordering that
they are initiated then the native agent might get compilation events
before its VMInit is called (assuming the event is enabled early). I'm
not saying this is a problem, just something to check into.
Robert, Dan - do you recall the reason for the ordering? (carried over
from JVMDI perhaps?).
-Alan.
More information about the hotspot-dev
mailing list