comparison src/share/vm/gc_implementation/g1/heapRegionSet.hpp @ 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 a8ea2f110d87
children
comparison
equal deleted inserted replaced
20478:00448aa81791 20481:c02ec279b062
79 79
80 class HeapRegionSetBase VALUE_OBJ_CLASS_SPEC { 80 class HeapRegionSetBase VALUE_OBJ_CLASS_SPEC {
81 friend class VMStructs; 81 friend class VMStructs;
82 private: 82 private:
83 bool _is_humongous; 83 bool _is_humongous;
84 bool _is_empty; 84 bool _is_free;
85 HRSMtSafeChecker* _mt_safety_checker; 85 HRSMtSafeChecker* _mt_safety_checker;
86 86
87 protected: 87 protected:
88 // The number of regions added to the set. If the set contains 88 // The number of regions added to the set. If the set contains
89 // only humongous regions, this reflects only 'starts humongous' 89 // only humongous regions, this reflects only 'starts humongous'
100 100
101 // Indicates whether all regions in the set should be humongous or 101 // Indicates whether all regions in the set should be humongous or
102 // not. Only used during verification. 102 // not. Only used during verification.
103 bool regions_humongous() { return _is_humongous; } 103 bool regions_humongous() { return _is_humongous; }
104 104
105 // Indicates whether all regions in the set should be empty or 105 // Indicates whether all regions in the set should be free or
106 // not. Only used during verification. 106 // not. Only used during verification.
107 bool regions_empty() { return _is_empty; } 107 bool regions_free() { return _is_free; }
108 108
109 void check_mt_safety() { 109 void check_mt_safety() {
110 if (_mt_safety_checker != NULL) { 110 if (_mt_safety_checker != NULL) {
111 _mt_safety_checker->check(); 111 _mt_safety_checker->check();
112 } 112 }
113 } 113 }
114 114
115 virtual void fill_in_ext_msg_extra(hrs_ext_msg* msg) { } 115 virtual void fill_in_ext_msg_extra(hrs_ext_msg* msg) { }
116 116
117 HeapRegionSetBase(const char* name, bool humongous, bool empty, HRSMtSafeChecker* mt_safety_checker); 117 HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker);
118 118
119 public: 119 public:
120 const char* name() { return _name; } 120 const char* name() { return _name; }
121 121
122 uint length() const { return _count.length(); } 122 uint length() const { return _count.length(); }
169 169
170 #define hrs_assert_sets_match(_set1_, _set2_) \ 170 #define hrs_assert_sets_match(_set1_, _set2_) \
171 do { \ 171 do { \
172 assert(((_set1_)->regions_humongous() == \ 172 assert(((_set1_)->regions_humongous() == \
173 (_set2_)->regions_humongous()) && \ 173 (_set2_)->regions_humongous()) && \
174 ((_set1_)->regions_empty() == (_set2_)->regions_empty()), \ 174 ((_set1_)->regions_free() == (_set2_)->regions_free()), \
175 hrs_err_msg("the contents of set %s and set %s should match", \ 175 hrs_err_msg("the contents of set %s and set %s should match", \
176 (_set1_)->name(), (_set2_)->name())); \ 176 (_set1_)->name(), (_set2_)->name())); \
177 } while (0) 177 } while (0)
178 178
179 // This class represents heap region sets whose members are not 179 // This class represents heap region sets whose members are not
182 // the same interface (namely, the HeapRegionSetBase API). 182 // the same interface (namely, the HeapRegionSetBase API).
183 183
184 class HeapRegionSet : public HeapRegionSetBase { 184 class HeapRegionSet : public HeapRegionSetBase {
185 public: 185 public:
186 HeapRegionSet(const char* name, bool humongous, HRSMtSafeChecker* mt_safety_checker): 186 HeapRegionSet(const char* name, bool humongous, HRSMtSafeChecker* mt_safety_checker):
187 HeapRegionSetBase(name, humongous, false /* empty */, mt_safety_checker) { } 187 HeapRegionSetBase(name, humongous, false /* free */, mt_safety_checker) { }
188 188
189 void bulk_remove(const HeapRegionSetCount& removed) { 189 void bulk_remove(const HeapRegionSetCount& removed) {
190 _count.decrement(removed.length(), removed.capacity()); 190 _count.decrement(removed.length(), removed.capacity());
191 } 191 }
192 }; 192 };