RFR: 8319797: Recursive lightweight locking: Runtime implementation [v3]
Axel Boldt-Christmas
aboldtch at openjdk.org
Mon Nov 13 09:23:02 UTC 2023
On Mon, 13 Nov 2023 01:13:10 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> src/hotspot/share/runtime/lockStack.cpp line 82:
>>
>>> 80: if (VM_Version::supports_recursive_lightweight_locking()) {
>>> 81: oop o = _base[i];
>>> 82: for (;i < top - 1; i++) {
>>
>> Nit: space after first `;`
>
> 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.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/16606#discussion_r1390816671
More information about the hotspot-dev
mailing list