On Tue, 2 Mar 2021 20:43:53 GMT, Lutz Schmidt <l...@openjdk.org> wrote:

>> So, why do we need the casts to unsigned in this method?
>
> When you increment (2^31-1), you get 2^31 which is 0x80000000. When 
> interpreted as signed int, it is MIN_INT. I don't want that. I want to treat 
> the value as positive number - what it actually is. There is no negative 
> count!

I was trying to make a point that these counters are always < MAX_INT. 
```InvocationCounter::count()``` shifts the counter right by 1, ensuring that 
the sign bit is 0. ```Method::{invocation, backedge, 
interpreter_invocation}_count()``` can also return 
```InvocationCounter::count_limit```, but this one is 2^30, which is also 
positive.

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

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

Reply via email to