RFR: 8313202: MutexLocker should disallow null Mutexes [v3]
Coleen Phillimore
coleenp at openjdk.org
Tue Aug 1 18:32:50 UTC 2023
On Tue, 1 Aug 2023 17:56:19 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:
>> src/hotspot/share/oops/instanceKlass.cpp line 3409:
>>
>>> 3407: bool InstanceKlass::remove_osr_nmethod(nmethod* n) {
>>> 3408: // This is a short non-blocking critical region, so the no safepoint check is ok.
>>> 3409: ConditionalMutexLocker ml(CompiledMethod_lock, !CompiledMethod_lock->owned_by_self(), Mutex::_no_safepoint_check_flag);
>>
>> This is sort of an unfortunate pattern. It's too bad we don't have a better name for this MutexLocker, but on the other hand maybe this should be fixed to take the lock at a higher place in this call stack and these conditional mutexLockers should be asserts.
>
> Yes, it might even be _didactically correct_ to make sure that questionable uses are clunky to write :)
I agree. one should be punished for not getting their locks straight.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15043#discussion_r1281001302
More information about the hotspot-dev
mailing list