RFR: 8319773: Avoid inflating monitors when installing hash codes for LM_LIGHTWEIGHT [v10]
Daniel D. Daugherty
dcubed at openjdk.org
Wed Nov 29 18:32:39 UTC 2023
On Fri, 17 Nov 2023 07:19:51 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Do we inflate when the VMThread is doing JVM/TI tagging?
>
> LM_LEGACY and LM_MONITOR will. LM_LIGHTWEIGHT technically may. If deflation finishes between reading the mark word in FastHashCode and reading the mark word in `inflate`. It seems like a rare enough case that it does not need to be handled separately. The following change would avoid inflation all together.
>
> // An async deflation can race after the inflate() call and before we
> // can update the ObjectMonitor's header with the hash value below.
> + if (LockingMode == LM_LIGHTWEIGHT) {
> + assert(mark.has_monitor(), "must be");
> + monitor = mark.monitor();
> + } else {
> - monitor = inflate(current, obj, inflate_cause_hash_code);
> + monitor = inflate(current, obj, inflate_cause_hash_code);
> + }
> // Load ObjectMonitor's header/dmw field and see if it has a hash.
>
>
> Maybe I should change it to this. Given that there has been confusion here.
> My ideal solution would be to separate the implementations for the different locking modes all together, all of these functions are littered with if (LockingMode == X).
So what did you decide to do here?
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16603#discussion_r1409704775
More information about the hotspot-dev
mailing list