RFR: 8324881: ObjectSynchronizer::inflate(Thread* current...) is invoked for non-current thread [v5]
Axel Boldt-Christmas
aboldtch at openjdk.org
Fri Feb 2 08:18:03 UTC 2024
On Fri, 2 Feb 2024 04:40:16 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Axel Boldt-Christmas has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Fix enter_for LockingMode == LM_LEGACY and strengthen assert
>
> src/hotspot/share/runtime/synchronizer.cpp line 1372:
>
>> 1370: if (LockingMode == LM_LIGHTWEIGHT && inf->is_owner_anonymous() &&
>> 1371: thread != nullptr && thread->lock_stack().contains(object)) {
>> 1372: inf->set_owner_from_anonymous(thread);
>
> I thought one of the invariants of lightweight locking was that a transition from anonymously owned to actual owner, can only be performed by the actual owner?
>
> That said, can we actually reach here if not with the current thread? If we are re-locking for deopt then, IIUC, the object has not yet escaped, and has to be unlocked and not with an inflated monitor. In such a case we can't be racing with hashcode inflation either. But perhaps there are other circumstances where re-locking is needed?
Unsure if the `relock_objects` code only re-locks escaped and elided locks, or all elided locks. I believe it is the second. And if we re-lock nested elided locks then they can very well have escaped. (But the lock is guaranteed to be owned by the `deoptee_thread`)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17626#discussion_r1475709904
More information about the hotspot-dev
mailing list