comparison src/share/vm/gc_implementation/g1/heapRegion.hpp @ 1394:1316cec51b4d

6819061: G1: eliminate serial Other times that are proportional to the collection set length 6871109: G1: remove the concept of the scan only prefix Summary: Removed scan only regions and associated code. The young portion of the collection set is now constructed incrementally - when a young region is retired as the current allocation region it is added to the collection set. Reviewed-by: apetrusenko, iveresov, tonyp
author johnc
date Thu, 22 Apr 2010 10:02:38 -0700
parents 1f19207eefc2
children c18cbe5936b8
comparison
equal deleted inserted replaced
1393:6ecb6e6de3d6 1394:1316cec51b4d
1 /* 1 /*
2 * Copyright 2001-2009 Sun Microsystems, Inc. All Rights Reserved. 2 * Copyright 2001-2010 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
245 double _gc_efficiency; 245 double _gc_efficiency;
246 // </PREDICTION> 246 // </PREDICTION>
247 247
248 enum YoungType { 248 enum YoungType {
249 NotYoung, // a region is not young 249 NotYoung, // a region is not young
250 ScanOnly, // a region is young and scan-only
251 Young, // a region is young 250 Young, // a region is young
252 Survivor // a region is young and it contains 251 Survivor // a region is young and it contains
253 // survivor 252 // survivor
254 }; 253 };
255 254
290 //assert(_young_type != new_type, "setting the same type" ); 289 //assert(_young_type != new_type, "setting the same type" );
291 // TODO: add more assertions here 290 // TODO: add more assertions here
292 _young_type = new_type; 291 _young_type = new_type;
293 } 292 }
294 293
294 // Cached attributes used in the collection set policy information
295
296 // The RSet length that was added to the total value
297 // for the collection set.
298 size_t _recorded_rs_length;
299
300 // The predicted elapsed time that was added to total value
301 // for the collection set.
302 double _predicted_elapsed_time_ms;
303
304 // The predicted number of bytes to copy that was added to
305 // the total value for the collection set.
306 size_t _predicted_bytes_to_copy;
307
295 public: 308 public:
296 // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros. 309 // If "is_zeroed" is "true", the region "mr" can be assumed to contain zeros.
297 HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray, 310 HeapRegion(G1BlockOffsetSharedArray* sharedOffsetArray,
298 MemRegion mr, bool is_zeroed); 311 MemRegion mr, bool is_zeroed);
299 312
612 void calc_gc_efficiency(void); 625 void calc_gc_efficiency(void);
613 double gc_efficiency() { return _gc_efficiency;} 626 double gc_efficiency() { return _gc_efficiency;}
614 // </PREDICTION> 627 // </PREDICTION>
615 628
616 bool is_young() const { return _young_type != NotYoung; } 629 bool is_young() const { return _young_type != NotYoung; }
617 bool is_scan_only() const { return _young_type == ScanOnly; }
618 bool is_survivor() const { return _young_type == Survivor; } 630 bool is_survivor() const { return _young_type == Survivor; }
619 631
620 int young_index_in_cset() const { return _young_index_in_cset; } 632 int young_index_in_cset() const { return _young_index_in_cset; }
621 void set_young_index_in_cset(int index) { 633 void set_young_index_in_cset(int index) {
622 assert( (index == -1) || is_young(), "pre-condition" ); 634 assert( (index == -1) || is_young(), "pre-condition" );
625 637
626 int age_in_surv_rate_group() { 638 int age_in_surv_rate_group() {
627 assert( _surv_rate_group != NULL, "pre-condition" ); 639 assert( _surv_rate_group != NULL, "pre-condition" );
628 assert( _age_index > -1, "pre-condition" ); 640 assert( _age_index > -1, "pre-condition" );
629 return _surv_rate_group->age_in_group(_age_index); 641 return _surv_rate_group->age_in_group(_age_index);
630 }
631
632 void recalculate_age_in_surv_rate_group() {
633 assert( _surv_rate_group != NULL, "pre-condition" );
634 assert( _age_index > -1, "pre-condition" );
635 _age_index = _surv_rate_group->recalculate_age_index(_age_index);
636 } 642 }
637 643
638 void record_surv_words_in_group(size_t words_survived) { 644 void record_surv_words_in_group(size_t words_survived) {
639 assert( _surv_rate_group != NULL, "pre-condition" ); 645 assert( _surv_rate_group != NULL, "pre-condition" );
640 assert( _age_index > -1, "pre-condition" ); 646 assert( _age_index > -1, "pre-condition" );
673 assert( _age_index == -1, "pre-condition" ); 679 assert( _age_index == -1, "pre-condition" );
674 } 680 }
675 } 681 }
676 682
677 void set_young() { set_young_type(Young); } 683 void set_young() { set_young_type(Young); }
678
679 void set_scan_only() { set_young_type(ScanOnly); }
680 684
681 void set_survivor() { set_young_type(Survivor); } 685 void set_survivor() { set_young_type(Survivor); }
682 686
683 void set_not_young() { set_young_type(NotYoung); } 687 void set_not_young() { set_young_type(NotYoung); }
684 688
773 void reset_zero_fill() { 777 void reset_zero_fill() {
774 set_zero_fill_state_work(NotZeroFilled); 778 set_zero_fill_state_work(NotZeroFilled);
775 _zero_filler = NULL; 779 _zero_filler = NULL;
776 } 780 }
777 781
782 size_t recorded_rs_length() const { return _recorded_rs_length; }
783 double predicted_elapsed_time_ms() const { return _predicted_elapsed_time_ms; }
784 size_t predicted_bytes_to_copy() const { return _predicted_bytes_to_copy; }
785
786 void set_recorded_rs_length(size_t rs_length) {
787 _recorded_rs_length = rs_length;
788 }
789
790 void set_predicted_elapsed_time_ms(double ms) {
791 _predicted_elapsed_time_ms = ms;
792 }
793
794 void set_predicted_bytes_to_copy(size_t bytes) {
795 _predicted_bytes_to_copy = bytes;
796 }
797
778 #define HeapRegion_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \ 798 #define HeapRegion_OOP_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix) \
779 virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl); 799 virtual void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
780 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DECL) 800 SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(HeapRegion_OOP_SINCE_SAVE_MARKS_DECL)
781 801
782 CompactibleSpace* next_compaction_space() const; 802 CompactibleSpace* next_compaction_space() const;