60 friend class hrs_ext_msg; |
60 friend class hrs_ext_msg; |
61 friend class HRSPhaseSetter; |
61 friend class HRSPhaseSetter; |
62 friend class VMStructs; |
62 friend class VMStructs; |
63 |
63 |
64 protected: |
64 protected: |
65 static size_t calculate_region_num(HeapRegion* hr); |
65 static uint calculate_region_num(HeapRegion* hr); |
66 |
66 |
67 static size_t _unrealistically_long_length; |
67 static uint _unrealistically_long_length; |
68 |
68 |
69 // The number of regions added to the set. If the set contains |
69 // The number of regions added to the set. If the set contains |
70 // only humongous regions, this reflects only 'starts humongous' |
70 // only humongous regions, this reflects only 'starts humongous' |
71 // regions and does not include 'continues humongous' ones. |
71 // regions and does not include 'continues humongous' ones. |
72 size_t _length; |
72 uint _length; |
73 |
73 |
74 // The total number of regions represented by the set. If the set |
74 // The total number of regions represented by the set. If the set |
75 // does not contain humongous regions, this should be the same as |
75 // does not contain humongous regions, this should be the same as |
76 // _length. If the set contains only humongous regions, this will |
76 // _length. If the set contains only humongous regions, this will |
77 // include the 'continues humongous' regions. |
77 // include the 'continues humongous' regions. |
78 size_t _region_num; |
78 uint _region_num; |
79 |
79 |
80 // We don't keep track of the total capacity explicitly, we instead |
80 // We don't keep track of the total capacity explicitly, we instead |
81 // recalculate it based on _region_num and the heap region size. |
81 // recalculate it based on _region_num and the heap region size. |
82 |
82 |
83 // The sum of used bytes in the all the regions in the set. |
83 // The sum of used bytes in the all the regions in the set. |
84 size_t _total_used_bytes; |
84 size_t _total_used_bytes; |
85 |
85 |
86 const char* _name; |
86 const char* _name; |
87 |
87 |
88 bool _verify_in_progress; |
88 bool _verify_in_progress; |
89 size_t _calc_length; |
89 uint _calc_length; |
90 size_t _calc_region_num; |
90 uint _calc_region_num; |
91 size_t _calc_total_capacity_bytes; |
91 size_t _calc_total_capacity_bytes; |
92 size_t _calc_total_used_bytes; |
92 size_t _calc_total_used_bytes; |
93 |
93 |
94 // This is here so that it can be used in the subclasses to assert |
94 // This is here so that it can be used in the subclasses to assert |
95 // something different depending on which phase the GC is in. This |
95 // something different depending on which phase the GC is in. This |
151 virtual void clear(); |
151 virtual void clear(); |
152 |
152 |
153 HeapRegionSetBase(const char* name); |
153 HeapRegionSetBase(const char* name); |
154 |
154 |
155 public: |
155 public: |
156 static void set_unrealistically_long_length(size_t len); |
156 static void set_unrealistically_long_length(uint len); |
157 |
157 |
158 const char* name() { return _name; } |
158 const char* name() { return _name; } |
159 |
159 |
160 size_t length() { return _length; } |
160 uint length() { return _length; } |
161 |
161 |
162 bool is_empty() { return _length == 0; } |
162 bool is_empty() { return _length == 0; } |
163 |
163 |
164 size_t region_num() { return _region_num; } |
164 uint region_num() { return _region_num; } |
165 |
165 |
166 size_t total_capacity_bytes() { |
166 size_t total_capacity_bytes() { |
167 return region_num() << HeapRegion::LogOfHRGrainBytes; |
167 return (size_t) region_num() << HeapRegion::LogOfHRGrainBytes; |
168 } |
168 } |
169 |
169 |
170 size_t total_used_bytes() { return _total_used_bytes; } |
170 size_t total_used_bytes() { return _total_used_bytes; } |
171 |
171 |
172 virtual void verify(); |
172 virtual void verify(); |
339 // (i.e., they have been tagged with "pending_removal"). The list |
339 // (i.e., they have been tagged with "pending_removal"). The list |
340 // must not be empty, target_count should reflect the exact number |
340 // must not be empty, target_count should reflect the exact number |
341 // of regions that are pending for removal in the list, and |
341 // of regions that are pending for removal in the list, and |
342 // target_count should be > 1 (currently, we never need to remove a |
342 // target_count should be > 1 (currently, we never need to remove a |
343 // single region using this). |
343 // single region using this). |
344 void remove_all_pending(size_t target_count); |
344 void remove_all_pending(uint target_count); |
345 |
345 |
346 virtual void verify(); |
346 virtual void verify(); |
347 |
347 |
348 virtual void print_on(outputStream* out, bool print_contents = false); |
348 virtual void print_on(outputStream* out, bool print_contents = false); |
349 }; |
349 }; |