RFR: 8332506: SIGFPE In ObjectSynchronizer::is_async_deflation_needed() [v3]
Fredrik Bredberg
fbredberg at openjdk.org
Mon Jan 6 19:17:42 UTC 2025
On Mon, 6 Jan 2025 01:54:46 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update two after review
>
> src/hotspot/share/runtime/synchronizer.cpp line 1274:
>
>> 1272: // Make sure the we use a ceiling value that is not lower than the
>> 1273: // max used by the system, and not zero.
>> 1274: size_t ceiling = MAX3(old_ceiling, list->max(), monitors_used);
>
> The comment does not explain why these three components are checked.
If `list->max()` is above `old_ceiling` we should use that because the number of actual used monitors, has at one point exceeded the `old_ceiling` value. Why add `monitors_used` to the mix? Any increase in the `list->max()` value will come **after** the increase in `list->count()` aka `monitors_used`. So by adding `monitors_used` to the mix we ensure that `ceiling` can't become zero, even if `old_ceiling` is zero and `list->max()` hasn't been increased yet. Because we [know](https://github.com/openjdk/jdk/blob/502766b759d13edd1ce3f4ebd46fcc8f13ed5d53/src/hotspot/share/runtime/synchronizer.cpp#L1268) that `monitors_used` is not zero.
I tried to condense that into a shorter comment, but obviously I failed.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22815#discussion_r1904539612
More information about the hotspot-runtime-dev
mailing list