comparison src/share/vm/gc_implementation/g1/heapRegion.hpp @ 4912:a9647476d1a4

7132029: G1: mixed GC phase lasts for longer than it should Summary: Revamp of the mechanism that chooses old regions for inclusion in the CSet. It simplifies the code and introduces min and max bounds on the number of old regions added to the CSet at each mixed GC to avoid pathological cases. It also ensures that when we do a mixed GC we'll always find old regions to add to the CSet (i.e., it eliminates the case where a mixed GC will collect no old regions which can happen today). Reviewed-by: johnc, brutisso
author tonyp
date Wed, 15 Feb 2012 13:06:53 -0500
parents d30fa85f9994
children 2a0172480595
comparison
equal deleted inserted replaced
4911:d903bf750e9f 4912:a9647476d1a4
411 size_t used_at_mark_start_bytes = 411 size_t used_at_mark_start_bytes =
412 (prev_top_at_mark_start() - bottom()) * HeapWordSize; 412 (prev_top_at_mark_start() - bottom()) * HeapWordSize;
413 assert(used_at_mark_start_bytes >= marked_bytes(), 413 assert(used_at_mark_start_bytes >= marked_bytes(),
414 "Can't mark more than we have."); 414 "Can't mark more than we have.");
415 return used_at_mark_start_bytes - marked_bytes(); 415 return used_at_mark_start_bytes - marked_bytes();
416 }
417
418 // Return the amount of bytes we'll reclaim if we collect this
419 // region. This includes not only the known garbage bytes in the
420 // region but also any unallocated space in it, i.e., [top, end),
421 // since it will also be reclaimed if we collect the region.
422 size_t reclaimable_bytes() {
423 size_t known_live_bytes = live_bytes();
424 assert(known_live_bytes <= capacity(), "sanity");
425 return capacity() - known_live_bytes;
416 } 426 }
417 427
418 // An upper bound on the number of live bytes in the region. 428 // An upper bound on the number of live bytes in the region.
419 size_t max_live_bytes() { return used() - garbage_bytes(); } 429 size_t max_live_bytes() { return used() - garbage_bytes(); }
420 430
646 656
647 zero_marked_bytes(); 657 zero_marked_bytes();
648 init_top_at_mark_start(); 658 init_top_at_mark_start();
649 } 659 }
650 660
651 // <PREDICTION>
652 void calc_gc_efficiency(void); 661 void calc_gc_efficiency(void);
653 double gc_efficiency() { return _gc_efficiency;} 662 double gc_efficiency() { return _gc_efficiency;}
654 // </PREDICTION>
655 663
656 bool is_young() const { return _young_type != NotYoung; } 664 bool is_young() const { return _young_type != NotYoung; }
657 bool is_survivor() const { return _young_type == Survivor; } 665 bool is_survivor() const { return _young_type == Survivor; }
658 666
659 int young_index_in_cset() const { return _young_index_in_cset; } 667 int young_index_in_cset() const { return _young_index_in_cset; }