RFR: 8260046: Assert left >= right in pointer_delta() methods
Kim Barrett
kbarrett at openjdk.java.net
Fri May 7 18:04:36 UTC 2021
On Thu, 6 May 2021 14:02:13 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:
> Adding the assertion, and fixing a benign violation.
>
> Test: tier1-7; no violation of this assertion.
Changes requested by kbarrett (Reviewer).
src/hotspot/share/gc/g1/g1Allocator.cpp line 460:
> 458: // chunk if we don't yet cross the boundary, but the remainder would be too
> 459: // small to fill.
> 460: HeapWord* new_top = old_top + word_size;
Pre-existing but related to the change - What, if anything, prevents the calculation of new_top from overflowing or detects that happened. The usual way we do such calculations safely involves first checking that `(_max - old_top) <= word_size` or something similar. I don't see anything to prevent that, and if nothing does then the various checks and calculations involving new_top are suspect.
-------------
PR: https://git.openjdk.java.net/jdk/pull/3900
More information about the hotspot-dev
mailing list