Does HotSpot ever stop profiling?

Stefan Reich stefan.reich.maker.of.eye at
Mon Sep 16 23:05:24 UTC 2019

Hey, thanks for your answer.

So a method is normally only once C2-compiled. How does inlining fit into
the picture? You start from the method body and inline as deeply as

I always thought a method would be compiled multiple times while improving
its inlining. But maybe that makes no sense and you can do it all in a
single compilation effort.

On Tue, 17 Sep 2019 at 00:47, Vitaly Davidovich <vitalyd at> wrote:

> On Mon, Sep 16, 2019 at 6:35 PM Stefan Reich <
> stefan.reich.maker.of.eye at> wrote:
>> Here's another thing I would love to have cleared up.
>> Once a method is C2-compiled - does it still update its invocation
>> counters?
> Nope.  C2 compiled methods run profile-free.  There can be certain events
> that trigger a deopt that will toss out the C2 method (with future C2
> compilations off newly collected profiling possible), but it won’t be
> counter based.
>> I would assume counting stops at that point since we have done all we
>> could
>> for the method. Also the invocation counting overhead is always
>> embarrassing when fighting some C++ guys over claims on how "slow" Java
>> is.
>> :o)
>> OTOH, there might be scenarios where it makes sense to have a second look
>> at "hot" methods, even if they are C2-compiled. Not sure if that scenario
>> exists in the current infrastructure.
> That infrastructure is called a process restart :) j/k.  There’re some
> compiler control APIs, but they’re mostly to allow JIT testing (AFAIK).  I
> think it allows manually marking a C2 method for reclaim (ie not entrant),
> but I don’t recall the details offhand.
>> Which one is it in reality?
>> --
>> Stefan Reich
>> // Java-based operating systems
> --
> Sent from my phone

Stefan Reich // Java-based operating systems

More information about the hotspot-dev mailing list