RFR: 8258382: Fix optimization-unstable code involving pointer overflow
Hao Sun
github.com+16932759+shqking at openjdk.java.net
Fri Dec 25 04:10:59 UTC 2020
On Thu, 24 Dec 2020 17:57:44 GMT, Kim Barrett <kbarrett at openjdk.org> wrote:
>> src/hotspot/share/gc/parallel/psPromotionLAB.hpp line 122:
>>
>>> 120: HeapWord* obj = top();
>>> 121: // Pointer overflow check is needed here.
>>> 122: if (end() >= obj && size <= (size_t) (end() - obj)) {
>>
>> `top() <= end()` is always true by design and construction, so the
>> `end() >= obj` test is unnecessary and undesirable. An assertion could
>> be added, but there are lots of places where that relation is assumed
>> to hold and that don't bother asserting, so I wouldn't bother here
>> either.
>
> Instead of `(size_t)(end() - obj)` use `pointer_delta(end(), obj)`.
Cool. Will update soon. Thanks.
-------------
PR: https://git.openjdk.java.net/jdk/pull/1886
More information about the hotspot-dev
mailing list