src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp

changeset 529
0834225a7916
parent 435
a61af66fc99e
child 548
ba764ed4b6f2
equal deleted inserted replaced
450:d825a8a2bd39 529:0834225a7916
533 bool _completed_initialization; 533 bool _completed_initialization;
534 534
535 // In support of ExplicitGCInvokesConcurrent 535 // In support of ExplicitGCInvokesConcurrent
536 static bool _full_gc_requested; 536 static bool _full_gc_requested;
537 unsigned int _collection_count_start; 537 unsigned int _collection_count_start;
538
538 // Should we unload classes this concurrent cycle? 539 // Should we unload classes this concurrent cycle?
539 // Set in response to a concurrent full gc request. 540 bool _should_unload_classes;
540 bool _unload_classes; 541 unsigned int _concurrent_cycles_since_last_unload;
541 bool _unloaded_classes_last_cycle; 542 unsigned int concurrent_cycles_since_last_unload() const {
543 return _concurrent_cycles_since_last_unload;
544 }
542 // Did we (allow) unload classes in the previous concurrent cycle? 545 // Did we (allow) unload classes in the previous concurrent cycle?
543 bool cms_unloaded_classes_last_cycle() const { 546 bool unloaded_classes_last_cycle() const {
544 return _unloaded_classes_last_cycle || CMSClassUnloadingEnabled; 547 return concurrent_cycles_since_last_unload() == 0;
545 } 548 }
546 549
547 // Verification support 550 // Verification support
548 CMSBitMap _verification_mark_bm; 551 CMSBitMap _verification_mark_bm;
549 void verify_after_remark_work_1(); 552 void verify_after_remark_work_1();
649 size_t _numDirtyCards; 652 size_t _numDirtyCards;
650 uint _sweepCount; 653 uint _sweepCount;
651 // number of full gc's since the last concurrent gc. 654 // number of full gc's since the last concurrent gc.
652 uint _full_gcs_since_conc_gc; 655 uint _full_gcs_since_conc_gc;
653 656
654 // if occupancy exceeds this, start a new gc cycle
655 double _initiatingOccupancy;
656 // occupancy used for bootstrapping stats 657 // occupancy used for bootstrapping stats
657 double _bootstrap_occupancy; 658 double _bootstrap_occupancy;
658 659
659 // timer 660 // timer
660 elapsedTimer _timer; 661 elapsedTimer _timer;
823 ReferenceProcessor* ref_processor() { return _ref_processor; } 824 ReferenceProcessor* ref_processor() { return _ref_processor; }
824 void ref_processor_init(); 825 void ref_processor_init();
825 826
826 Mutex* bitMapLock() const { return _markBitMap.lock(); } 827 Mutex* bitMapLock() const { return _markBitMap.lock(); }
827 static CollectorState abstract_state() { return _collectorState; } 828 static CollectorState abstract_state() { return _collectorState; }
828 double initiatingOccupancy() const { return _initiatingOccupancy; }
829 829
830 bool should_abort_preclean() const; // Whether preclean should be aborted. 830 bool should_abort_preclean() const; // Whether preclean should be aborted.
831 size_t get_eden_used() const; 831 size_t get_eden_used() const;
832 size_t get_eden_capacity() const; 832 size_t get_eden_capacity() const;
833 833
847 void collect_in_foreground(bool clear_all_soft_refs); 847 void collect_in_foreground(bool clear_all_soft_refs);
848 848
849 // In support of ExplicitGCInvokesConcurrent 849 // In support of ExplicitGCInvokesConcurrent
850 static void request_full_gc(unsigned int full_gc_count); 850 static void request_full_gc(unsigned int full_gc_count);
851 // Should we unload classes in a particular concurrent cycle? 851 // Should we unload classes in a particular concurrent cycle?
852 bool cms_should_unload_classes() const { 852 bool should_unload_classes() const {
853 assert(!_unload_classes || ExplicitGCInvokesConcurrentAndUnloadsClasses, 853 return _should_unload_classes;
854 "Inconsistency; see CR 6541037"); 854 }
855 return _unload_classes || CMSClassUnloadingEnabled; 855 bool update_should_unload_classes();
856 }
857 856
858 void direct_allocated(HeapWord* start, size_t size); 857 void direct_allocated(HeapWord* start, size_t size);
859 858
860 // Object is dead if not marked and current phase is sweeping. 859 // Object is dead if not marked and current phase is sweeping.
861 bool is_dead_obj(oop obj) const; 860 bool is_dead_obj(oop obj) const;
1020 } 1019 }
1021 void clear_incremental_collection_failed() { 1020 void clear_incremental_collection_failed() {
1022 _incremental_collection_failed = false; 1021 _incremental_collection_failed = false;
1023 } 1022 }
1024 1023
1024 // accessors
1025 void set_expansion_cause(CMSExpansionCause::Cause v) { _expansion_cause = v;}
1026 CMSExpansionCause::Cause expansion_cause() const { return _expansion_cause; }
1027
1025 private: 1028 private:
1026 // For parallel young-gen GC support. 1029 // For parallel young-gen GC support.
1027 CMSParGCThreadState** _par_gc_thread_states; 1030 CMSParGCThreadState** _par_gc_thread_states;
1028 1031
1029 // Reason generation was expanded 1032 // Reason generation was expanded
1030 CMSExpansionCause::Cause _expansion_cause; 1033 CMSExpansionCause::Cause _expansion_cause;
1031
1032 // accessors
1033 void set_expansion_cause(CMSExpansionCause::Cause v) { _expansion_cause = v;}
1034 CMSExpansionCause::Cause expansion_cause() { return _expansion_cause; }
1035 1034
1036 // In support of MinChunkSize being larger than min object size 1035 // In support of MinChunkSize being larger than min object size
1037 const double _dilatation_factor; 1036 const double _dilatation_factor;
1038 1037
1039 enum CollectionTypes { 1038 enum CollectionTypes {
1042 MSC_foreground_collection_type = 2, 1041 MSC_foreground_collection_type = 2,
1043 Unknown_collection_type = 3 1042 Unknown_collection_type = 3
1044 }; 1043 };
1045 1044
1046 CollectionTypes _debug_collection_type; 1045 CollectionTypes _debug_collection_type;
1046
1047 // Fraction of current occupancy at which to start a CMS collection which
1048 // will collect this generation (at least).
1049 double _initiating_occupancy;
1047 1050
1048 protected: 1051 protected:
1049 // Grow generation by specified size (returns false if unable to grow) 1052 // Grow generation by specified size (returns false if unable to grow)
1050 bool grow_by(size_t bytes); 1053 bool grow_by(size_t bytes);
1051 // Grow generation to reserved size. 1054 // Grow generation to reserved size.
1057 virtual void update_gc_stats(int level, bool full); 1060 virtual void update_gc_stats(int level, bool full);
1058 1061
1059 // Maximum available space in the generation (including uncommitted) 1062 // Maximum available space in the generation (including uncommitted)
1060 // space. 1063 // space.
1061 size_t max_available() const; 1064 size_t max_available() const;
1065
1066 // getter and initializer for _initiating_occupancy field.
1067 double initiating_occupancy() const { return _initiating_occupancy; }
1068 void init_initiating_occupancy(intx io, intx tr);
1062 1069
1063 public: 1070 public:
1064 ConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size, 1071 ConcurrentMarkSweepGeneration(ReservedSpace rs, size_t initial_byte_size,
1065 int level, CardTableRS* ct, 1072 int level, CardTableRS* ct,
1066 bool use_adaptive_freelists, 1073 bool use_adaptive_freelists,
1101 1108
1102 // Space enquiries 1109 // Space enquiries
1103 size_t capacity() const; 1110 size_t capacity() const;
1104 size_t used() const; 1111 size_t used() const;
1105 size_t free() const; 1112 size_t free() const;
1106 double occupancy() { return ((double)used())/((double)capacity()); } 1113 double occupancy() const { return ((double)used())/((double)capacity()); }
1107 size_t contiguous_available() const; 1114 size_t contiguous_available() const;
1108 size_t unsafe_max_alloc_nogc() const; 1115 size_t unsafe_max_alloc_nogc() const;
1109 1116
1110 // over-rides 1117 // over-rides
1111 MemRegion used_region() const; 1118 MemRegion used_region() const;
1156 1163
1157 virtual bool promotion_attempt_is_safe(size_t promotion_in_bytes, 1164 virtual bool promotion_attempt_is_safe(size_t promotion_in_bytes,
1158 bool younger_handles_promotion_failure) const; 1165 bool younger_handles_promotion_failure) const;
1159 1166
1160 bool should_collect(bool full, size_t size, bool tlab); 1167 bool should_collect(bool full, size_t size, bool tlab);
1161 // XXXPERM 1168 virtual bool should_concurrent_collect() const;
1162 bool shouldConcurrentCollect(double initiatingOccupancy); // XXXPERM 1169 virtual bool is_too_full() const;
1163 void collect(bool full, 1170 void collect(bool full,
1164 bool clear_all_soft_refs, 1171 bool clear_all_soft_refs,
1165 size_t size, 1172 size_t size,
1166 bool tlab); 1173 bool tlab);
1167 1174

mercurial