RFR: 8255678: Add Mutex::try_lock version without rank checks [v2]

Coleen Phillimore coleenp at openjdk.java.net
Thu Nov 19 13:24:07 UTC 2020


On Thu, 19 Nov 2020 03:37:09 GMT, Patricio Chilano Mateo <pchilanomate at openjdk.org> wrote:

>> src/hotspot/share/runtime/mutex.cpp line 400:
>> 
>>> 398:   if (owned_by_self()) {
>>> 399:     // wait() case
>>> 400:     Mutex* least = get_least_ranked_lock_besides_this(locks_owned);
>> 
>> Wouldn't you want to test check_can_be_skipped before all this code and skip all of this?
>
> For the wait() case, today we always check that the thread doesn't wait while holding a Mutex/Monitor of rank less than or equal to special, and I didn't want to change that.
> But I could do it for the "lock()/lock_without_safepoint_check()/try_lock()" case, and return before calling get_least_ranked_lock().

too many conditions!  Now I see it.  Okay.

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

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


More information about the hotspot-runtime-dev mailing list