RFR: 8253779: Amalloc may be wasting space by overaligning [v3]

Coleen Phillimore coleenp at openjdk.java.net
Fri Jul 9 22:38:56 UTC 2021


On Fri, 9 Jul 2021 20:19:31 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Move static_assert and fix jlong.
>
> src/hotspot/share/memory/arena.hpp line 37:
> 
>> 35: // The byte alignment to be used by Arena::Amalloc.
>> 36: #define ARENA_AMALLOC_ALIGNMENT BytesPerLong
>> 37: static_assert(is_power_of_2(ARENA_AMALLOC_ALIGNMENT), "is aligned");
> 
> This static_assert could just be dropped, along with ARENA_ALIGN_M1 and ARENA_ALIGN_MASK, and change ARENA_ALIGN to
> `#define ARENA_ALIGN(x) (align_up((x), ARENA_AMALLOC_ALIGNMENT))`
> or replace the macro with
> `constexpr size_t arena_align(size_t x) { return align_up(x, ARENA_AMALLOC_ALIGNMENT); }`
> (and either way, #include align.hpp).

sure, makes sense.

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

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


More information about the hotspot-dev mailing list