annotate src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @ 20336:6701abbc4441

8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data Summary: Let HeapRegionSeq manage the heap region and auxiliary data to decrease the amount of responsibilities of G1CollectedHeap, and encapsulate this work from other code. Reviewed-by: jwilhelm, jmasa, mgerdin, brutisso
author tschatzl
date Tue, 19 Aug 2014 10:50:27 +0200
parents eec72fa4b108
children 1f1d373cd044
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
1 /*
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17736
diff changeset
2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
4 *
37f87013dfd8 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
37f87013dfd8 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
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
7 * published by the Free Software Foundation.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
8 *
37f87013dfd8 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
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
37f87013dfd8 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
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
13 * accompanied this code).
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
14 *
37f87013dfd8 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
37f87013dfd8 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,
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 960
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 960
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 960
diff changeset
21 * questions.
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
22 *
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
23 */
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
24
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1886
diff changeset
25 #include "precompiled.hpp"
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
26 #include "gc_implementation/g1/heapRegion.hpp"
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
27 #include "gc_implementation/g1/heapRegionSeq.inline.hpp"
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
28 #include "gc_implementation/g1/heapRegionSet.inline.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1886
diff changeset
29 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
30 #include "gc_implementation/g1/concurrentG1Refine.hpp"
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1886
diff changeset
31 #include "memory/allocation.hpp"
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
32
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
33 void HeapRegionSeq::initialize(ReservedSpace reserved) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
34 _reserved = reserved;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
35 _storage.initialize(reserved, 0);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
36
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
37 _num_committed = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
38
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
39 _allocated_heapregions_length = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
40
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
41 _regions.initialize((HeapWord*)_storage.low_boundary(), (HeapWord*)_storage.high_boundary(), HeapRegion::GrainBytes);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
42 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
43
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
44 bool HeapRegionSeq::is_available(uint region) const {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
45 return region < _num_committed;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
46 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
47
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
48 #ifdef ASSERT
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
49 bool HeapRegionSeq::is_free(HeapRegion* hr) const {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
50 return _free_list.contains(hr);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
51 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
52 #endif
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
53
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
54 HeapRegion* HeapRegionSeq::new_heap_region(uint hrs_index) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
55 HeapWord* bottom = G1CollectedHeap::heap()->bottom_addr_for_region(hrs_index);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
56 MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
57 assert(reserved().contains(mr), "invariant");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
58 return new HeapRegion(hrs_index, G1CollectedHeap::heap()->bot_shared(), mr);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
59 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
60
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
61 void HeapRegionSeq::update_committed_space(HeapWord* old_end,
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
62 HeapWord* new_end) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
63 assert(old_end != new_end, "don't call this otherwise");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
64 // We may not have officially committed the area. So construct and use a separate one.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
65 MemRegion new_committed(heap_bottom(), new_end);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
66 // Tell the card table about the update.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
67 Universe::heap()->barrier_set()->resize_covered_region(new_committed);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
68 // Tell the BOT about the update.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
69 G1CollectedHeap::heap()->bot_shared()->resize(new_committed.word_size());
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
70 // Tell the hot card cache about the update
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
71 G1CollectedHeap::heap()->concurrent_g1_refine()->hot_card_cache()->resize_card_counts(new_committed.byte_size());
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
72 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
73
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
74 void HeapRegionSeq::commit_regions(uint index, size_t num_regions) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
75 guarantee(num_regions > 0, "Must commit more than zero regions");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
76 guarantee(_num_committed + num_regions <= max_length(), "Cannot commit more than the maximum amount of regions");
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
77
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
78 _storage.expand_by(num_regions * HeapRegion::GrainBytes);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
79 update_committed_space(heap_top(), heap_top() + num_regions * HeapRegion::GrainWords);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
80 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
81
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
82 void HeapRegionSeq::uncommit_regions(uint start, size_t num_regions) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
83 guarantee(num_regions >= 1, "Need to specify at least one region to uncommit");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
84 guarantee(_num_committed >= num_regions, "pre-condition");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
85
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
86 // Print before uncommitting.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
87 if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
88 for (uint i = start; i < start + num_regions; i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
89 HeapRegion* hr = at(i);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
90 G1CollectedHeap::heap()->hr_printer()->uncommit(hr->bottom(), hr->end());
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
91 }
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
92 }
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
93
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
94 HeapWord* old_end = heap_top();
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
95 _num_committed -= (uint)num_regions;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
96 OrderAccess::fence();
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
97
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
98 _storage.shrink_by(num_regions * HeapRegion::GrainBytes);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
99 update_committed_space(old_end, heap_top());
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
100 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
101
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
102 void HeapRegionSeq::make_regions_available(uint start, uint num_regions) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
103 guarantee(num_regions > 0, "No point in calling this for zero regions");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
104 commit_regions(start, num_regions);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
105 for (uint i = start; i < start + num_regions; i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
106 if (_regions.get_by_index(i) == NULL) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
107 HeapRegion* new_hr = new_heap_region(i);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
108 _regions.set_by_index(i, new_hr);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
109 _allocated_heapregions_length = MAX2(_allocated_heapregions_length, i + 1);
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
110 }
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
111 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
112
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
113 _num_committed += (size_t)num_regions;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
114
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
115 OrderAccess::fence();
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
116
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
117 for (uint i = start; i < start + num_regions; i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
118 assert(is_available(i), err_msg("Just made region %u available but is apparently not.", i));
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
119 HeapRegion* hr = at(i);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
120 if (G1CollectedHeap::heap()->hr_printer()->is_active()) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
121 G1CollectedHeap::heap()->hr_printer()->commit(hr->bottom(), hr->end());
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
122 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
123 HeapWord* bottom = G1CollectedHeap::heap()->bottom_addr_for_region(i);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
124 MemRegion mr(bottom, bottom + HeapRegion::GrainWords);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
125
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
126 hr->initialize(mr);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
127 insert_into_free_list(at(i));
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
128 }
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
129 }
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
130
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
131 uint HeapRegionSeq::expand_by(uint num_regions) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
132 // Only ever expand from the end of the heap.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
133 return expand_at(_num_committed, num_regions);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
134 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
135
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
136 uint HeapRegionSeq::expand_at(uint start, uint num_regions) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
137 if (num_regions == 0) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
138 return 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
139 }
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
140
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
141 uint cur = start;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
142 uint idx_last_found = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
143 uint num_last_found = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
144
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
145 uint expanded = 0;
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
146
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
147 while (expanded < num_regions &&
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
148 (num_last_found = find_unavailable_from_idx(cur, &idx_last_found)) > 0) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
149 uint to_expand = MIN2(num_regions - expanded, num_last_found);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
150 make_regions_available(idx_last_found, to_expand);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
151 expanded += to_expand;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
152 cur = idx_last_found + num_last_found + 1;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
153 }
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
154
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
155 verify_optional();
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
156 return expanded;
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
157 }
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
158
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
159 uint HeapRegionSeq::find_contiguous(size_t num, bool empty_only) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
160 uint found = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
161 size_t length_found = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
162 uint cur = 0;
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
163
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
164 while (length_found < num && cur < max_length()) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
165 HeapRegion* hr = _regions.get_by_index(cur);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
166 if ((!empty_only && !is_available(cur)) || (is_available(cur) && hr != NULL && hr->is_empty())) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
167 // This region is a potential candidate for allocation into.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
168 length_found++;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
169 } else {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
170 // This region is not a candidate. The next region is the next possible one.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
171 found = cur + 1;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
172 length_found = 0;
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
173 }
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
174 cur++;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
175 }
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
176
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
177 if (length_found == num) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
178 for (uint i = found; i < (found + num); i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
179 HeapRegion* hr = _regions.get_by_index(i);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
180 // sanity check
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
181 guarantee((!empty_only && !is_available(i)) || (is_available(i) && hr != NULL && hr->is_empty()),
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
182 err_msg("Found region sequence starting at " UINT32_FORMAT ", length " SIZE_FORMAT
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
183 " that is not empty at " UINT32_FORMAT ". Hr is " PTR_FORMAT, found, num, i, p2i(hr)));
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
184 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
185 return found;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
186 } else {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
187 return G1_NO_HRS_INDEX;
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
188 }
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
189 }
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
190
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
191 HeapRegion* HeapRegionSeq::next_region_in_heap(const HeapRegion* r) const {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
192 guarantee(r != NULL, "Start region must be a valid region");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
193 guarantee(is_available(r->hrs_index()), err_msg("Trying to iterate starting from region %u which is not in the heap", r->hrs_index()));
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
194 for (uint i = r->hrs_index() + 1; i < _allocated_heapregions_length; i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
195 HeapRegion* hr = _regions.get_by_index(i);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
196 if (is_available(i)) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
197 return hr;
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
198 }
2152
0fa27f37d4d4 6977804: G1: remove the zero-filling thread
tonyp
parents: 2133
diff changeset
199 }
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
200 return NULL;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
201 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
202
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
203 void HeapRegionSeq::iterate(HeapRegionClosure* blk) const {
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
204 uint len = max_length();
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
205
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
206 for (uint i = 0; i < len; i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
207 if (!is_available(i)) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
208 continue;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
209 }
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
210 guarantee(at(i) != NULL, err_msg("Tried to access region %u that has a NULL HeapRegion*", i));
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
211 bool res = blk->doHeapRegion(at(i));
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
212 if (res) {
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
213 blk->incomplete();
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
214 return;
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
215 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
216 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
217 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
218
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
219 uint HeapRegionSeq::find_unavailable_from_idx(uint start_idx, uint* res_idx) const {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
220 guarantee(res_idx != NULL, "checking");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
221 guarantee(start_idx <= (max_length() + 1), "checking");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
222
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
223 uint num_regions = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
224
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
225 uint cur = start_idx;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
226 while (cur < max_length() && is_available(cur)) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
227 cur++;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
228 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
229 if (cur == max_length()) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
230 return num_regions;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
231 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
232 *res_idx = cur;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
233 while (cur < max_length() && !is_available(cur)) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
234 cur++;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
235 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
236 num_regions = cur - *res_idx;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
237 #ifdef ASSERT
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
238 for (uint i = *res_idx; i < (*res_idx + num_regions); i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
239 assert(!is_available(i), "just checking");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
240 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
241 assert(cur == max_length() || num_regions == 0 || is_available(cur),
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
242 err_msg("The region at the current position %u must be available or at the end of the heap.", cur));
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
243 #endif
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
244 return num_regions;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
245 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
246
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
247 uint HeapRegionSeq::start_region_for_worker(uint worker_i, uint num_workers, uint num_regions) const {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
248 return num_regions * worker_i / num_workers;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
249 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
250
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
251 void HeapRegionSeq::par_iterate(HeapRegionClosure* blk, uint worker_id, uint num_workers, jint claim_value) const {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
252 const uint start_index = start_region_for_worker(worker_id, num_workers, _allocated_heapregions_length);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
253
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
254 // Every worker will actually look at all regions, skipping over regions that
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
255 // are currently not committed.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
256 // This also (potentially) iterates over regions newly allocated during GC. This
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
257 // is no problem except for some extra work.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
258 for (uint count = 0; count < _allocated_heapregions_length; count++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
259 const uint index = (start_index + count) % _allocated_heapregions_length;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
260 assert(0 <= index && index < _allocated_heapregions_length, "sanity");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
261 // Skip over unavailable regions
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
262 if (!is_available(index)) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
263 continue;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
264 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
265 HeapRegion* r = _regions.get_by_index(index);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
266 // We'll ignore "continues humongous" regions (we'll process them
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
267 // when we come across their corresponding "start humongous"
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
268 // region) and regions already claimed.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
269 if (r->claim_value() == claim_value || r->continuesHumongous()) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
270 continue;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
271 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
272 // OK, try to claim it
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
273 if (!r->claimHeapRegion(claim_value)) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
274 continue;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
275 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
276 // Success!
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
277 if (r->startsHumongous()) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
278 // If the region is "starts humongous" we'll iterate over its
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
279 // "continues humongous" first; in fact we'll do them
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
280 // first. The order is important. In one case, calling the
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
281 // closure on the "starts humongous" region might de-allocate
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
282 // and clear all its "continues humongous" regions and, as a
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
283 // result, we might end up processing them twice. So, we'll do
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
284 // them first (note: most closures will ignore them anyway) and
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
285 // then we'll do the "starts humongous" region.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
286 for (uint ch_index = index + 1; ch_index < index + r->region_num(); ch_index++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
287 HeapRegion* chr = _regions.get_by_index(ch_index);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
288
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
289 assert(chr->continuesHumongous(), "Must be humongous region");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
290 assert(chr->humongous_start_region() == r,
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
291 err_msg("Must work on humongous continuation of the original start region "
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
292 PTR_FORMAT ", but is " PTR_FORMAT, p2i(r), p2i(chr)));
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
293 assert(chr->claim_value() != claim_value,
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
294 "Must not have been claimed yet because claiming of humongous continuation first claims the start region");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
295
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
296 bool claim_result = chr->claimHeapRegion(claim_value);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
297 // We should always be able to claim it; no one else should
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
298 // be trying to claim this region.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
299 guarantee(claim_result, "We should always be able to claim the continuesHumongous part of the humongous object");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
300
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
301 bool res2 = blk->doHeapRegion(chr);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
302 if (res2) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
303 return;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
304 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
305
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
306 // Right now, this holds (i.e., no closure that actually
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
307 // does something with "continues humongous" regions
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
308 // clears them). We might have to weaken it in the future,
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
309 // but let's leave these two asserts here for extra safety.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
310 assert(chr->continuesHumongous(), "should still be the case");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
311 assert(chr->humongous_start_region() == r, "sanity");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
312 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
313 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
314
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
315 bool res = blk->doHeapRegion(r);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
316 if (res) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
317 return;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
318 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
319 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
320 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
321
10242
b0d20fa374b4 8013872: G1: HeapRegionSeq::shrink_by() has invalid assert
brutisso
parents: 6197
diff changeset
322 uint HeapRegionSeq::shrink_by(uint num_regions_to_remove) {
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
323 assert(length() > 0, "the region sequence should not be empty");
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
324 assert(length() <= _allocated_heapregions_length, "invariant");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
325 assert(_allocated_heapregions_length > 0, "we should have at least one region committed");
10242
b0d20fa374b4 8013872: G1: HeapRegionSeq::shrink_by() has invalid assert
brutisso
parents: 6197
diff changeset
326 assert(num_regions_to_remove < length(), "We should never remove all regions");
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
327
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
328 if (num_regions_to_remove == 0) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
329 return 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
330 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
331
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
332 uint removed = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
333 uint cur = _allocated_heapregions_length - 1;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
334 uint idx_last_found = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
335 uint num_last_found = 0;
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
336
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
337 if ((num_last_found = find_empty_from_idx_reverse(cur, &idx_last_found)) > 0) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
338 // Only allow uncommit from the end of the heap.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
339 if ((idx_last_found + num_last_found) != _allocated_heapregions_length) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
340 return 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
341 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
342 uint to_remove = MIN2(num_regions_to_remove - removed, num_last_found);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
343
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
344 uncommit_regions(idx_last_found + num_last_found - to_remove, to_remove);
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
345
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
346 cur -= num_last_found;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
347 removed += to_remove;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
348 }
10242
b0d20fa374b4 8013872: G1: HeapRegionSeq::shrink_by() has invalid assert
brutisso
parents: 6197
diff changeset
349
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
350 verify_optional();
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
351
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
352 return removed;
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
353 }
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
354
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
355 uint HeapRegionSeq::find_empty_from_idx_reverse(uint start_idx, uint* res_idx) const {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
356 guarantee(start_idx < _allocated_heapregions_length, "checking");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
357 guarantee(res_idx != NULL, "checking");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
358
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
359 uint num_regions_found = 0;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
360
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
361 jlong cur = start_idx;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
362 while (cur != -1 && !(is_available(cur) && at(cur)->is_empty())) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
363 cur--;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
364 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
365 if (cur == -1) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
366 return num_regions_found;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
367 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
368 jlong old_cur = cur;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
369 // cur indexes the first empty region
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
370 while (cur != -1 && is_available(cur) && at(cur)->is_empty()) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
371 cur--;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
372 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
373 *res_idx = cur + 1;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
374 num_regions_found = old_cur - cur;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
375
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
376 #ifdef ASSERT
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
377 for (uint i = *res_idx; i < (*res_idx + num_regions_found); i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
378 assert(at(i)->is_empty(), "just checking");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
379 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
380 #endif
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
381 return num_regions_found;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
382 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
383
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
384 void HeapRegionSeq::verify() {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
385 guarantee(length() <= _allocated_heapregions_length,
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 3766
diff changeset
386 err_msg("invariant: _length: %u _allocated_length: %u",
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
387 length(), _allocated_heapregions_length));
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
388 guarantee(_allocated_heapregions_length <= max_length(),
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 3766
diff changeset
389 err_msg("invariant: _allocated_length: %u _max_length: %u",
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
390 _allocated_heapregions_length, max_length()));
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
391
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
392 bool prev_committed = true;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
393 uint num_committed = 0;
12305
a19bea467577 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents: 10242
diff changeset
394 HeapWord* prev_end = heap_bottom();
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
395 for (uint i = 0; i < _allocated_heapregions_length; i++) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
396 if (!is_available(i)) {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
397 prev_committed = false;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
398 continue;
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
399 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
400 num_committed++;
12305
a19bea467577 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents: 10242
diff changeset
401 HeapRegion* hr = _regions.get_by_index(i);
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 3766
diff changeset
402 guarantee(hr != NULL, err_msg("invariant: i: %u", i));
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
403 guarantee(!prev_committed || hr->bottom() == prev_end,
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 3766
diff changeset
404 err_msg("invariant i: %u "HR_FORMAT" prev_end: "PTR_FORMAT,
17937
78bbf4d43a14 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 17736
diff changeset
405 i, HR_FORMAT_PARAMS(hr), p2i(prev_end)));
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
406 guarantee(hr->hrs_index() == i,
6010
720b6a76dd9d 7157073: G1: type change size_t -> uint for region counts / indexes
tonyp
parents: 3766
diff changeset
407 err_msg("invariant: i: %u hrs_index(): %u", i, hr->hrs_index()));
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
408 // Asserts will fire if i is >= _length
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
409 HeapWord* addr = hr->bottom();
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
410 guarantee(addr_to_region(addr) == hr, "sanity");
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
411 // We cannot check whether the region is part of a particular set: at the time
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
412 // this method may be called, we have only completed allocation of the regions,
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
413 // but not put into a region set.
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
414 prev_committed = true;
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
415 if (hr->startsHumongous()) {
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
416 prev_end = hr->orig_end();
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
417 } else {
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
418 prev_end = hr->end();
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
419 }
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
420 }
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
421 for (uint i = _allocated_heapregions_length; i < max_length(); i++) {
12305
a19bea467577 7163191: G1: introduce a "heap spanning table" abstraction
tschatzl
parents: 10242
diff changeset
422 guarantee(_regions.get_by_index(i) == NULL, err_msg("invariant i: %u", i));
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
423 }
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
424
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
425 guarantee(num_committed == _num_committed, err_msg("Found %u committed regions, but should be %u", num_committed, _num_committed));
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
426 _free_list.verify();
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
427 }
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
428
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
429 #ifndef PRODUCT
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
430 void HeapRegionSeq::verify_optional() {
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
431 verify();
342
37f87013dfd8 6711316: Open source the Garbage-First garbage collector
ysr
parents:
diff changeset
432 }
3766
c3f1170908be 7045330: G1: Simplify/fix the HeapRegionSeq class
tonyp
parents: 2361
diff changeset
433 #endif // PRODUCT
20336
6701abbc4441 8054818: Refactor HeapRegionSeq to manage heap region and auxiliary data
tschatzl
parents: 20335
diff changeset
434