RFR: 8265268: Unify ReservedSpace reservation code in initialize and try_reserve_heap [v2]

Stefan Johansson sjohanss at openjdk.java.net
Thu Apr 22 14:01:52 UTC 2021


On Thu, 22 Apr 2021 11:56:24 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

>> src/hotspot/share/memory/virtualspace.cpp line 184:
>> 
>>> 182:     // Check alignment constraints.
>>> 183:     assert((uintptr_t)base % alignment == 0,
>>> 184:            "Large pages returned a non-aligned address, base: " PTR_FORMAT
>> 
>> "Reserve large pages returned..."
>
> s/Reserve/Reserving

Since it's an assert I changed it to be more explicit:
"reserve_memory_special() returned an unaligned address..."

Also change the condition to use `is_aligned(...)`.

>> src/hotspot/share/memory/virtualspace.cpp line 188:
>> 
>>> 186:            p2i(base), alignment);
>>> 187:   } else {
>>> 188:     // failed; fall back to reserve regular memory.
>> 
>> Shouldn't we have this in the caller, because it is up to the caller to do the fallback.
>
> At least this comment suggests some action that is never taken.

As Ivan states this is handled by the caller in `reserve()`, so I moved the comment there. Also change the wording a bit.

-------------

PR: https://git.openjdk.java.net/jdk/pull/3570


More information about the hotspot-dev mailing list