RFR: 8344665: Refactor PartialArrayState allocation for reuse [v3]
Albert Mingkun Yang
ayang at openjdk.org
Tue Dec 3 09:24:40 UTC 2024
On Mon, 2 Dec 2024 15:58:50 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> src/hotspot/share/gc/shared/partialArrayState.hpp line 181:
>>
>>> 179: // allocator counters as a single unit for atomic manipulation.
>>> 180: using CounterValues = LP64_ONLY(uint64_t) NOT_LP64(uint32_t);
>>> 181: using Counter = LP64_ONLY(uint32_t) NOT_LP64(uint16_t);
>>
>> Given the max-value has type `uint`, using the larger type on both 32/64 bit systems should be simpler and it should not cause any noticeable perf regression, since registering/releasing allocators should be infrequent. WDYT?
>
> I assumed 16bits of worker threads was quite sufficient for a 32bit platform.
> And I misremembered and thought 32bit platforms couldn't be relied upon for a
> 64bit atomic add and maybe other 64bit operations. And this code is definitely
> not super performance critical. So yeah, I could drop the platform-conditional
> definition of Counter. I don't think it makes much difference to the code. I
> guess the type aliases could be dropped and just use bare uint32/64_t. Not
> sure that's actually an improvement.
I think unifying 32 and 64 bit system is an improvement -- being able to reason with concrete types. As for type aliases, it's rather subjective; I find `uint*_t` more familiar, but up to you.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22287#discussion_r1867335846
More information about the hotspot-gc-dev
mailing list