comparison src/share/vm/gc_implementation/g1/heapRegionSeq.hpp @ 10242:b0d20fa374b4

8013872: G1: HeapRegionSeq::shrink_by() has invalid assert Summary: Refactored shrink_by() to only use region counts and not byte sizes Reviewed-by: johnc, tschatzl
author brutisso
date Mon, 06 May 2013 21:30:34 +0200
parents d2a62e0f25eb
children a19bea467577
comparison
equal deleted inserted replaced
10241:d17700c82d7d 10242:b0d20fa374b4
90 90
91 // Map a heap address to a biased region index. Assume that the 91 // Map a heap address to a biased region index. Assume that the
92 // address is valid. 92 // address is valid.
93 inline uintx addr_to_index_biased(HeapWord* addr) const; 93 inline uintx addr_to_index_biased(HeapWord* addr) const;
94 94
95 void increment_length(uint* length) { 95 void increment_allocated_length() {
96 assert(*length < _max_length, "pre-condition"); 96 assert(_allocated_length < _max_length, "pre-condition");
97 *length += 1; 97 _allocated_length++;
98 } 98 }
99 99
100 void decrement_length(uint* length) { 100 void increment_length() {
101 assert(*length > 0, "pre-condition"); 101 assert(_length < _max_length, "pre-condition");
102 *length -= 1; 102 _length++;
103 }
104
105 void decrement_length() {
106 assert(_length > 0, "pre-condition");
107 _length--;
103 } 108 }
104 109
105 public: 110 public:
106 // Empty contructor, we'll initialize it with the initialize() method. 111 // Empty contructor, we'll initialize it with the initialize() method.
107 HeapRegionSeq() { } 112 HeapRegionSeq() { }
151 // As above, but start the iteration from hr and loop around. If hr 156 // As above, but start the iteration from hr and loop around. If hr
152 // is NULL, we start from the first region in the heap. 157 // is NULL, we start from the first region in the heap.
153 void iterate_from(HeapRegion* hr, HeapRegionClosure* blk) const; 158 void iterate_from(HeapRegion* hr, HeapRegionClosure* blk) const;
154 159
155 // Tag as uncommitted as many regions that are completely free as 160 // Tag as uncommitted as many regions that are completely free as
156 // possible, up to shrink_bytes, from the suffix of the committed 161 // possible, up to num_regions_to_remove, from the suffix of the committed
157 // sequence. Return a MemRegion that corresponds to the address 162 // sequence. Return the actual number of removed regions.
158 // range of the uncommitted regions. Assume shrink_bytes is page and 163 uint shrink_by(uint num_regions_to_remove);
159 // heap region aligned.
160 MemRegion shrink_by(size_t shrink_bytes, uint* num_regions_deleted);
161 164
162 // Do some sanity checking. 165 // Do some sanity checking.
163 void verify_optional() PRODUCT_RETURN; 166 void verify_optional() PRODUCT_RETURN;
164 }; 167 };
165 168