RFR: 8139457: Array bases are aligned at HeapWord granularity [v50]
Roman Kennke
rkennke at openjdk.org
Wed Aug 16 16:18:28 UTC 2023
On Wed, 16 Aug 2023 09:40:39 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
> > And we are using the header-size without the gap in order to determine if we need an extra store to initialize the gap. E.g.:
>
> I suspect the store to the gap is related to the following comment/diff:
>
> ```
> // We align-up the header size to word-size, because we clear the
> // possible alignment gap in initialize_header().
> int hdr_size = align_up(base_offset_in_bytes, BytesPerWord);
> initialize_body(obj, arr_size, hdr_size, len_zero);
> ```
>
> Wonder if sth like `initialize_body(obj, arr_size, base_offset_in_bytes, len_zero);` can make the header/body classification more explicit. Ofc, `zero_memory` needs to be extended somehow to support non-word-align start-addr.
I did that in an earlier version of this PR and it looked quite messy (you can see it if you go back in the commit history. The trouble is that the loops that zero the body are optimized to work on 8-byte-word units, so we would have to check if the body is aligned or not, and if not, add an extra store. I thought it was easier to just add that store in the header zeroing routine. This is also consistent with how we store the klass-gap in instance objects there.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/11044#discussion_r1296147786
More information about the hotspot-dev
mailing list