RFR: 8291555: Implement alternative fast-locking scheme [v29]
Thomas Stuefe
stuefe at openjdk.org
Tue Mar 28 16:04:40 UTC 2023
On Fri, 24 Mar 2023 16:54:59 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/runtime/lockStack.cpp line 42:
>>
>>> 40:
>>> 41: #ifndef PRODUCT
>>> 42: void LockStack::validate(const char* msg) const {
>>
>> Would you also like to check there are no `nullptr` elements on stack here?
>
> Please also verify against over- and underflow, and better than just null checks check that every oop really is an oop. I added this to my code:
>
> assert((_offset <= end_offset()), "lockstack overflow: _offset %d end_offset %d", _offset, end_offset());
> assert((_offset >= start_offset()), "lockstack underflow: _offset %d end_offset %d", _offset, start_offset());
> int end = to_index(_offset);
> for (int i = 0; i < end; i++) {
> assert(oopDesc::is_oop(_base[i]), "index %i: not an oop (" PTR_FORMAT ")", i, p2i(_base[i]));
> ...
Just realized that my proposal of oop-checking does not work since during GC oop can be moved and will temporarily be invalid.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/10907#discussion_r1150847182
More information about the hotspot-dev
mailing list