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

Coleen Phillimore coleenp at openjdk.java.net
Fri Jul 9 14:23:50 UTC 2021


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

>> 1, 3.  Ok, turned to else if with appropriate brackets.
>> 2. Both of these places have a call check_for_overflow that checks that so rearranging the code leads to casts since _hwm and _max are char* and x is size_t.
>
> Instead of my previously suggested `if (_max - _hwm < x)`, use `if (pointer_delta(_max, _hwm, 1) < x)` to avoid the signed vs unsigned comparison warning.  Then I think `check_for_overflow` is just not needed.  (Sorry, I forgot to mention previously that I think `check_for_overflow` can be eliminated.)

check_for_overflow does more than just the pointer comparison.  It conditionally calls vm_exit_out_of_memory.  I don't want to copy this into both of the Amalloc function, and it has a nice name vs. squinting and trying to understand why "if (pointer_delta(_max, _hwm, 1) < x)" does the same thing. As is, this is readable and I don't want to change it.

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

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


More information about the hotspot-dev mailing list