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

David Holmes dholmes at openjdk.org
Fri Mar 21 05:53:08 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

A few more nits - plus I agree with Patricio's comments.

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

> 1252: 
> 1253: // Convert entry_list into a doubly linked list by assigning the prev
> 1254: // pointers and the entry_list_tail pointer. Within the entry_list the

Suggestion:

// pointers and the entry_list_tail pointer (if needed). Within the entry_list the

If the bottom end of the list is already DL then the tail will already be set.

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

> 1270:   // This function should only be called when we know that the
> 1271:   // entry_list is not empty.
> 1272:   assert(w != nullptr, "invariant");

Suggestion - no comments just:

assert(w != nullptr, "should only be called when entry list is not empty");

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

> 1319:   entry_list_build_dll(current);
> 1320:   w = _entry_list_tail;
> 1321:   assert(w != nullptr, "should be");

Suggestion:

  assert(w != nullptr, "invariant");

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

PR Review: https://git.openjdk.org/jdk/pull/24078#pullrequestreview-2704734818
PR Review Comment: https://git.openjdk.org/jdk/pull/24078#discussion_r2006850688
PR Review Comment: https://git.openjdk.org/jdk/pull/24078#discussion_r2006882046
PR Review Comment: https://git.openjdk.org/jdk/pull/24078#discussion_r2006864300


More information about the hotspot-runtime-dev mailing list