Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/g1/heapRegion.cpp @ 20481:c02ec279b062
8057768: Make heap region region type in G1 HeapRegion explicit
Reviewed-by: brutisso, tschatzl
author | brutisso |
---|---|
date | Tue, 16 Sep 2014 14:27:40 +0200 |
parents | 5248357b7113 |
children | 7baf47cb97cb |
comparison
equal
deleted
inserted
replaced
20478:00448aa81791 | 20481:c02ec279b062 |
---|---|
193 zero_marked_bytes(); | 193 zero_marked_bytes(); |
194 init_top_at_mark_start(); | 194 init_top_at_mark_start(); |
195 } | 195 } |
196 | 196 |
197 void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { | 197 void HeapRegion::hr_clear(bool par, bool clear_space, bool locked) { |
198 assert(_humongous_type == NotHumongous, | |
199 "we should have already filtered out humongous regions"); | |
200 assert(_humongous_start_region == NULL, | 198 assert(_humongous_start_region == NULL, |
201 "we should have already filtered out humongous regions"); | 199 "we should have already filtered out humongous regions"); |
202 assert(_end == _orig_end, | 200 assert(_end == _orig_end, |
203 "we should have already filtered out humongous regions"); | 201 "we should have already filtered out humongous regions"); |
204 | 202 |
205 _in_collection_set = false; | 203 _in_collection_set = false; |
206 | 204 |
207 set_allocation_context(AllocationContext::system()); | 205 set_allocation_context(AllocationContext::system()); |
208 set_young_index_in_cset(-1); | 206 set_young_index_in_cset(-1); |
209 uninstall_surv_rate_group(); | 207 uninstall_surv_rate_group(); |
210 set_young_type(NotYoung); | 208 set_free(); |
211 reset_pre_dummy_top(); | 209 reset_pre_dummy_top(); |
212 | 210 |
213 if (!par) { | 211 if (!par) { |
214 // If this is parallel, this will be done later. | 212 // If this is parallel, this will be done later. |
215 HeapRegionRemSet* hrrs = rem_set(); | 213 HeapRegionRemSet* hrrs = rem_set(); |
256 assert(end() == _orig_end, | 254 assert(end() == _orig_end, |
257 "Should be normal before the humongous object allocation"); | 255 "Should be normal before the humongous object allocation"); |
258 assert(top() == bottom(), "should be empty"); | 256 assert(top() == bottom(), "should be empty"); |
259 assert(bottom() <= new_top && new_top <= new_end, "pre-condition"); | 257 assert(bottom() <= new_top && new_top <= new_end, "pre-condition"); |
260 | 258 |
261 _humongous_type = StartsHumongous; | 259 _type.set_starts_humongous(); |
262 _humongous_start_region = this; | 260 _humongous_start_region = this; |
263 | 261 |
264 set_end(new_end); | 262 set_end(new_end); |
265 _offsets.set_for_starts_humongous(new_top); | 263 _offsets.set_for_starts_humongous(new_top); |
266 } | 264 } |
270 assert(end() == _orig_end, | 268 assert(end() == _orig_end, |
271 "Should be normal before the humongous object allocation"); | 269 "Should be normal before the humongous object allocation"); |
272 assert(top() == bottom(), "should be empty"); | 270 assert(top() == bottom(), "should be empty"); |
273 assert(first_hr->startsHumongous(), "pre-condition"); | 271 assert(first_hr->startsHumongous(), "pre-condition"); |
274 | 272 |
275 _humongous_type = ContinuesHumongous; | 273 _type.set_continues_humongous(); |
276 _humongous_start_region = first_hr; | 274 _humongous_start_region = first_hr; |
277 } | 275 } |
278 | 276 |
279 void HeapRegion::set_notHumongous() { | 277 void HeapRegion::clear_humongous() { |
280 assert(isHumongous(), "pre-condition"); | 278 assert(isHumongous(), "pre-condition"); |
281 | 279 |
282 if (startsHumongous()) { | 280 if (startsHumongous()) { |
283 assert(top() <= end(), "pre-condition"); | 281 assert(top() <= end(), "pre-condition"); |
284 set_end(_orig_end); | 282 set_end(_orig_end); |
290 // continues humongous | 288 // continues humongous |
291 assert(end() == _orig_end, "sanity"); | 289 assert(end() == _orig_end, "sanity"); |
292 } | 290 } |
293 | 291 |
294 assert(capacity() == HeapRegion::GrainBytes, "pre-condition"); | 292 assert(capacity() == HeapRegion::GrainBytes, "pre-condition"); |
295 _humongous_type = NotHumongous; | |
296 _humongous_start_region = NULL; | 293 _humongous_start_region = NULL; |
297 } | 294 } |
298 | 295 |
299 bool HeapRegion::claimHeapRegion(jint claimValue) { | 296 bool HeapRegion::claimHeapRegion(jint claimValue) { |
300 jint current = _claimed; | 297 jint current = _claimed; |
334 G1BlockOffsetSharedArray* sharedOffsetArray, | 331 G1BlockOffsetSharedArray* sharedOffsetArray, |
335 MemRegion mr) : | 332 MemRegion mr) : |
336 G1OffsetTableContigSpace(sharedOffsetArray, mr), | 333 G1OffsetTableContigSpace(sharedOffsetArray, mr), |
337 _hrm_index(hrm_index), | 334 _hrm_index(hrm_index), |
338 _allocation_context(AllocationContext::system()), | 335 _allocation_context(AllocationContext::system()), |
339 _humongous_type(NotHumongous), _humongous_start_region(NULL), | 336 _humongous_start_region(NULL), |
340 _in_collection_set(false), | 337 _in_collection_set(false), |
341 _next_in_special_set(NULL), _orig_end(NULL), | 338 _next_in_special_set(NULL), _orig_end(NULL), |
342 _claimed(InitialClaimValue), _evacuation_failed(false), | 339 _claimed(InitialClaimValue), _evacuation_failed(false), |
343 _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0), | 340 _prev_marked_bytes(0), _next_marked_bytes(0), _gc_efficiency(0.0), |
344 _young_type(NotYoung), _next_young_region(NULL), | 341 _next_young_region(NULL), |
345 _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL), | 342 _next_dirty_cards_region(NULL), _next(NULL), _prev(NULL), |
346 #ifdef ASSERT | 343 #ifdef ASSERT |
347 _containing_set(NULL), | 344 _containing_set(NULL), |
348 #endif // ASSERT | 345 #endif // ASSERT |
349 _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1), | 346 _young_index_in_cset(-1), _surv_rate_group(NULL), _age_index(-1), |
701 } | 698 } |
702 | 699 |
703 void HeapRegion::print() const { print_on(gclog_or_tty); } | 700 void HeapRegion::print() const { print_on(gclog_or_tty); } |
704 void HeapRegion::print_on(outputStream* st) const { | 701 void HeapRegion::print_on(outputStream* st) const { |
705 st->print("AC%4u", allocation_context()); | 702 st->print("AC%4u", allocation_context()); |
706 | 703 st->print(" %2s", get_short_type_str()); |
707 if (isHumongous()) { | |
708 if (startsHumongous()) | |
709 st->print(" HS"); | |
710 else | |
711 st->print(" HC"); | |
712 } else { | |
713 st->print(" "); | |
714 } | |
715 if (in_collection_set()) | 704 if (in_collection_set()) |
716 st->print(" CS"); | 705 st->print(" CS"); |
717 else | 706 else |
718 st->print(" "); | 707 st->print(" "); |
719 if (is_young()) | |
720 st->print(is_survivor() ? " SU" : " Y "); | |
721 else | |
722 st->print(" "); | |
723 if (is_empty()) | |
724 st->print(" F"); | |
725 else | |
726 st->print(" "); | |
727 st->print(" TS %5d", _gc_time_stamp); | 708 st->print(" TS %5d", _gc_time_stamp); |
728 st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT, | 709 st->print(" PTAMS "PTR_FORMAT" NTAMS "PTR_FORMAT, |
729 prev_top_at_mark_start(), next_top_at_mark_start()); | 710 prev_top_at_mark_start(), next_top_at_mark_start()); |
730 G1OffsetTableContigSpace::print_on(st); | 711 G1OffsetTableContigSpace::print_on(st); |
731 } | 712 } |