RFR: 8373595: A new ObjectMonitorTable implementation [v4]
Fredrik Bredberg
fbredberg at openjdk.org
Thu Feb 12 16:15:33 UTC 2026
On Tue, 27 Jan 2026 07:21:26 GMT, Axel Boldt-Christmas <aboldtch at openjdk.org> wrote:
>> Fredrik Bredberg has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Updated for Axel
>
> src/hotspot/share/runtime/objectMonitorTable.cpp line 47:
>
>> 45: const size_t _capacity_mask; // One less than its power-of-two capacity
>> 46: Table* volatile _prev; // Set while rehashing
>> 47: ObjectMonitor* volatile* _buckets; // The payload
>
> I think this should have some opaque `enum class` type rather than `ObjectMonitor*` because we do not always store an `ObjectMonitor*` inside. We could repurpose `SpecialPointerValues` with another name.
>
> So we avoid these reinterpret_casts from our special values to `ObjectMonitor*`. And only reinterpret_cast values we know to be `ObjectMonitor*` to `ObjectMonitor*`.
Fixed
> src/hotspot/share/runtime/objectMonitorTable.hpp line 56:
>
>> 54: removed = 2,
>> 55: below_is_special = (removed + 1)
>> 56: } SpecialPointerValues;
>
> Could this be a C++ enum instead?
>
> Suggestion:
>
> enum SpecialPointerValues {
> empty = 0,
> tombstone = 1,
> removed = 2,
> below_is_special = (removed + 1)
> };
>
>
> I think I preferred it to be an strongly typed `enum class` as well. (But we do use it as an integral in the MacroAssembler so that would introduce some casts.
Fixed
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29383#discussion_r2799762243
PR Review Comment: https://git.openjdk.org/jdk/pull/29383#discussion_r2799760957
More information about the shenandoah-dev
mailing list