annotate src/share/vm/memory/freeList.hpp @ 6028:f69a5d43dc19

7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary* Summary: Fix naming style to be consistent with the predominant hotspot style. Reviewed-by: ysr, brutisso
author jmasa
date Wed, 25 Apr 2012 09:55:55 -0700
parents 9f059abe8cf2
children b9a9ed0f8eeb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
2 * Copyright (c) 2001, 2010, Oracle and/or its affiliates. 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 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1145
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1145
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1145
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
25 #ifndef SHARE_VM_MEMORY_FREELIST_HPP
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
26 #define SHARE_VM_MEMORY_FREELIST_HPP
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
27
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
28 #include "gc_implementation/shared/allocationStats.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29
0
a61af66fc99e Initial load
duke
parents:
diff changeset
30 class CompactibleFreeListSpace;
a61af66fc99e Initial load
duke
parents:
diff changeset
31
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
32 // A class for maintaining a free list of Chunk's. The FreeList
0
a61af66fc99e Initial load
duke
parents:
diff changeset
33 // maintains a the structure of the list (head, tail, etc.) plus
a61af66fc99e Initial load
duke
parents:
diff changeset
34 // statistics for allocations from the list. The links between items
a61af66fc99e Initial load
duke
parents:
diff changeset
35 // are not part of FreeList. The statistics are
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
36 // used to make decisions about coalescing Chunk's when they
0
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // are swept during collection.
a61af66fc99e Initial load
duke
parents:
diff changeset
38 //
a61af66fc99e Initial load
duke
parents:
diff changeset
39 // See the corresponding .cpp file for a description of the specifics
a61af66fc99e Initial load
duke
parents:
diff changeset
40 // for that implementation.
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 class Mutex;
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
43 template <class Chunk> class TreeList;
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
44 template <class Chunk> class PrintTreeCensusClosure;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
45
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
46 template <class Chunk>
0
a61af66fc99e Initial load
duke
parents:
diff changeset
47 class FreeList VALUE_OBJ_CLASS_SPEC {
a61af66fc99e Initial load
duke
parents:
diff changeset
48 friend class CompactibleFreeListSpace;
152
c70a245cad3a 6670684: 4/5 SA command universe did not print out CMS space information
dcubed
parents: 12
diff changeset
49 friend class VMStructs;
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
50 friend class PrintTreeCensusClosure<Chunk>;
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
51
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
52 private:
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
53 Chunk* _head; // Head of list of free chunks
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
54 Chunk* _tail; // Tail of list of free chunks
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
55 size_t _size; // Size in Heap words of each chunk
0
a61af66fc99e Initial load
duke
parents:
diff changeset
56 ssize_t _count; // Number of entries in list
a61af66fc99e Initial load
duke
parents:
diff changeset
57 size_t _hint; // next larger size list with a positive surplus
a61af66fc99e Initial load
duke
parents:
diff changeset
58
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
59 AllocationStats _allocation_stats; // allocation-related statistics
0
a61af66fc99e Initial load
duke
parents:
diff changeset
60
a61af66fc99e Initial load
duke
parents:
diff changeset
61 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
62 Mutex* _protecting_lock;
a61af66fc99e Initial load
duke
parents:
diff changeset
63 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
64
a61af66fc99e Initial load
duke
parents:
diff changeset
65 // Asserts false if the protecting lock (if any) is not held.
a61af66fc99e Initial load
duke
parents:
diff changeset
66 void assert_proper_lock_protection_work() const PRODUCT_RETURN;
a61af66fc99e Initial load
duke
parents:
diff changeset
67 void assert_proper_lock_protection() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
68 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
69 if (_protecting_lock != NULL)
a61af66fc99e Initial load
duke
parents:
diff changeset
70 assert_proper_lock_protection_work();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
72 }
a61af66fc99e Initial load
duke
parents:
diff changeset
73
a61af66fc99e Initial load
duke
parents:
diff changeset
74 // Initialize the allocation statistics.
a61af66fc99e Initial load
duke
parents:
diff changeset
75 protected:
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
76 void init_statistics(bool split_birth = false);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
77 void set_count(ssize_t v) { _count = v;}
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
78 void increment_count() {
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
79 _count++;
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
80 }
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
81
0
a61af66fc99e Initial load
duke
parents:
diff changeset
82 void decrement_count() {
a61af66fc99e Initial load
duke
parents:
diff changeset
83 _count--;
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
84 assert(_count >= 0, "Count should not be negative");
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
85 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
86
a61af66fc99e Initial load
duke
parents:
diff changeset
87 public:
a61af66fc99e Initial load
duke
parents:
diff changeset
88 // Constructor
a61af66fc99e Initial load
duke
parents:
diff changeset
89 // Construct a list without any entries.
a61af66fc99e Initial load
duke
parents:
diff changeset
90 FreeList();
a61af66fc99e Initial load
duke
parents:
diff changeset
91 // Construct a list with "fc" as the first (and lone) entry in the list.
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
92 FreeList(Chunk* fc);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
93
a61af66fc99e Initial load
duke
parents:
diff changeset
94 // Reset the head, tail, hint, and count of a free list.
a61af66fc99e Initial load
duke
parents:
diff changeset
95 void reset(size_t hint);
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 // Declare the current free list to be protected by the given lock.
a61af66fc99e Initial load
duke
parents:
diff changeset
98 #ifdef ASSERT
a61af66fc99e Initial load
duke
parents:
diff changeset
99 void set_protecting_lock(Mutex* protecting_lock) {
a61af66fc99e Initial load
duke
parents:
diff changeset
100 _protecting_lock = protecting_lock;
a61af66fc99e Initial load
duke
parents:
diff changeset
101 }
a61af66fc99e Initial load
duke
parents:
diff changeset
102 #endif
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 // Accessors.
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
105 Chunk* head() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
106 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
107 return _head;
a61af66fc99e Initial load
duke
parents:
diff changeset
108 }
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
109 void set_head(Chunk* v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
110 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
111 _head = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
112 assert(!_head || _head->size() == _size, "bad chunk size");
a61af66fc99e Initial load
duke
parents:
diff changeset
113 }
a61af66fc99e Initial load
duke
parents:
diff changeset
114 // Set the head of the list and set the prev field of non-null
a61af66fc99e Initial load
duke
parents:
diff changeset
115 // values to NULL.
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
116 void link_head(Chunk* v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
117 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
118 set_head(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
119 // If this method is not used (just set the head instead),
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // this check can be avoided.
a61af66fc99e Initial load
duke
parents:
diff changeset
121 if (v != NULL) {
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
122 v->link_prev(NULL);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }
a61af66fc99e Initial load
duke
parents:
diff changeset
124 }
a61af66fc99e Initial load
duke
parents:
diff changeset
125
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
126 Chunk* tail() const {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
127 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
128 return _tail;
a61af66fc99e Initial load
duke
parents:
diff changeset
129 }
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
130 void set_tail(Chunk* v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
131 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
132 _tail = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
133 assert(!_tail || _tail->size() == _size, "bad chunk size");
a61af66fc99e Initial load
duke
parents:
diff changeset
134 }
a61af66fc99e Initial load
duke
parents:
diff changeset
135 // Set the tail of the list and set the next field of non-null
a61af66fc99e Initial load
duke
parents:
diff changeset
136 // values to NULL.
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
137 void link_tail(Chunk* v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
138 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
139 set_tail(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
140 if (v != NULL) {
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
141 v->clear_next();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
142 }
a61af66fc99e Initial load
duke
parents:
diff changeset
143 }
a61af66fc99e Initial load
duke
parents:
diff changeset
144
a61af66fc99e Initial load
duke
parents:
diff changeset
145 // No locking checks in read-accessors: lock-free reads (only) are benign.
a61af66fc99e Initial load
duke
parents:
diff changeset
146 // Readers are expected to have the lock if they are doing work that
a61af66fc99e Initial load
duke
parents:
diff changeset
147 // requires atomicity guarantees in sections of code.
a61af66fc99e Initial load
duke
parents:
diff changeset
148 size_t size() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
149 return _size;
a61af66fc99e Initial load
duke
parents:
diff changeset
150 }
a61af66fc99e Initial load
duke
parents:
diff changeset
151 void set_size(size_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
152 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
153 _size = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
154 }
a61af66fc99e Initial load
duke
parents:
diff changeset
155 ssize_t count() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 return _count;
a61af66fc99e Initial load
duke
parents:
diff changeset
157 }
a61af66fc99e Initial load
duke
parents:
diff changeset
158 size_t hint() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
159 return _hint;
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161 void set_hint(size_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
162 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
163 assert(v == 0 || _size < v, "Bad hint"); _hint = v;
a61af66fc99e Initial load
duke
parents:
diff changeset
164 }
a61af66fc99e Initial load
duke
parents:
diff changeset
165
a61af66fc99e Initial load
duke
parents:
diff changeset
166 // Accessors for statistics
a61af66fc99e Initial load
duke
parents:
diff changeset
167 AllocationStats* allocation_stats() {
a61af66fc99e Initial load
duke
parents:
diff changeset
168 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
169 return &_allocation_stats;
a61af66fc99e Initial load
duke
parents:
diff changeset
170 }
a61af66fc99e Initial load
duke
parents:
diff changeset
171
a61af66fc99e Initial load
duke
parents:
diff changeset
172 ssize_t desired() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
173 return _allocation_stats.desired();
a61af66fc99e Initial load
duke
parents:
diff changeset
174 }
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
175 void set_desired(ssize_t v) {
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
176 assert_proper_lock_protection();
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
177 _allocation_stats.set_desired(v);
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
178 }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
179 void compute_desired(float inter_sweep_current,
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
180 float inter_sweep_estimate,
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
181 float intra_sweep_estimate) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
182 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
183 _allocation_stats.compute_desired(_count,
a61af66fc99e Initial load
duke
parents:
diff changeset
184 inter_sweep_current,
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
185 inter_sweep_estimate,
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
186 intra_sweep_estimate);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
187 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
188 ssize_t coal_desired() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
189 return _allocation_stats.coal_desired();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
190 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
191 void set_coal_desired(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
192 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
193 _allocation_stats.set_coal_desired(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
194 }
a61af66fc99e Initial load
duke
parents:
diff changeset
195
a61af66fc99e Initial load
duke
parents:
diff changeset
196 ssize_t surplus() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
197 return _allocation_stats.surplus();
a61af66fc99e Initial load
duke
parents:
diff changeset
198 }
a61af66fc99e Initial load
duke
parents:
diff changeset
199 void set_surplus(ssize_t v) {
a61af66fc99e Initial load
duke
parents:
diff changeset
200 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
201 _allocation_stats.set_surplus(v);
a61af66fc99e Initial load
duke
parents:
diff changeset
202 }
a61af66fc99e Initial load
duke
parents:
diff changeset
203 void increment_surplus() {
a61af66fc99e Initial load
duke
parents:
diff changeset
204 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
205 _allocation_stats.increment_surplus();
a61af66fc99e Initial load
duke
parents:
diff changeset
206 }
a61af66fc99e Initial load
duke
parents:
diff changeset
207 void decrement_surplus() {
a61af66fc99e Initial load
duke
parents:
diff changeset
208 assert_proper_lock_protection();
a61af66fc99e Initial load
duke
parents:
diff changeset
209 _allocation_stats.decrement_surplus();
a61af66fc99e Initial load
duke
parents:
diff changeset
210 }
a61af66fc99e Initial load
duke
parents:
diff changeset
211
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
212 ssize_t bfr_surp() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
213 return _allocation_stats.bfr_surp();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
214 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
215 void set_bfr_surp(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
216 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
217 _allocation_stats.set_bfr_surp(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
218 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
219 ssize_t prev_sweep() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
220 return _allocation_stats.prev_sweep();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
221 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
222 void set_prev_sweep(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
223 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
224 _allocation_stats.set_prev_sweep(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
226 ssize_t before_sweep() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
227 return _allocation_stats.before_sweep();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
228 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
229 void set_before_sweep(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
230 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
231 _allocation_stats.set_before_sweep(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
232 }
a61af66fc99e Initial load
duke
parents:
diff changeset
233
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
234 ssize_t coal_births() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
235 return _allocation_stats.coal_births();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
236 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
237 void set_coal_births(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
238 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
239 _allocation_stats.set_coal_births(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
241 void increment_coal_births() {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
242 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
243 _allocation_stats.increment_coal_births();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
244 }
a61af66fc99e Initial load
duke
parents:
diff changeset
245
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
246 ssize_t coal_deaths() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
247 return _allocation_stats.coal_deaths();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
248 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
249 void set_coal_deaths(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
250 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
251 _allocation_stats.set_coal_deaths(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
252 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
253 void increment_coal_deaths() {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
254 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
255 _allocation_stats.increment_coal_deaths();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
256 }
a61af66fc99e Initial load
duke
parents:
diff changeset
257
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
258 ssize_t split_births() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
259 return _allocation_stats.split_births();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
260 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
261 void set_split_births(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
262 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
263 _allocation_stats.set_split_births(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
264 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
265 void increment_split_births() {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
266 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
267 _allocation_stats.increment_split_births();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
268 }
a61af66fc99e Initial load
duke
parents:
diff changeset
269
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
270 ssize_t split_deaths() const {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
271 return _allocation_stats.split_deaths();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
272 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
273 void set_split_deaths(ssize_t v) {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
274 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
275 _allocation_stats.set_split_deaths(v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
276 }
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
277 void increment_split_deaths() {
0
a61af66fc99e Initial load
duke
parents:
diff changeset
278 assert_proper_lock_protection();
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
279 _allocation_stats.increment_split_deaths();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
280 }
a61af66fc99e Initial load
duke
parents:
diff changeset
281
a61af66fc99e Initial load
duke
parents:
diff changeset
282 NOT_PRODUCT(
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
283 // For debugging. The "_returned_bytes" in all the lists are summed
0
a61af66fc99e Initial load
duke
parents:
diff changeset
284 // and compared with the total number of bytes swept during a
a61af66fc99e Initial load
duke
parents:
diff changeset
285 // collection.
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
286 size_t returned_bytes() const { return _allocation_stats.returned_bytes(); }
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
287 void set_returned_bytes(size_t v) { _allocation_stats.set_returned_bytes(v); }
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
288 void increment_returned_bytes_by(size_t v) {
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
289 _allocation_stats.set_returned_bytes(_allocation_stats.returned_bytes() + v);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
290 }
a61af66fc99e Initial load
duke
parents:
diff changeset
291 )
a61af66fc99e Initial load
duke
parents:
diff changeset
292
a61af66fc99e Initial load
duke
parents:
diff changeset
293 // Unlink head of list and return it. Returns NULL if
a61af66fc99e Initial load
duke
parents:
diff changeset
294 // the list is empty.
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
295 Chunk* get_chunk_at_head();
0
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 // Remove the first "n" or "count", whichever is smaller, chunks from the
a61af66fc99e Initial load
duke
parents:
diff changeset
298 // list, setting "fl", which is required to be empty, to point to them.
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
299 void getFirstNChunksFromList(size_t n, FreeList<Chunk>* fl);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 // Unlink this chunk from it's free list
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
302 void remove_chunk(Chunk* fc);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
303
a61af66fc99e Initial load
duke
parents:
diff changeset
304 // Add this chunk to this free list.
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
305 void return_chunk_at_head(Chunk* fc);
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
306 void return_chunk_at_tail(Chunk* fc);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
307
a61af66fc99e Initial load
duke
parents:
diff changeset
308 // Similar to returnChunk* but also records some diagnostic
a61af66fc99e Initial load
duke
parents:
diff changeset
309 // information.
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
310 void return_chunk_at_head(Chunk* fc, bool record_return);
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
311 void return_chunk_at_tail(Chunk* fc, bool record_return);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
312
a61af66fc99e Initial load
duke
parents:
diff changeset
313 // Prepend "fl" (whose size is required to be the same as that of "this")
a61af66fc99e Initial load
duke
parents:
diff changeset
314 // to the front of "this" list.
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
315 void prepend(FreeList<Chunk>* fl);
0
a61af66fc99e Initial load
duke
parents:
diff changeset
316
a61af66fc99e Initial load
duke
parents:
diff changeset
317 // Verify that the chunk is in the list.
a61af66fc99e Initial load
duke
parents:
diff changeset
318 // found. Return NULL if "fc" is not found.
6028
f69a5d43dc19 7164144: Fix variable naming style in freeBlockDictionary.* and binaryTreeDictionary*
jmasa
parents: 6026
diff changeset
319 bool verify_chunk_in_free_list(Chunk* fc) const;
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
320
1145
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
321 // Stats verification
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
322 void verify_stats() const PRODUCT_RETURN;
e018e6884bd8 6631166: CMS: better heuristics when combatting fragmentation
ysr
parents: 196
diff changeset
323
12
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
324 // Printing support
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
325 static void print_labels_on(outputStream* st, const char* c);
6432c3bb6240 6668743: CMS: Consolidate block statistics reporting code
ysr
parents: 0
diff changeset
326 void print_on(outputStream* st, const char* c = NULL) const;
0
a61af66fc99e Initial load
duke
parents:
diff changeset
327 };
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
328
6026
9f059abe8cf2 7131629: Generalize the CMS free list code
jmasa
parents: 1972
diff changeset
329 #endif // SHARE_VM_MEMORY_FREELIST_HPP