RFR: 8358483: G1: Remove G1HeapRegionManager::num_available_regions

Albert Mingkun Yang ayang at openjdk.org
Wed Jun 11 14:37:46 UTC 2025


On Wed, 11 Jun 2025 09:17:07 GMT, Thomas Schatzl <tschatzl at openjdk.org> wrote:

> an alternative that seems to be better could be moving all the code related to G1HeapRegionManager in this method into it.

If I understand you correctly, the suggestion is to merge `expand_and_allocate_humongous` into `allocate_humongous`. However, in that case the caller (g1-heap) doesn't know whether expansion happened or not. (The heap needs to call `record_new_heap_size` when expanding.)


  G1HeapRegion* humongous_start = _hrm.allocate_humongous(obj_regions);
  if (humongous_start == nullptr) {
    humongous_start = _hrm.expand_and_allocate_humongous(obj_regions);
    if (humongous_start != nullptr) {
      policy()->record_new_heap_size(num_committed_regions());

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

PR Comment: https://git.openjdk.org/jdk/pull/25611#issuecomment-2963086968


More information about the hotspot-gc-dev mailing list