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

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


On Fri, 9 Jul 2021 00:34:57 GMT, Coleen Phillimore <coleenp at openjdk.org> wrote:

>> [pre-existing. I can't comment directly on line 161, so adding here.]
>> The `if` to range check `x` could be an `else if`.  Similarly in Amalloc.
>
> 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.)

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

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


More information about the hotspot-dev mailing list