RFR: 8329994: Zap alignment padding bits for ArrayOops in non-release builds
Axel Boldt-Christmas
aboldtch at openjdk.org
Wed Apr 10 13:05:08 UTC 2024
On Wed, 10 Apr 2024 12:03:06 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
>> In a similar vein to [JDK-8325870](https://bugs.openjdk.org/browse/JDK-8325870). Zap the any alignment padding that may exist between the header and the payload.
>>
>> Currently this padding only occurs when disabling `UseCompressedClassPointers`. But becomes more relevant with [JDK-8294992](https://bugs.openjdk.org/browse/JDK-8294992).
>
> src/hotspot/share/gc/shared/memAllocator.cpp line 409:
>
>> 407: if (_do_zero) {
>> 408: mem_clear(mem);
>> 409: mem_zap_alignment_padding(mem);
>
> I feel the ordering here is a bit odd; these methods are for spaces corresponding to before-body, body and after-body.
Yeah issue is that `mem_clear(mem);` will clear the padding. Maybe I should do the same for `ZObjArrayAllocator` as well. To keep them consistent. Even though the `ZObjArrayAllocator` does not clear that memory.
Also this is debug code, maybe just doing it after the normal clearing is the better choice. So regardless how much memory the normal clearing does we always end up with the padding zapped.
> src/hotspot/share/gc/shared/memAllocator.hpp line 101:
>
>> 99: const bool _do_zero;
>> 100:
>> 101: void mem_zap_alignment_padding(HeapWord* mem) const PRODUCT_RETURN;
>
> Both methods are about alignment-padding, one for array-element type, the other for obj itself. Maybe call it "mem_zap_start_padding" to make them more symmetric?
I am not opposed to that name. Only confusion could be that someone thinks that it is before the header, but the current name is not any better. I'll take your suggestion.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/18714#discussion_r1559392288
PR Review Comment: https://git.openjdk.org/jdk/pull/18714#discussion_r1559395975
More information about the hotspot-gc-dev
mailing list