RFR: 8253420: Refactor HeapRegionManager::find_highest_free

Kim Barrett kbarrett at openjdk.java.net
Fri Jan 22 20:49:41 UTC 2021


On Fri, 22 Jan 2021 08:59:51 GMT, Albert Mingkun Yang <ayang at openjdk.org> wrote:

> Using for-loop to make the number of iterations more explicit. Direct backward iteration, `for (uint curr = reserved_length() - 1; curr >= 0; curr--)` doesn't work due to underflow of `uint` type. Therefore, I went for current approach.
> 
> Test: hotspot_gc

src/hotspot/share/gc/g1/heapRegionManager.cpp line 541:

> 539:   // committed, expand at that index.
> 540:   for (uint i = 0; i < reserved_length(); ++i) {
> 541:     uint curr = reserved_length() - 1 - i;

Maybe this instead?
for (uint curr = reserved_length(); curr-- > 0; ) {

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

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



More information about the hotspot-gc-dev mailing list