RFR: 8319773: Avoid inflating monitors when installing hash codes for LM_LIGHTWEIGHT [v4]

Axel Boldt-Christmas aboldtch at openjdk.org
Thu Nov 16 13:57:50 UTC 2023


On Thu, 16 Nov 2023 13:35:04 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>>> but you could move it down to before 'inflate'
>> 
>> Done.
>> 
>>> Also I think the comment before this function is wrong. We can inflate for deoptimization.
>> 
>> The comment on `is_lock_owned`? For relock_objects `current` is the deoptee's thread which is a JavaThread.
>
> Yes that comment.  If we don't inflate for hashcode anymore for lightweight locking mode, why would we inflate with a non-JavaThread? Is it impossible?

I see what you mean. Because we need to put the hash code in the ObjectMonitor if it already is inflated and it may be the case that the ObjectMonitor has an anonymous owner we can still call `is_lock_owned` when retrieving the monitor for FastHashCode. 

Technically we could condition the inflate call on if the mark word lock bits and pick out the ObjectMonitor from the mark word. It would always be installed when reaching that point in the LM_LIGHTWEIGHT mode.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16603#discussion_r1395730640


More information about the hotspot-dev mailing list