RFR: 8306541: Refactor collection set candidate handling to prepare for JDK-8140326 [v5]

Albert Mingkun Yang ayang at openjdk.org
Tue May 9 09:41:25 UTC 2023


On Tue, 9 May 2023 09:29:47 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> would add a loop over the other list

I don't get it.


void G1CollectionSetRegionList::remove(G1CollectionSetRegionList* other) {
#ifdef ASSERT
  // Check that the given list is a prefix of this list.
  int i = 0;
  for (HeapRegion* r : *other) {
    assert(_regions.at(i) == r, "must be in order, but element %d is not", i);
    i++;
  }
#endif

  if (other->length() == 0) {
    return;
  }
  _regions.remove_till(other->length());
  _reclaimable_bytes -= other->reclaimable_bytes();
}


If one removes `_reclaimable_bytes`, the last statement will go away. Why do you need an additional loop?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13666#discussion_r1188389570


More information about the hotspot-dev mailing list