< prev index next >
src/share/vm/gc/g1/heapRegionSet.hpp
Print this page
@@ -61,32 +61,10 @@
class MasterFreeRegionListMtSafeChecker : public HRSMtSafeChecker { public: void check(); };
class SecondaryFreeRegionListMtSafeChecker : public HRSMtSafeChecker { public: void check(); };
class HumongousRegionSetMtSafeChecker : public HRSMtSafeChecker { public: void check(); };
class OldRegionSetMtSafeChecker : public HRSMtSafeChecker { public: void check(); };
-class HeapRegionSetCount VALUE_OBJ_CLASS_SPEC {
- friend class VMStructs;
- uint _length;
- size_t _capacity;
-
-public:
- HeapRegionSetCount() : _length(0), _capacity(0) { }
-
- const uint length() const { return _length; }
- const size_t capacity() const { return _capacity; }
-
- void increment(uint length_to_add, size_t capacity_to_add) {
- _length += length_to_add;
- _capacity += capacity_to_add;
- }
-
- void decrement(const uint length_to_remove, const size_t capacity_to_remove) {
- _length -= length_to_remove;
- _capacity -= capacity_to_remove;
- }
-};
-
// Base class for all the classes that represent heap region sets. It
// contains the basic attributes that each set needs to maintain
// (e.g., length, region num, used bytes sum) plus any shared
// functionality (e.g., verification).
@@ -96,14 +74,12 @@
bool _is_humongous;
bool _is_free;
HRSMtSafeChecker* _mt_safety_checker;
protected:
- // The number of regions added to the set. If the set contains
- // only humongous regions, this reflects only 'starts humongous'
- // regions and does not include 'continues humongous' ones.
- HeapRegionSetCount _count;
+ // The number of regions in to the set.
+ uint _length;
const char* _name;
bool _verify_in_progress;
@@ -128,16 +104,16 @@
HeapRegionSetBase(const char* name, bool humongous, bool free, HRSMtSafeChecker* mt_safety_checker);
public:
const char* name() { return _name; }
- uint length() const { return _count.length(); }
+ uint length() const { return _length; }
- bool is_empty() { return _count.length() == 0; }
+ bool is_empty() { return _length == 0; }
size_t total_capacity_bytes() {
- return _count.capacity();
+ return _length * HeapRegion::GrainBytes;
}
// It updates the fields of the set to reflect hr being added to
// the set and tags the region appropriately.
inline void add(HeapRegion* hr);
@@ -179,12 +155,12 @@
class HeapRegionSet : public HeapRegionSetBase {
public:
HeapRegionSet(const char* name, bool humongous, HRSMtSafeChecker* mt_safety_checker):
HeapRegionSetBase(name, humongous, false /* free */, mt_safety_checker) { }
- void bulk_remove(const HeapRegionSetCount& removed) {
- _count.decrement(removed.length(), removed.capacity());
+ void bulk_remove(const uint removed) {
+ _length -= removed;
}
};
// A set that links all the regions added to it in a doubly-linked
// sorted list. We should try to avoid doing operations that iterate over
< prev index next >