RFR: 8224509: Incorrect alignment in CDS related allocation code on 32-bit platforms
Thomas Stuefe
stuefe at openjdk.java.net
Fri Oct 2 05:15:09 UTC 2020
On Fri, 2 Oct 2020 04:53:21 GMT, Ioi Lam <iklam at openjdk.org> wrote:
>> CDS aligns pointers and sizes to BytesPerWord. On 64-bit, BytesPerWord = 8. On 32-bit, BytesPerWord = 4.
>>
>> To make the alignment consistent between 64- and 32-bit platforms, this patch changes the alignment value to 8.
>>
>> Testing: tiers 1 - 4
>> built linux-x86-debug.
>
> src/hotspot/share/memory/archiveUtils.hpp line 33:
>
>> 31: #include "utilities/bitMap.hpp"
>> 32:
>> 33: #define SharedSpaceObjectAlignment 8
>
> I think we can use a `const int` instead of `#define`. Also, some comments will be helpful. Maybe:
>
> // Metaspace::allocate() requires that all blocks must be aligned with KlassAlignmentInBytes.
> // We enforce the same alignment rule in blocks allocated from the shared space.
> const int SharedSpaceObjectAlignment = KlassAlignmentInBytes;
+1 to making the dependency on KlassAlignment explicit. Please do not hide any dependencies on Klass alignment behind
literals (I am currently experimenting with increasing class space allocation alignment to increase the range of
zero-based Klass* encoding)
-------------
PR: https://git.openjdk.java.net/jdk/pull/476
More information about the hotspot-runtime-dev
mailing list