RFR: 8261447: MethodInvocationCounters frequently run into overflow [v2]

Igor Veresov iveresov at openjdk.java.net
Tue Mar 2 20:04:04 UTC 2021


On Thu, 11 Feb 2021 21:14:04 GMT, Igor Veresov <iveresov at openjdk.org> wrote:

>> Lutz Schmidt has refreshed the contents of this pull request, and previous commits have been removed. The incremental views will show differences compared to the previous content of the PR.
>
> src/hotspot/share/oops/method.cpp line 516:
> 
>> 514:   // This is ok because counters are unsigned by nature, and it gives us
>> 515:   // another factor of 2 before the counter values become meaningless.
>> 516:   // Print a "overflow" notification to create awareness.
> 
> What ```invocation_count()``` returns (which is currently equivalent to ```interpreter_invocation_count()``` btw) comes from the ```InvocationCounter::count()``` which cannot grow beyond 2^31, so all these counts are always positive. What exactly do these casts to unsigned do?

So, why do we need the casts to unsigned in this method?

-------------

PR: https://git.openjdk.java.net/jdk/pull/2511


More information about the serviceability-dev mailing list