annotate src/share/vm/gc_implementation/concurrentMarkSweep/freeList.hpp @ 795:215f81b4d9b3

6841831: G1: assert(contains_reference(from),"We just added it!") fires Summary: During parallel rset updating we have to make sure that the worker ids of the refinement threads do not intersect with the worker ids that can be claimed by the mutator threads. Reviewed-by: tonyp
author iveresov
date Mon, 18 May 2009 11:52:46 -0700
parents d1605aabd0a1
children e018e6884bd8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
196
d1605aabd0a1 6719955: Update copyright year
xdono
parents: 152
diff changeset
2 * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
a61af66fc99e Initial load
duke
parents:
diff changeset
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
a61af66fc99e Initial load
duke
parents:
diff changeset
20 * CA 95054 USA or visit www.sun.com if you need additional information or
a61af66fc99e Initial load
duke
parents:
diff changeset
21 * have any questions.
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 class CompactibleFreeListSpace;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 // A class for maintaining a free list of FreeChunk's. The FreeList
a61af66fc99e Initial load
duke
parents:
diff changeset
28 // maintains a the structure of the list (head, tail, etc.) plus
a61af66fc99e Initial load
duke
parents:
diff changeset
29 // statistics for allocations from the list. The links between items
a61af66fc99e Initial load
duke
parents:
diff changeset
30 // are not part of FreeList. The statistics are
a61af66fc99e Initial load
duke
parents:
diff changeset
31 // used to make decisions about coalescing FreeChunk's when they
a61af66fc99e Initial load
duke
parents:
diff changeset
32 // are swept during collection.
a61af66fc99e Initial load
duke
parents:
diff changeset
33 //
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // See the corresponding .cpp file for a description of the specifics
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // for that implementation.
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 class Mutex;
a61af66fc99e Initial load
duke
parents:
diff changeset
38
a61af66fc99e Initial load
duke
parents:
diff changeset
39 class FreeList VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
40 friend class CompactibleFreeListSpace;
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 12
diff changeset
41 friend class VMStructs;
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
42 friend class printTreeCensusClosure;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
43 FreeChunk* _head; // List of free chunks
a61af66fc99e Initial load
duke
parents:
diff changeset
44 FreeChunk* _tail; // Tail of list of free chunks
a61af66fc99e Initial load
duke
parents:
diff changeset
45 size_t _size; // Size in Heap words of each chunks
a61af66fc99e Initial load
duke
parents:
diff changeset
46 ssize_t _count; // Number of entries in list
a61af66fc99e Initial load
duke
parents:
diff changeset
47 size_t _hint; // next larger size list with a positive surplus
a61af66fc99e Initial load
duke
parents:
diff changeset
48
a61af66fc99e Initial load
duke
parents:
diff changeset
49 AllocationStats _allocation_stats; // statistics for smart allocation
a61af66fc99e Initial load
duke
parents:
diff changeset
50
a61af66fc99e Initial load
duke
parents:
diff changeset
51 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
52 Mutex* _protecting_lock;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 // Asserts false if the protecting lock (if any) is not held.
a61af66fc99e Initial load
duke
parents:
diff changeset
56 void assert_proper_lock_protection_work() const PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
57 void assert_proper_lock_protection() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
58 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
59 if (_protecting_lock != NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
60 assert_proper_lock_protection_work();
a61af66fc99e Initial load
duke
parents:
diff changeset
61 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
62 }
a61af66fc99e Initial load
duke
parents:
diff changeset
63
a61af66fc99e Initial load
duke
parents:
diff changeset
64 // Initialize the allocation statistics.
a61af66fc99e Initial load
duke
parents:
diff changeset
65 protected:
a61af66fc99e Initial load
duke
parents:
diff changeset
66 void init_statistics();
a61af66fc99e Initial load
duke
parents:
diff changeset
67 void set_count(ssize_t v) { _count = v;}
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
68 void increment_count() { _count++; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
69 void decrement_count() {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 _count--;
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
71 assert(_count >= 0, "Count should not be negative");
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
72 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
75 // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
76 // Construct a list without any entries.
a61af66fc99e Initial load
duke
parents:
diff changeset
77 FreeList();
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // Construct a list with "fc" as the first (and lone) entry in the list.
a61af66fc99e Initial load
duke
parents:
diff changeset
79 FreeList(FreeChunk* fc);
a61af66fc99e Initial load
duke
parents:
diff changeset
80 // Construct a list which will have a FreeChunk at address "addr" and
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // of size "size" as the first (and lone) entry in the list.
a61af66fc99e Initial load
duke
parents:
diff changeset
82 FreeList(HeapWord* addr, size_t size);
a61af66fc99e Initial load
duke
parents:
diff changeset
83
a61af66fc99e Initial load
duke
parents:
diff changeset
84 // Reset the head, tail, hint, and count of a free list.
a61af66fc99e Initial load
duke
parents:
diff changeset
85 void reset(size_t hint);
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // Declare the current free list to be protected by the given lock.
a61af66fc99e Initial load
duke
parents:
diff changeset
88 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
89 void set_protecting_lock(Mutex* protecting_lock) {
a61af66fc99e Initial load
duke
parents:
diff changeset
90 _protecting_lock = protecting_lock;
a61af66fc99e Initial load
duke
parents:
diff changeset
91 }
a61af66fc99e Initial load
duke
parents:
diff changeset
92 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // Accessors.
a61af66fc99e Initial load
duke
parents:
diff changeset
95 FreeChunk* head() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
96 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
97 return _head;
a61af66fc99e Initial load
duke
parents:
diff changeset
98 }
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void set_head(FreeChunk* v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
101 _head = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
102 assert(!_head || _head->size() == _size, "bad chunk size");
a61af66fc99e Initial load
duke
parents:
diff changeset
103 }
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // Set the head of the list and set the prev field of non-null
a61af66fc99e Initial load
duke
parents:
diff changeset
105 // values to NULL.
a61af66fc99e Initial load
duke
parents:
diff changeset
106 void link_head(FreeChunk* v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
107 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
108 set_head(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 // If this method is not used (just set the head instead),
a61af66fc99e Initial load
duke
parents:
diff changeset
110 // this check can be avoided.
a61af66fc99e Initial load
duke
parents:
diff changeset
111 if (v != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 v->linkPrev(NULL);
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114 }
a61af66fc99e Initial load
duke
parents:
diff changeset
115
a61af66fc99e Initial load
duke
parents:
diff changeset
116 FreeChunk* tail() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
117 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 return _tail;
a61af66fc99e Initial load
duke
parents:
diff changeset
119 }
a61af66fc99e Initial load
duke
parents:
diff changeset
120 void set_tail(FreeChunk* v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
121 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
122 _tail = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
123 assert(!_tail || _tail->size() == _size, "bad chunk size");
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125 // Set the tail of the list and set the next field of non-null
a61af66fc99e Initial load
duke
parents:
diff changeset
126 // values to NULL.
a61af66fc99e Initial load
duke
parents:
diff changeset
127 void link_tail(FreeChunk* v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
128 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
129 set_tail(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
130 if (v != NULL) {
a61af66fc99e Initial load
duke
parents:
diff changeset
131 v->clearNext();
a61af66fc99e Initial load
duke
parents:
diff changeset
132 }
a61af66fc99e Initial load
duke
parents:
diff changeset
133 }
a61af66fc99e Initial load
duke
parents:
diff changeset
134
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // No locking checks in read-accessors: lock-free reads (only) are benign.
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // Readers are expected to have the lock if they are doing work that
a61af66fc99e Initial load
duke
parents:
diff changeset
137 // requires atomicity guarantees in sections of code.
a61af66fc99e Initial load
duke
parents:
diff changeset
138 size_t size() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
139 return _size;
a61af66fc99e Initial load
duke
parents:
diff changeset
140 }
a61af66fc99e Initial load
duke
parents:
diff changeset
141 void set_size(size_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
142 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
143 _size = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 }
a61af66fc99e Initial load
duke
parents:
diff changeset
145 ssize_t count() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
146 return _count;
a61af66fc99e Initial load
duke
parents:
diff changeset
147 }
a61af66fc99e Initial load
duke
parents:
diff changeset
148 size_t hint() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 return _hint;
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151 void set_hint(size_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
153 assert(v == 0 || _size < v, "Bad hint"); _hint = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
154 }
a61af66fc99e Initial load
duke
parents:
diff changeset
155
a61af66fc99e Initial load
duke
parents:
diff changeset
156 // Accessors for statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
157 AllocationStats* allocation_stats() {
a61af66fc99e Initial load
duke
parents:
diff changeset
158 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
159 return &_allocation_stats;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 ssize_t desired() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
163 return _allocation_stats.desired();
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
165 void set_desired(ssize_t v) {
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
166 assert_proper_lock_protection();
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
167 _allocation_stats.set_desired(v);
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
168 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
169 void compute_desired(float inter_sweep_current,
a61af66fc99e Initial load
duke
parents:
diff changeset
170 float inter_sweep_estimate) {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
172 _allocation_stats.compute_desired(_count,
a61af66fc99e Initial load
duke
parents:
diff changeset
173 inter_sweep_current,
a61af66fc99e Initial load
duke
parents:
diff changeset
174 inter_sweep_estimate);
a61af66fc99e Initial load
duke
parents:
diff changeset
175 }
a61af66fc99e Initial load
duke
parents:
diff changeset
176 ssize_t coalDesired() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
177 return _allocation_stats.coalDesired();
a61af66fc99e Initial load
duke
parents:
diff changeset
178 }
a61af66fc99e Initial load
duke
parents:
diff changeset
179 void set_coalDesired(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
180 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
181 _allocation_stats.set_coalDesired(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
182 }
a61af66fc99e Initial load
duke
parents:
diff changeset
183
a61af66fc99e Initial load
duke
parents:
diff changeset
184 ssize_t surplus() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
185 return _allocation_stats.surplus();
a61af66fc99e Initial load
duke
parents:
diff changeset
186 }
a61af66fc99e Initial load
duke
parents:
diff changeset
187 void set_surplus(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
188 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
189 _allocation_stats.set_surplus(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
a61af66fc99e Initial load
duke
parents:
diff changeset
191 void increment_surplus() {
a61af66fc99e Initial load
duke
parents:
diff changeset
192 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
193 _allocation_stats.increment_surplus();
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
a61af66fc99e Initial load
duke
parents:
diff changeset
195 void decrement_surplus() {
a61af66fc99e Initial load
duke
parents:
diff changeset
196 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
197 _allocation_stats.decrement_surplus();
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199
a61af66fc99e Initial load
duke
parents:
diff changeset
200 ssize_t bfrSurp() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
201 return _allocation_stats.bfrSurp();
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 void set_bfrSurp(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
204 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
205 _allocation_stats.set_bfrSurp(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207 ssize_t prevSweep() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
208 return _allocation_stats.prevSweep();
a61af66fc99e Initial load
duke
parents:
diff changeset
209 }
a61af66fc99e Initial load
duke
parents:
diff changeset
210 void set_prevSweep(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
211 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
212 _allocation_stats.set_prevSweep(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
213 }
a61af66fc99e Initial load
duke
parents:
diff changeset
214 ssize_t beforeSweep() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
215 return _allocation_stats.beforeSweep();
a61af66fc99e Initial load
duke
parents:
diff changeset
216 }
a61af66fc99e Initial load
duke
parents:
diff changeset
217 void set_beforeSweep(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
218 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
219 _allocation_stats.set_beforeSweep(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
220 }
a61af66fc99e Initial load
duke
parents:
diff changeset
221
a61af66fc99e Initial load
duke
parents:
diff changeset
222 ssize_t coalBirths() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
223 return _allocation_stats.coalBirths();
a61af66fc99e Initial load
duke
parents:
diff changeset
224 }
a61af66fc99e Initial load
duke
parents:
diff changeset
225 void set_coalBirths(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
226 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
227 _allocation_stats.set_coalBirths(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
228 }
a61af66fc99e Initial load
duke
parents:
diff changeset
229 void increment_coalBirths() {
a61af66fc99e Initial load
duke
parents:
diff changeset
230 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
231 _allocation_stats.increment_coalBirths();
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233
a61af66fc99e Initial load
duke
parents:
diff changeset
234 ssize_t coalDeaths() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
235 return _allocation_stats.coalDeaths();
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
a61af66fc99e Initial load
duke
parents:
diff changeset
237 void set_coalDeaths(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
238 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
239 _allocation_stats.set_coalDeaths(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 void increment_coalDeaths() {
a61af66fc99e Initial load
duke
parents:
diff changeset
242 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
243 _allocation_stats.increment_coalDeaths();
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245
a61af66fc99e Initial load
duke
parents:
diff changeset
246 ssize_t splitBirths() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
247 return _allocation_stats.splitBirths();
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
a61af66fc99e Initial load
duke
parents:
diff changeset
249 void set_splitBirths(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
251 _allocation_stats.set_splitBirths(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
252 }
a61af66fc99e Initial load
duke
parents:
diff changeset
253 void increment_splitBirths() {
a61af66fc99e Initial load
duke
parents:
diff changeset
254 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
255 _allocation_stats.increment_splitBirths();
a61af66fc99e Initial load
duke
parents:
diff changeset
256 }
a61af66fc99e Initial load
duke
parents:
diff changeset
257
a61af66fc99e Initial load
duke
parents:
diff changeset
258 ssize_t splitDeaths() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
259 return _allocation_stats.splitDeaths();
a61af66fc99e Initial load
duke
parents:
diff changeset
260 }
a61af66fc99e Initial load
duke
parents:
diff changeset
261 void set_splitDeaths(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
262 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
263 _allocation_stats.set_splitDeaths(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
264 }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 void increment_splitDeaths() {
a61af66fc99e Initial load
duke
parents:
diff changeset
266 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
267 _allocation_stats.increment_splitDeaths();
a61af66fc99e Initial load
duke
parents:
diff changeset
268 }
a61af66fc99e Initial load
duke
parents:
diff changeset
269
a61af66fc99e Initial load
duke
parents:
diff changeset
270 NOT_PRODUCT(
a61af66fc99e Initial load
duke
parents:
diff changeset
271 // For debugging. The "_returnedBytes" in all the lists are summed
a61af66fc99e Initial load
duke
parents:
diff changeset
272 // and compared with the total number of bytes swept during a
a61af66fc99e Initial load
duke
parents:
diff changeset
273 // collection.
a61af66fc99e Initial load
duke
parents:
diff changeset
274 size_t returnedBytes() const { return _allocation_stats.returnedBytes(); }
a61af66fc99e Initial load
duke
parents:
diff changeset
275 void set_returnedBytes(size_t v) { _allocation_stats.set_returnedBytes(v); }
a61af66fc99e Initial load
duke
parents:
diff changeset
276 void increment_returnedBytes_by(size_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
277 _allocation_stats.set_returnedBytes(_allocation_stats.returnedBytes() + v);
a61af66fc99e Initial load
duke
parents:
diff changeset
278 }
a61af66fc99e Initial load
duke
parents:
diff changeset
279 )
a61af66fc99e Initial load
duke
parents:
diff changeset
280
a61af66fc99e Initial load
duke
parents:
diff changeset
281 // Unlink head of list and return it. Returns NULL if
a61af66fc99e Initial load
duke
parents:
diff changeset
282 // the list is empty.
a61af66fc99e Initial load
duke
parents:
diff changeset
283 FreeChunk* getChunkAtHead();
a61af66fc99e Initial load
duke
parents:
diff changeset
284
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // Remove the first "n" or "count", whichever is smaller, chunks from the
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // list, setting "fl", which is required to be empty, to point to them.
a61af66fc99e Initial load
duke
parents:
diff changeset
287 void getFirstNChunksFromList(size_t n, FreeList* fl);
a61af66fc99e Initial load
duke
parents:
diff changeset
288
a61af66fc99e Initial load
duke
parents:
diff changeset
289 // Unlink this chunk from it's free list
a61af66fc99e Initial load
duke
parents:
diff changeset
290 void removeChunk(FreeChunk* fc);
a61af66fc99e Initial load
duke
parents:
diff changeset
291
a61af66fc99e Initial load
duke
parents:
diff changeset
292 // Add this chunk to this free list.
a61af66fc99e Initial load
duke
parents:
diff changeset
293 void returnChunkAtHead(FreeChunk* fc);
a61af66fc99e Initial load
duke
parents:
diff changeset
294 void returnChunkAtTail(FreeChunk* fc);
a61af66fc99e Initial load
duke
parents:
diff changeset
295
a61af66fc99e Initial load
duke
parents:
diff changeset
296 // Similar to returnChunk* but also records some diagnostic
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // information.
a61af66fc99e Initial load
duke
parents:
diff changeset
298 void returnChunkAtHead(FreeChunk* fc, bool record_return);
a61af66fc99e Initial load
duke
parents:
diff changeset
299 void returnChunkAtTail(FreeChunk* fc, bool record_return);
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 // Prepend "fl" (whose size is required to be the same as that of "this")
a61af66fc99e Initial load
duke
parents:
diff changeset
302 // to the front of "this" list.
a61af66fc99e Initial load
duke
parents:
diff changeset
303 void prepend(FreeList* fl);
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305 // Verify that the chunk is in the list.
a61af66fc99e Initial load
duke
parents:
diff changeset
306 // found. Return NULL if "fc" is not found.
a61af66fc99e Initial load
duke
parents:
diff changeset
307 bool verifyChunkInFreeLists(FreeChunk* fc) const;
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
308
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
309 // Printing support
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
310 static void print_labels_on(outputStream* st, const char* c);
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
311 void print_on(outputStream* st, const char* c = NULL) const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
312 };