hotspot/src/share/vm/gc_implementation/g1/heapRegionSeq.cpp
author tonyp
Fri, 10 Jun 2011 13:16:40 -0400
changeset 9989 305a76435cf1
parent 8680 f1c414e16a4c
child 12381 1438e0fbfa27
permissions -rw-r--r--
7045330: G1: Simplify/fix the HeapRegionSeq class 7042285: G1: native memory leak during humongous object allocation 6804436: G1: heap region indices should be size_t Summary: A series of fixes and improvements to the HeapRegionSeq class: a) replace the _regions growable array with a standard C array, b) avoid de-allocating / re-allocating HeapRegion instances when the heap shrinks / grows (fix for 7042285), c) introduce fast method to map address to HeapRegion via a "biased" array pointer, d) embed the _hrs object in G1CollectedHeap, instead of pointing to it via an indirection, e) assume that all the regions added to the HeapRegionSeq instance are contiguous, f) replace int's with size_t's for indexes (and expand that to HeapRegion as part of 6804436), g) remove unnecessary / unused methods, h) rename a couple of fields (_alloc_search_start and _seq_bottom), i) fix iterate_from() not to always start from index 0 irrespective of the region passed to it, j) add a verification method to check the HeapRegionSeq assumptions, k) always call the wrappers for _hrs.iterate(), _hrs_length(), and _hrs.at() from G1CollectedHeap, not those methods directly, and l) unify the code that expands the sequence (by either re-using or creating a new HeapRegion) and make it robust wrt to a HeapRegion allocation failing. Reviewed-by: stefank, johnc, brutisso
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     1
/*
7904
e90e097fced4 7007068: G1: refine the BOT during evac failure handling
tonyp
parents: 7397
diff changeset
     2
 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     4
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     8
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    13
 * accompanied this code).
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    14
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3807
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3807
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 3807
diff changeset
    21
 * questions.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    22
 *
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    23
 */
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6983
diff changeset
    25
#include "precompiled.hpp"
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    26
#include "gc_implementation/g1/heapRegion.hpp"
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    27
#include "gc_implementation/g1/heapRegionSeq.inline.hpp"
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    28
#include "gc_implementation/g1/heapRegionSets.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6983
diff changeset
    29
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 6983
diff changeset
    30
