comparison src/share/vm/gc_implementation/g1/heapRegionSeq.cpp @ 677:96b229c54d1e

6543938: G1: remove the concept of popularity Reviewed-by: iveresov, tonyp
author apetrusenko
date Wed, 25 Mar 2009 13:10:54 -0700
parents 0fbdb4381b99
children eb058abd0562
comparison
equal deleted inserted replaced
649:59f139e8a8d1 677:96b229c54d1e
72 // && _regions.at(i) is contiguous with its predecessor, if any 72 // && _regions.at(i) is contiguous with its predecessor, if any
73 // && sumSizes is the sum of the sizes of the regions in the interval 73 // && sumSizes is the sum of the sizes of the regions in the interval
74 // [first, cur) 74 // [first, cur)
75 HeapRegion* curhr = _regions.at(cur); 75 HeapRegion* curhr = _regions.at(cur);
76 if (curhr->is_empty() 76 if (curhr->is_empty()
77 && !curhr->is_reserved()
78 && (first == cur 77 && (first == cur
79 || (_regions.at(cur-1)->end() == 78 || (_regions.at(cur-1)->end() ==
80 curhr->bottom()))) { 79 curhr->bottom()))) {
81 sumSizes += curhr->capacity() / HeapWordSize; 80 sumSizes += curhr->capacity() / HeapWordSize;
82 } else { 81 } else {
119 // If we started from the beginning, we want to know why we can't alloc. 118 // If we started from the beginning, we want to know why we can't alloc.
120 return NULL; 119 return NULL;
121 } 120 }
122 } 121 }
123 122
124 void HeapRegionSeq::print_empty_runs(bool reserved_are_empty) { 123 void HeapRegionSeq::print_empty_runs() {
125 int empty_run = 0; 124 int empty_run = 0;
126 int n_empty = 0; 125 int n_empty = 0;
127 bool at_least_one_reserved = false;
128 int empty_run_start; 126 int empty_run_start;
129 for (int i = 0; i < _regions.length(); i++) { 127 for (int i = 0; i < _regions.length(); i++) {
130 HeapRegion* r = _regions.at(i); 128 HeapRegion* r = _regions.at(i);
131 if (r->continuesHumongous()) continue; 129 if (r->continuesHumongous()) continue;
132 if (r->is_empty() && (reserved_are_empty || !r->is_reserved())) { 130 if (r->is_empty()) {
133 assert(!r->isHumongous(), "H regions should not be empty."); 131 assert(!r->isHumongous(), "H regions should not be empty.");
134 if (empty_run == 0) empty_run_start = i; 132 if (empty_run == 0) empty_run_start = i;
135 empty_run++; 133 empty_run++;
136 n_empty++; 134 n_empty++;
137 if (r->is_reserved()) {
138 at_least_one_reserved = true;
139 }
140 } else { 135 } else {
141 if (empty_run > 0) { 136 if (empty_run > 0) {
142 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); 137 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run);
143 if (reserved_are_empty && at_least_one_reserved)
144 gclog_or_tty->print("(R)");
145 empty_run = 0; 138 empty_run = 0;
146 at_least_one_reserved = false;
147 } 139 }
148 } 140 }
149 } 141 }
150 if (empty_run > 0) { 142 if (empty_run > 0) {
151 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run); 143 gclog_or_tty->print(" %d:%d", empty_run_start, empty_run);
152 if (reserved_are_empty && at_least_one_reserved) gclog_or_tty->print("(R)");
153 } 144 }
154 gclog_or_tty->print_cr(" [tot = %d]", n_empty); 145 gclog_or_tty->print_cr(" [tot = %d]", n_empty);
155 } 146 }
156 147
157 int HeapRegionSeq::find(HeapRegion* hr) { 148 int HeapRegionSeq::find(HeapRegion* hr) {
191 size_t res = 0; 182 size_t res = 0;
192 int first = _regions.length() - 1; 183 int first = _regions.length() - 1;
193 int cur = first; 184 int cur = first;
194 while (cur >= 0 && 185 while (cur >= 0 &&
195 (_regions.at(cur)->is_empty() 186 (_regions.at(cur)->is_empty()
196 && !_regions.at(cur)->is_reserved()
197 && (first == cur 187 && (first == cur
198 || (_regions.at(cur+1)->bottom() == 188 || (_regions.at(cur+1)->bottom() ==
199 _regions.at(cur)->end())))) { 189 _regions.at(cur)->end())))) {
200 res++; 190 res++;
201 cur--; 191 cur--;