src/share/vm/gc_implementation/g1/heapRegionSeq.cpp

changeset 828
078b8a0d8d7c
parent 777
37f87013dfd8
child 905
ad8c8ca4ab0f
child 916
7d7a7c599c17
equal deleted inserted replaced
827:05366dad12cf 828:078b8a0d8d7c
35 assert(false, "We should never compare distinct overlapping regions."); 35 assert(false, "We should never compare distinct overlapping regions.");
36 } 36 }
37 return 0; 37 return 0;
38 } 38 }
39 39
40 HeapRegionSeq::HeapRegionSeq() : 40 HeapRegionSeq::HeapRegionSeq(const size_t max_size) :
41 _alloc_search_start(0), 41 _alloc_search_start(0),
42 // The line below is the worst bit of C++ hackery I've ever written 42 // The line below is the worst bit of C++ hackery I've ever written
43 // (Detlefs, 11/23). You should think of it as equivalent to 43 // (Detlefs, 11/23). You should think of it as equivalent to
44 // "_regions(100, true)": initialize the growable array and inform it 44 // "_regions(100, true)": initialize the growable array and inform it
45 // that it should allocate its elem array(s) on the C heap. The first 45 // that it should allocate its elem array(s) on the C heap. The first
48 // is *already* allocated on the C heap: it uses the placement syntax to 48 // is *already* allocated on the C heap: it uses the placement syntax to
49 // keep it from actually doing any allocation. 49 // keep it from actually doing any allocation.
50 _regions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>), 50 _regions((ResourceObj::operator new (sizeof(GrowableArray<HeapRegion*>),
51 (void*)&_regions, 51 (void*)&_regions,
52 ResourceObj::C_HEAP), 52 ResourceObj::C_HEAP),
53 100), 53 (int)max_size),
54 true), 54 true),
55 _next_rr_candidate(0), 55 _next_rr_candidate(0),
56 _seq_bottom(NULL) 56 _seq_bottom(NULL)
57 {} 57 {}
58 58
165 165
166 166
167 // Public methods. 167 // Public methods.
168 168
169 void HeapRegionSeq::insert(HeapRegion* hr) { 169 void HeapRegionSeq::insert(HeapRegion* hr) {
170 assert(!_regions.is_full(), "Too many elements in HeapRegionSeq");
170 if (_regions.length() == 0 171 if (_regions.length() == 0
171 || _regions.top()->end() <= hr->bottom()) { 172 || _regions.top()->end() <= hr->bottom()) {
172 hr->set_hrs_index(_regions.length()); 173 hr->set_hrs_index(_regions.length());
173 _regions.append(hr); 174 _regions.append(hr);
174 } else { 175 } else {

mercurial