RFR: 8224509: Incorrect alignment in CDS related allocation code on 32-bit platforms
Ioi Lam
iklam at openjdk.java.net
Fri Oct 2 04:56:04 UTC 2020
On Thu, 1 Oct 2020 22:40:46 GMT, Calvin Cheung <ccheung 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.
Marked as reviewed by iklam (Reviewer).
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;
-------------
PR: https://git.openjdk.java.net/jdk/pull/476
More information about the hotspot-runtime-dev
mailing list