RFR: 8351655: Optimize ObjectMonitor::unlink_after_acquire() [v2]

Patricio Chilano Mateo pchilanomate at openjdk.org
Thu Mar 20 16:40:10 UTC 2025


On Thu, 20 Mar 2025 14:56:27 GMT, Fredrik Bredberg <fbredberg at openjdk.org> wrote:

>> This PR implements an optimization of `ObjectMonitor::unlink_after_acquire()`. If it's possible it only converts the first part (the singly linked part) of the `entry_list` into a doubly linked list and leave the _entry_list_tail pointer untouched. 
>> 
>> It has passed tier1-tier8 tests.
>
> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Update after review

src/hotspot/share/runtime/objectMonitor.cpp line 1258:

> 1256: // entry_list can be in any of these forms:
> 1257: //   1. Only singly linked.
> 1258: //   2. Only doubly linked.

This case should also never happen. If the whole list is already fully doubly linked we would not call this.

src/hotspot/share/runtime/objectMonitor.cpp line 1287:

> 1285:     // into a doubly linked list. Now we just need to set the tail
> 1286:     // pointer.
> 1287:     assert(prev == nullptr || prev->next() == nullptr, "invariant");

Since empty list is not possible instead of `prev == nullptr ||` this should be `prev != nullptr &&`.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24078#discussion_r2006040022
PR Review Comment: https://git.openjdk.org/jdk/pull/24078#discussion_r2006043572


More information about the hotspot-runtime-dev mailing list