RFR: 8319797: Recursive lightweight locking: Runtime implementation [v3]
David Holmes
dholmes at openjdk.org
Mon Nov 13 22:28:27 UTC 2023
On Mon, 13 Nov 2023 09:20:26 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Though rather than walk the lockstack twice can't we just change the check below to something like:
>>
>> if (VM_Version::supports_recursive_lightweight_locking() && i != j - 1) {
>> assert(_base[i] != _base[j], "entries must be unique: %s", msg);
>> }
>
> Not sure I understand.
>
> The change here is that [for every object A, there exists no other object B such that A == B] is changed to [for every contiguous run of object A, there exists no other object B outside that run such that A == B]. Both of these checks are `O(n^2)` in the worst case, and the second is is `O(n)` in the best case.
>
> I think you have describe the algorithm you envision. Or maybe you want to change what property we are asserting.
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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16606#discussion_r1391770153
More information about the hotspot-dev
mailing list