RFR: 8291555: Implement alternative fast-locking scheme [v37]

Roman Kennke rkennke at openjdk.org
Thu Mar 30 14:34:49 UTC 2023


On Wed, 29 Mar 2023 22:09:02 GMT, Daniel D. Daugherty <dcubed at openjdk.org> wrote:

>> Roman Kennke has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Bounds check in lock-stack verification; only do watermark if we have one
>
> src/hotspot/share/runtime/lockStack.cpp line 69:
> 
>> 67:   assert(UseFastLocking && !UseHeavyMonitors, "never use lock-stack when fast-locking is disabled");
>> 68:   assert((_offset <=  end_offset()), "lockstack overflow: _offset %d end_offset %d", _offset, end_offset());
>> 69:   assert((_offset >= start_offset()), "lockstack underflow: _offset %d end_offset %d", _offset, start_offset());
> 
> You should save a local copy of `end_offset()` and a local copy of
> `start_offset()` in an `#ifdef ASSERT ... #endif` code block and
> then use those local copies in the `assert()` condition and mesg.
> That will guard against parallel usage by the target thread versus
> the verifying thread.

Neither start-offset nor end-offset are changing ever. Those are the hard boundaries of the fixed-sized stack. Ideally both methods would be constexpr, but this is currently not easy because we can't use offsetof().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/10907#discussion_r1153358127


More information about the serviceability-dev mailing list