On Tue, 2 Mar 2021 21:15:46 GMT, Igor Veresov <ivere...@openjdk.org> wrote:
>> 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. Slowly, but surely, we are coming to a common understanding. Thanks for educating me. I hadn't seen the range limitation for the counters. Now that I know, I recognise there is some knowledge in my almost faded memory. OK, these three counters will never get dangerously close to 2^31-1. I will rework the section, remove some checks and casts. This will only happen tomorrow (Wednesday) which starts in 90 minutes in my time zone (GMT+1). ------------- PR: https://git.openjdk.java.net/jdk/pull/2511