RFR: 8345659: Fix broken alignment after ReservedSpace splitting in GC code [v2]
Axel Boldt-Christmas
aboldtch at openjdk.org
Wed Dec 11 12:53:38 UTC 2024
On Wed, 11 Dec 2024 12:12:55 GMT, Stefan Karlsson <stefank at openjdk.org> wrote:
> I don't think that this is a strict requirement throughout the JVM's usage of ReservedSpace. AFAIU, the alignment only strictly applies to the base pointer, but some users has also has an 'alignment' requirement (as opposed to a 'page_size' requirement) on the size.
Yes, the users might not have these requirements, but the current implementation of ReservedSpace enforces it. It might be nice to separate these two properties.
AFAICT all paths go through `ReservedSpace::reserve` which `assert(is_aligned(size, alignment), "Size must be aligned to the requested alignment");` and all three cases ensures that base is aligned, and if the succeed they call `initialize_members`.
Of course `_alignment` can be 0 if we have no reservation. But calling `partition` / `last_part` / `first_part` is then not allowed (the same is true most ReservedSpace member functions).
We have uses from the outside that do not care about the alignment, and they will get some page_size (or `os::vm_allocation_granularity()`) as their alignment.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/22602#issuecomment-2535906376
More information about the hotspot-gc-dev
mailing list