#include "memory/allocation.hpp"
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    31
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    32
// Private
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    33
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    34
size_t HeapRegionSeq::find_contiguous_from(size_t from, size_t num) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    35
  size_t len = length();
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    36
  assert(num > 1, "use this only for sequences of length 2 or greater");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    37
  assert(from <= len,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    38
         err_msg("from: "SIZE_FORMAT" should be valid and <= than "SIZE_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    39
                 from, len));
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
    40
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    41
  size_t curr = from;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    42
  size_t first = G1_NULL_HRS_INDEX;
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    43
  size_t num_so_far = 0;
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    44
  while (curr < len && num_so_far < num) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    45
    if (at(curr)->is_empty()) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    46
      if (first == G1_NULL_HRS_INDEX) {
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    47
        first = curr;
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    48
        num_so_far = 1;
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    49
      } else {
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    50
        num_so_far += 1;
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    51
      }
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    52
    } else {
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    53
      first = G1_NULL_HRS_INDEX;
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    54
      num_so_far = 0;
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    55
    }
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    56
    curr += 1;
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    57
  }
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    58
  assert(num_so_far <= num, "post-condition");
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    59
  if (num_so_far == num) {
8680
f1c414e16a4c 7014923: G1: code cleanup
tonyp
parents: 8071
diff changeset
    60
    // we found enough space for the humongous object
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    61
    assert(from <= first && first < len, "post-condition");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    62
    assert(first < curr && (curr - first) == num, "post-condition");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    63
    for (size_t i = first; i < first + num; ++i) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    64
      assert(at(i)->is_empty(), "post-condition");
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    65
    }
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    66
    return first;
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    67
  } else {
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    68
    // we failed to find enough space for the humongous object
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    69
    return G1_NULL_HRS_INDEX;
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    70
  }
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    71
}
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
    72
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    73
// Public
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    74
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    75
void HeapRegionSeq::initialize(HeapWord* bottom, HeapWord* end,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    76
                               size_t max_length) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    77
  assert((size_t) bottom % HeapRegion::GrainBytes == 0,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    78
         "bottom should be heap region aligned");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    79
  assert((size_t) end % HeapRegion::GrainBytes == 0,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    80
         "end should be heap region aligned");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    81
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    82
  _length = 0;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    83
  _heap_bottom = bottom;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    84
  _heap_end = end;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    85
  _region_shift = HeapRegion::LogOfHRGrainBytes;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    86
  _next_search_index = 0;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    87
  _allocated_length = 0;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    88
  _max_length = max_length;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    89
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    90
  _regions = NEW_C_HEAP_ARRAY(HeapRegion*, max_length);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    91
  memset(_regions, 0, max_length * sizeof(HeapRegion*));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    92
  _regions_biased = _regions - ((size_t) bottom >> _region_shift);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    93
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    94
  assert(&_regions[0] == &_regions_biased[addr_to_index_biased(bottom)],
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    95
         "bottom should be included in the region with index 0");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    96
}
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    97
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    98
MemRegion HeapRegionSeq::expand_by(HeapWord* old_end,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
    99
                                   HeapWord* new_end,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   100
                                   FreeRegionList* list) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   101
  assert(old_end < new_end, "don't call it otherwise");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   102
  G1CollectedHeap* g1h = G1CollectedHeap::heap();
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   103
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   104
  HeapWord* next_bottom = old_end;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   105
  assert(_heap_bottom <= next_bottom, "invariant");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   106
  while (next_bottom < new_end) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   107
    assert(next_bottom < _heap_end, "invariant");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   108
    size_t index = length();
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
   109
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   110
    assert(index < _max_length, "otherwise we cannot expand further");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   111
    if (index == 0) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   112
      // We have not allocated any regions so far
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   113
      assert(next_bottom == _heap_bottom, "invariant");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   114
    } else {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   115
      // next_bottom should match the end of the last/previous region
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   116
      assert(next_bottom == at(index - 1)->end(), "invariant");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   117
    }
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   118
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   119
    if (index == _allocated_length) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   120
      // We have to allocate a new HeapRegion.
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   121
      HeapRegion* new_hr = g1h->new_heap_region(index, next_bottom);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   122
      if (new_hr == NULL) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   123
        // allocation failed, we bail out and return what we have done so far
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   124
        return MemRegion(old_end, next_bottom);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   125
      }
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   126
      assert(_regions[index] == NULL, "invariant");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   127
      _regions[index] = new_hr;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   128
      increment_length(&_allocated_length);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   129
    }
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   130
    // Have to increment the length first, otherwise we will get an
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   131
    // assert failure at(index) below.
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   132
    increment_length(&_length);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   133
    HeapRegion* hr = at(index);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   134
    list->add_as_tail(hr);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   135
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   136
    next_bottom = hr->end();
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
   137
  }
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   138
  assert(next_bottom == new_end, "post-condition");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   139
  return MemRegion(old_end, next_bottom);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   140
}
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   141
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   142
size_t HeapRegionSeq::free_suffix() {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   143
  size_t res = 0;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   144
  size_t index = length();
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   145
  while (index > 0) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   146
    index -= 1;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   147
    if (!at(index)->is_empty()) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   148
      break;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   149
    }
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   150
    res += 1;
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
   151
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   152
  return res;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   153
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   154
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   155
size_t HeapRegionSeq::find_contiguous(size_t num) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   156
  assert(num > 1, "use this only for sequences of length 2 or greater");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   157
  assert(_next_search_index <= length(),
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   158
         err_msg("_next_search_indeex: "SIZE_FORMAT" "
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   159
                 "should be valid and <= than "SIZE_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   160
                 _next_search_index, length()));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   161
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   162
  size_t start = _next_search_index;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   163
  size_t res = find_contiguous_from(start, num);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   164
  if (res == G1_NULL_HRS_INDEX && start > 0) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   165
    // Try starting from the beginning. If _next_search_index was 0,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   166
    // no point in doing this again.
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   167
    res = find_contiguous_from(0, num);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   168
  }
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   169
  if (res != G1_NULL_HRS_INDEX) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   170
    assert(res < length(),
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   171
           err_msg("res: "SIZE_FORMAT" should be valid", res));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   172
    _next_search_index = res + num;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   173
    assert(_next_search_index <= length(),
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   174
           err_msg("_next_search_indeex: "SIZE_FORMAT" "
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   175
                   "should be valid and <= than "SIZE_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   176
                   _next_search_index, length()));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   177
  }
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   178
  return res;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   179
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   180
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   181
void HeapRegionSeq::iterate(HeapRegionClosure* blk) const {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   182
  iterate_from((HeapRegion*) NULL, blk);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   183
}
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   184
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   185
void HeapRegionSeq::iterate_from(HeapRegion* hr, HeapRegionClosure* blk) const {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   186
  size_t hr_index = 0;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   187
  if (hr != NULL) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   188
    hr_index = (size_t) hr->hrs_index();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   189
  }
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   190
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   191
  size_t len = length();
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   192
  for (size_t i = hr_index; i < len; i += 1) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   193
    bool res = blk->doHeapRegion(at(i));
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   194
    if (res) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   195
      blk->incomplete();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   196
      return;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   197
    }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   198
  }
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   199
  for (size_t i = 0; i < hr_index; i += 1) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   200
    bool res = blk->doHeapRegion(at(i));
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   201
    if (res) {
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   202
      blk->incomplete();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   203
      return;
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   204
    }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   205
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   206
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   207
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   208
MemRegion HeapRegionSeq::shrink_by(size_t shrink_bytes,
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   209
                                   size_t* num_regions_deleted) {
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
   210
  // Reset this in case it's currently pointing into the regions that
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
   211
  // we just removed.
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   212
  _next_search_index = 0;
7923
fc200fcd4e05 6977804: G1: remove the zero-filling thread
tonyp
parents: 7904
diff changeset
   213
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   214
  assert(shrink_bytes % os::vm_page_size() == 0, "unaligned");
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   215
  assert(shrink_bytes % HeapRegion::GrainBytes == 0, "unaligned");
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   216
  assert(length() > 0, "the region sequence should not be empty");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   217
  assert(length() <= _allocated_length, "invariant");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   218
  assert(_allocated_length > 0, "we should have at least one region committed");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   219
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   220
  // around the loop, i will be the next region to be removed
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   221
  size_t i = length() - 1;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   222
  assert(i > 0, "we should never remove all regions");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   223
  // [last_start, end) is the MemRegion that covers the regions we will remove.
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   224
  HeapWord* end = at(i)->end();
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   225
  HeapWord* last_start = end;
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   226
  *num_regions_deleted = 0;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   227
  while (shrink_bytes > 0) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   228
    HeapRegion* cur = at(i);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   229
    // We should leave the humongous regions where they are.
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   230
    if (cur->isHumongous()) break;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   231
    // We should stop shrinking if we come across a non-empty region.
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   232
    if (!cur->is_empty()) break;
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   233
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   234
    i -= 1;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   235
    *num_regions_deleted += 1;
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   236
    shrink_bytes -= cur->capacity();
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   237
    last_start = cur->bottom();
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   238
    decrement_length(&_length);
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   239
    // We will reclaim the HeapRegion. _allocated_length should be
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   240
    // covering this index. So, even though we removed the region from
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   241
    // the active set by decreasing _length, we still have it
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   242
    // available in the future if we need to re-use it.
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   243
    assert(i > 0, "we should never remove all regions");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   244
    assert(length() > 0, "we should never remove all regions");
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   245
  }
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   246
  return MemRegion(last_start, end);
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   247
}
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   248
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   249
#ifndef PRODUCT
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   250
void HeapRegionSeq::verify_optional() {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   251
  guarantee(_length <= _allocated_length,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   252
            err_msg("invariant: _length: "SIZE_FORMAT" "
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   253
                    "_allocated_length: "SIZE_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   254
                    _length, _allocated_length));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   255
  guarantee(_allocated_length <= _max_length,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   256
            err_msg("invariant: _allocated_length: "SIZE_FORMAT" "
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   257
                    "_max_length: "SIZE_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   258
                    _allocated_length, _max_length));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   259
  guarantee(_next_search_index <= _length,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   260
            err_msg("invariant: _next_search_index: "SIZE_FORMAT" "
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   261
                    "_length: "SIZE_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   262
                    _next_search_index, _length));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   263
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   264
  HeapWord* prev_end = _heap_bottom;
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   265
  for (size_t i = 0; i < _allocated_length; i += 1) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   266
    HeapRegion* hr = _regions[i];
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   267
    guarantee(hr != NULL, err_msg("invariant: i: "SIZE_FORMAT, i));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   268
    guarantee(hr->bottom() == prev_end,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   269
              err_msg("invariant i: "SIZE_FORMAT" "HR_FORMAT" "
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   270
                      "prev_end: "PTR_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   271
                      i, HR_FORMAT_PARAMS(hr), prev_end));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   272
    guarantee(hr->hrs_index() == i,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   273
              err_msg("invariant: i: "SIZE_FORMAT" hrs_index(): "SIZE_FORMAT,
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   274
                      i, hr->hrs_index()));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   275
    if (i < _length) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   276
      // Asserts will fire if i is >= _length
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   277
      HeapWord* addr = hr->bottom();
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   278
      guarantee(addr_to_region(addr) == hr, "sanity");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   279
      guarantee(addr_to_region_unsafe(addr) == hr, "sanity");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   280
    } else {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   281
      guarantee(hr->is_empty(), "sanity");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   282
      guarantee(!hr->isHumongous(), "sanity");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   283
      // using assert instead of guarantee here since containing_set()
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   284
      // is only available in non-product builds.
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   285
      assert(hr->containing_set() == NULL, "sanity");
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   286
    }
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   287
    if (hr->startsHumongous()) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   288
      prev_end = hr->orig_end();
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   289
    } else {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   290
      prev_end = hr->end();
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   291
    }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   292
  }
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   293
  for (size_t i = _allocated_length; i < _max_length; i += 1) {
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   294
    guarantee(_regions[i] == NULL, err_msg("invariant i: "SIZE_FORMAT, i));
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   295
  }
1374
4c24294029a9 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
   296
}
9989
305a76435cf1 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 8680
diff changeset
   297
#endif // PRODUCT