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

Kim Barrett kbarrett at openjdk.java.net
Fri Jul 9 04:07:53 UTC 2021


On Thu, 8 Jul 2021 21:56:43 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:

>> Coleen Phillimore has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Improvements ala Kim
>
> src/hotspot/share/memory/arena.hpp line 138:
> 
>> 136: 
>> 137:   // Fast allocate in the arena.  Common case aligns to the size of long which is 64 bits
>> 138:   // on both 32 and 64 bit platforms. Required for atomic long operations on 32 bits.
> 
> s/long/jlong/ because C++ long is not 64 bits on some platforms (Windows!).

There were two "long" that need to be "jlong"; only one was changed.

> src/hotspot/share/memory/arena.hpp line 157:
> 
>> 155:   // is 4 bytes on 32 bits, hence the name.
>> 156:   void *Amalloc_4(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
>> 157:     assert((x & (sizeof(char*)-1)) == 0, "misaligned size");
> 
> This ought to be using `is_aligned`.

The change to BytesPerWord for the alignment seems correct.

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

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


More information about the hotspot-dev mailing list