RFR: 8294759: Print actual lock/monitor ranking

Coleen Phillimore coleenp at openjdk.org
Tue Oct 4 21:53:30 UTC 2022


On Tue, 4 Oct 2022 17:37:40 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> src/hotspot/share/runtime/mutexLocker.cpp line 440:
>> 
>>> 438:   }
>>> 439: 
>>> 440:   for (int r = min_rank; r <= max_rank; r++) {
>> 
>> I'm confused by this first loop. why can't min_rank be Mutex::event or static_cast<int>0 and max_rank should be Mutex::safepoint.
>
> Ah, I was being defensive about this: computing min/max without relying on the actual `Rank` definition. While `0` is plausibly the lowest rank, I don't really want to rely on `safepoint` being the last rank. This is debugging code, so we can spend some time on this. Makes sense?

All the other code in this file thinks safepoint is the last rank (it's an invariant) and INT_MAX is a bit large even for debugging code.  I think safepoint would be better. I marked it as reviewed so am not really insistent., but it looked weird to me.

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

PR: https://git.openjdk.org/jdk/pull/10556


More information about the hotspot-runtime-dev mailing list