RFR: JDK-8270308: Amalloc aligns size but not return value (take 2) [v3]
Kim Barrett
kbarrett at openjdk.java.net
Sat Jul 24 20:54:01 UTC 2021
On Sat, 24 Jul 2021 11:26:04 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> src/hotspot/share/memory/arena.hpp line 135:
>>
>>> 133: // on both 32 and 64 bit platforms. Required for atomic jlong operations on 32 bits.
>>> 134: void* Amalloc(size_t x, AllocFailType alloc_failmode = AllocFailStrategy::EXIT_OOM) {
>>> 135: x = ARENA_ALIGN(x); // note for 32 bits this should align _hwm as well.
>>
>> The comment here is stale.
>
>> The comment here is stale.
>
> Yes, I know. See my initial PR text.
>
> I left it in since my first fix was rejected for being too complex, so I wanted to limit this patch to the absolute minimum needed.
>
> I do not think aligning the allocation size - or insisting on an aligned allocation size as the sister method `AmallocWords` does - is useful at all. Removing the comment just leaves the code, which leaves the reader to ask himself why it's in there. Leaving the comment at least states the reason the original author saw. We should either remove the code and the comment or leave both in place.
The length alignment (either by adjustment or by precondition) is what lets the ARENA_ALIGN of _hwm be 32bit only in Amalloc, and not needed in AmallocWords. Maybe you are suggesting dropping the size alignment and instead unconditionally aligning _hwm as needed for the operation? Maybe that's the next RFE?
-------------
PR: https://git.openjdk.java.net/jdk/pull/4835
More information about the hotspot-dev
mailing list