RFR: 8319797: Recursive lightweight locking: Runtime implementation [v3]

David Holmes dholmes at openjdk.org
Tue Nov 14 07:52:35 UTC 2023


On Tue, 14 Nov 2023 07:00:10 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:

>> I thought the issue was that without recursion support we must never find an A and B such that A == B. But with recursion support we can allow A == B if they are adjacent in the lock-stock. So that is what the check is performing, but apparently in two loops, where I was suggesting it can perhaps be done in a single loop.
>
> The recursive locking is more strict. There can only be one consecutive range of the same objects. (e.g. `AABCC` is allowed while `AABAA` is not.)
> 
> The outer loop finds (the two for loop constructs which works on the index `i`) iterates over each range of consecutive objects which are the same. (Picks out the object at the range start index bumps the index until the object is different, finding the range end index). 
> And the inner loop (the for loop construct which works on the index `j`) asserts that no other entry is the same as the object in the this range. (Only walks higher indexes as the lower entries have already been checked in previous iterations).

Got it. Sorry I totally misread the code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16606#discussion_r1392126836


More information about the hotspot-dev mailing list