annotate src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp @ 1994:6cd6d394f280

7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed()) 7002546: regression on SpecJbb2005 on 7b118 comparing to 7b117 on small heaps Summary: Relaxed assertion checking related to incremental_collection_failed flag to allow for ExplicitGCInvokesConcurrent behaviour where we do not want a failing scavenge to bail to a stop-world collection. Parameterized incremental_collection_will_fail() so we can selectively use, or not use, as appropriate, the statistical prediction at specific use sites. This essentially reverts the scavenge bail-out logic to what it was prior to some recent changes that had inadvertently started using the statistical prediction which can be noisy in the presence of bursty loads. Added some associated verbose non-product debugging messages. Reviewed-by: johnc, tonyp
author ysr
date Tue, 07 Dec 2010 21:55:53 -0800
parents f95d63e2154a
children da91efe96a93
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: 196
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 196
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: 196
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
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
25 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
26 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
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/concurrentMarkSweep/cmsLockVerifier.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
29 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
30 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
31 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
32 #include "gc_implementation/shared/gcUtil.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
33 #include "memory/defNewGeneration.hpp"
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
34
0
a61af66fc99e Initial load
duke
parents:
diff changeset
35 inline void CMSBitMap::clear_all() {
a61af66fc99e Initial load
duke
parents:
diff changeset
36 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // CMS bitmaps are usually cover large memory regions
a61af66fc99e Initial load
duke
parents:
diff changeset
38 _bm.clear_large();
a61af66fc99e Initial load
duke
parents:
diff changeset
39 return;
a61af66fc99e Initial load
duke
parents:
diff changeset
40 }
a61af66fc99e Initial load
duke
parents:
diff changeset
41
a61af66fc99e Initial load
duke
parents:
diff changeset
42 inline size_t CMSBitMap::heapWordToOffset(HeapWord* addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
43 return (pointer_delta(addr, _bmStartWord)) >> _shifter;
a61af66fc99e Initial load
duke
parents:
diff changeset
44 }
a61af66fc99e Initial load
duke
parents:
diff changeset
45
a61af66fc99e Initial load
duke
parents:
diff changeset
46 inline HeapWord* CMSBitMap::offsetToHeapWord(size_t offset) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
47 return _bmStartWord + (offset << _shifter);
a61af66fc99e Initial load
duke
parents:
diff changeset
48 }
a61af66fc99e Initial load
duke
parents:
diff changeset
49
a61af66fc99e Initial load
duke
parents:
diff changeset
50 inline size_t CMSBitMap::heapWordDiffToOffsetDiff(size_t diff) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
51 assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
a61af66fc99e Initial load
duke
parents:
diff changeset
52 return diff >> _shifter;
a61af66fc99e Initial load
duke
parents:
diff changeset
53 }
a61af66fc99e Initial load
duke
parents:
diff changeset
54
a61af66fc99e Initial load
duke
parents:
diff changeset
55 inline void CMSBitMap::mark(HeapWord* addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
56 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
57 assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
a61af66fc99e Initial load
duke
parents:
diff changeset
58 "outside underlying space?");
a61af66fc99e Initial load
duke
parents:
diff changeset
59 _bm.set_bit(heapWordToOffset(addr));
a61af66fc99e Initial load
duke
parents:
diff changeset
60 }
a61af66fc99e Initial load
duke
parents:
diff changeset
61
a61af66fc99e Initial load
duke
parents:
diff changeset
62 inline bool CMSBitMap::par_mark(HeapWord* addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
63 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
64 assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
a61af66fc99e Initial load
duke
parents:
diff changeset
65 "outside underlying space?");
a61af66fc99e Initial load
duke
parents:
diff changeset
66 return _bm.par_at_put(heapWordToOffset(addr), true);
a61af66fc99e Initial load
duke
parents:
diff changeset
67 }
a61af66fc99e Initial load
duke
parents:
diff changeset
68
a61af66fc99e Initial load
duke
parents:
diff changeset
69 inline void CMSBitMap::par_clear(HeapWord* addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
70 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
71 assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
a61af66fc99e Initial load
duke
parents:
diff changeset
72 "outside underlying space?");
a61af66fc99e Initial load
duke
parents:
diff changeset
73 _bm.par_at_put(heapWordToOffset(addr), false);
a61af66fc99e Initial load
duke
parents:
diff changeset
74 }
a61af66fc99e Initial load
duke
parents:
diff changeset
75
a61af66fc99e Initial load
duke
parents:
diff changeset
76 inline void CMSBitMap::mark_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
77 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
78 // Range size is usually just 1 bit.
a61af66fc99e Initial load
duke
parents:
diff changeset
79 _bm.set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
80 BitMap::small_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
81 }
a61af66fc99e Initial load
duke
parents:
diff changeset
82
a61af66fc99e Initial load
duke
parents:
diff changeset
83 inline void CMSBitMap::clear_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
84 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
85 // Range size is usually just 1 bit.
a61af66fc99e Initial load
duke
parents:
diff changeset
86 _bm.clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
87 BitMap::small_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
88 }
a61af66fc99e Initial load
duke
parents:
diff changeset
89
a61af66fc99e Initial load
duke
parents:
diff changeset
90 inline void CMSBitMap::par_mark_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
91 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
92 // Range size is usually just 1 bit.
a61af66fc99e Initial load
duke
parents:
diff changeset
93 _bm.par_set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
94 BitMap::small_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
95 }
a61af66fc99e Initial load
duke
parents:
diff changeset
96
a61af66fc99e Initial load
duke
parents:
diff changeset
97 inline void CMSBitMap::par_clear_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
98 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
99 // Range size is usually just 1 bit.
a61af66fc99e Initial load
duke
parents:
diff changeset
100 _bm.par_clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
101 BitMap::small_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
102 }
a61af66fc99e Initial load
duke
parents:
diff changeset
103
a61af66fc99e Initial load
duke
parents:
diff changeset
104 inline void CMSBitMap::mark_large_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
105 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // Range size must be greater than 32 bytes.
a61af66fc99e Initial load
duke
parents:
diff changeset
107 _bm.set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
108 BitMap::large_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110
a61af66fc99e Initial load
duke
parents:
diff changeset
111 inline void CMSBitMap::clear_large_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
112 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
113 // Range size must be greater than 32 bytes.
a61af66fc99e Initial load
duke
parents:
diff changeset
114 _bm.clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
115 BitMap::large_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
116 }
a61af66fc99e Initial load
duke
parents:
diff changeset
117
a61af66fc99e Initial load
duke
parents:
diff changeset
118 inline void CMSBitMap::par_mark_large_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
119 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
120 // Range size must be greater than 32 bytes.
a61af66fc99e Initial load
duke
parents:
diff changeset
121 _bm.par_set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
122 BitMap::large_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
123 }
a61af66fc99e Initial load
duke
parents:
diff changeset
124
a61af66fc99e Initial load
duke
parents:
diff changeset
125 inline void CMSBitMap::par_clear_large_range(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
126 NOT_PRODUCT(region_invariant(mr));
a61af66fc99e Initial load
duke
parents:
diff changeset
127 // Range size must be greater than 32 bytes.
a61af66fc99e Initial load
duke
parents:
diff changeset
128 _bm.par_clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
a61af66fc99e Initial load
duke
parents:
diff changeset
129 BitMap::large_range);
a61af66fc99e Initial load
duke
parents:
diff changeset
130 }
a61af66fc99e Initial load
duke
parents:
diff changeset
131
a61af66fc99e Initial load
duke
parents:
diff changeset
132 // Starting at "addr" (inclusive) return a memory region
a61af66fc99e Initial load
duke
parents:
diff changeset
133 // corresponding to the first maximally contiguous marked ("1") region.
a61af66fc99e Initial load
duke
parents:
diff changeset
134 inline MemRegion CMSBitMap::getAndClearMarkedRegion(HeapWord* addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
135 return getAndClearMarkedRegion(addr, endWord());
a61af66fc99e Initial load
duke
parents:
diff changeset
136 }
a61af66fc99e Initial load
duke
parents:
diff changeset
137
a61af66fc99e Initial load
duke
parents:
diff changeset
138 // Starting at "start_addr" (inclusive) return a memory region
a61af66fc99e Initial load
duke
parents:
diff changeset
139 // corresponding to the first maximal contiguous marked ("1") region
a61af66fc99e Initial load
duke
parents:
diff changeset
140 // strictly less than end_addr.
a61af66fc99e Initial load
duke
parents:
diff changeset
141 inline MemRegion CMSBitMap::getAndClearMarkedRegion(HeapWord* start_addr,
a61af66fc99e Initial load
duke
parents:
diff changeset
142 HeapWord* end_addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
143 HeapWord *start, *end;
a61af66fc99e Initial load
duke
parents:
diff changeset
144 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
145 start = getNextMarkedWordAddress (start_addr, end_addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
146 end = getNextUnmarkedWordAddress(start, end_addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
147 assert(start <= end, "Consistency check");
a61af66fc99e Initial load
duke
parents:
diff changeset
148 MemRegion mr(start, end);
a61af66fc99e Initial load
duke
parents:
diff changeset
149 if (!mr.is_empty()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
150 clear_range(mr);
a61af66fc99e Initial load
duke
parents:
diff changeset
151 }
a61af66fc99e Initial load
duke
parents:
diff changeset
152 return mr;
a61af66fc99e Initial load
duke
parents:
diff changeset
153 }
a61af66fc99e Initial load
duke
parents:
diff changeset
154
a61af66fc99e Initial load
duke
parents:
diff changeset
155 inline bool CMSBitMap::isMarked(HeapWord* addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
156 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
157 assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
a61af66fc99e Initial load
duke
parents:
diff changeset
158 "outside underlying space?");
a61af66fc99e Initial load
duke
parents:
diff changeset
159 return _bm.at(heapWordToOffset(addr));
a61af66fc99e Initial load
duke
parents:
diff changeset
160 }
a61af66fc99e Initial load
duke
parents:
diff changeset
161
a61af66fc99e Initial load
duke
parents:
diff changeset
162 // The same as isMarked() but without a lock check.
a61af66fc99e Initial load
duke
parents:
diff changeset
163 inline bool CMSBitMap::par_isMarked(HeapWord* addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
164 assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
a61af66fc99e Initial load
duke
parents:
diff changeset
165 "outside underlying space?");
a61af66fc99e Initial load
duke
parents:
diff changeset
166 return _bm.at(heapWordToOffset(addr));
a61af66fc99e Initial load
duke
parents:
diff changeset
167 }
a61af66fc99e Initial load
duke
parents:
diff changeset
168
a61af66fc99e Initial load
duke
parents:
diff changeset
169
a61af66fc99e Initial load
duke
parents:
diff changeset
170 inline bool CMSBitMap::isUnmarked(HeapWord* addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
171 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
172 assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
a61af66fc99e Initial load
duke
parents:
diff changeset
173 "outside underlying space?");
a61af66fc99e Initial load
duke
parents:
diff changeset
174 return !_bm.at(heapWordToOffset(addr));
a61af66fc99e Initial load
duke
parents:
diff changeset
175 }
a61af66fc99e Initial load
duke
parents:
diff changeset
176
a61af66fc99e Initial load
duke
parents:
diff changeset
177 // Return the HeapWord address corresponding to next "1" bit
a61af66fc99e Initial load
duke
parents:
diff changeset
178 // (inclusive).
a61af66fc99e Initial load
duke
parents:
diff changeset
179 inline HeapWord* CMSBitMap::getNextMarkedWordAddress(HeapWord* addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
180 return getNextMarkedWordAddress(addr, endWord());
a61af66fc99e Initial load
duke
parents:
diff changeset
181 }
a61af66fc99e Initial load
duke
parents:
diff changeset
182
a61af66fc99e Initial load
duke
parents:
diff changeset
183 // Return the least HeapWord address corresponding to next "1" bit
a61af66fc99e Initial load
duke
parents:
diff changeset
184 // starting at start_addr (inclusive) but strictly less than end_addr.
a61af66fc99e Initial load
duke
parents:
diff changeset
185 inline HeapWord* CMSBitMap::getNextMarkedWordAddress(
a61af66fc99e Initial load
duke
parents:
diff changeset
186 HeapWord* start_addr, HeapWord* end_addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
187 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
188 size_t nextOffset = _bm.get_next_one_offset(
a61af66fc99e Initial load
duke
parents:
diff changeset
189 heapWordToOffset(start_addr),
a61af66fc99e Initial load
duke
parents:
diff changeset
190 heapWordToOffset(end_addr));
a61af66fc99e Initial load
duke
parents:
diff changeset
191 HeapWord* nextAddr = offsetToHeapWord(nextOffset);
a61af66fc99e Initial load
duke
parents:
diff changeset
192 assert(nextAddr >= start_addr &&
a61af66fc99e Initial load
duke
parents:
diff changeset
193 nextAddr <= end_addr, "get_next_one postcondition");
a61af66fc99e Initial load
duke
parents:
diff changeset
194 assert((nextAddr == end_addr) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
195 isMarked(nextAddr), "get_next_one postcondition");
a61af66fc99e Initial load
duke
parents:
diff changeset
196 return nextAddr;
a61af66fc99e Initial load
duke
parents:
diff changeset
197 }
a61af66fc99e Initial load
duke
parents:
diff changeset
198
a61af66fc99e Initial load
duke
parents:
diff changeset
199
a61af66fc99e Initial load
duke
parents:
diff changeset
200 // Return the HeapWord address corrsponding to the next "0" bit
a61af66fc99e Initial load
duke
parents:
diff changeset
201 // (inclusive).
a61af66fc99e Initial load
duke
parents:
diff changeset
202 inline HeapWord* CMSBitMap::getNextUnmarkedWordAddress(HeapWord* addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
203 return getNextUnmarkedWordAddress(addr, endWord());
a61af66fc99e Initial load
duke
parents:
diff changeset
204 }
a61af66fc99e Initial load
duke
parents:
diff changeset
205
a61af66fc99e Initial load
duke
parents:
diff changeset
206 // Return the HeapWord address corrsponding to the next "0" bit
a61af66fc99e Initial load
duke
parents:
diff changeset
207 // (inclusive).
a61af66fc99e Initial load
duke
parents:
diff changeset
208 inline HeapWord* CMSBitMap::getNextUnmarkedWordAddress(
a61af66fc99e Initial load
duke
parents:
diff changeset
209 HeapWord* start_addr, HeapWord* end_addr) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
210 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
211 size_t nextOffset = _bm.get_next_zero_offset(
a61af66fc99e Initial load
duke
parents:
diff changeset
212 heapWordToOffset(start_addr),
a61af66fc99e Initial load
duke
parents:
diff changeset
213 heapWordToOffset(end_addr));
a61af66fc99e Initial load
duke
parents:
diff changeset
214 HeapWord* nextAddr = offsetToHeapWord(nextOffset);
a61af66fc99e Initial load
duke
parents:
diff changeset
215 assert(nextAddr >= start_addr &&
a61af66fc99e Initial load
duke
parents:
diff changeset
216 nextAddr <= end_addr, "get_next_zero postcondition");
a61af66fc99e Initial load
duke
parents:
diff changeset
217 assert((nextAddr == end_addr) ||
a61af66fc99e Initial load
duke
parents:
diff changeset
218 isUnmarked(nextAddr), "get_next_zero postcondition");
a61af66fc99e Initial load
duke
parents:
diff changeset
219 return nextAddr;
a61af66fc99e Initial load
duke
parents:
diff changeset
220 }
a61af66fc99e Initial load
duke
parents:
diff changeset
221
a61af66fc99e Initial load
duke
parents:
diff changeset
222 inline bool CMSBitMap::isAllClear() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
223 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
224 return getNextMarkedWordAddress(startWord()) >= endWord();
a61af66fc99e Initial load
duke
parents:
diff changeset
225 }
a61af66fc99e Initial load
duke
parents:
diff changeset
226
a61af66fc99e Initial load
duke
parents:
diff changeset
227 inline void CMSBitMap::iterate(BitMapClosure* cl, HeapWord* left,
a61af66fc99e Initial load
duke
parents:
diff changeset
228 HeapWord* right) {
a61af66fc99e Initial load
duke
parents:
diff changeset
229 assert_locked();
a61af66fc99e Initial load
duke
parents:
diff changeset
230 left = MAX2(_bmStartWord, left);
a61af66fc99e Initial load
duke
parents:
diff changeset
231 right = MIN2(_bmStartWord + _bmWordSize, right);
a61af66fc99e Initial load
duke
parents:
diff changeset
232 if (right > left) {
a61af66fc99e Initial load
duke
parents:
diff changeset
233 _bm.iterate(cl, heapWordToOffset(left), heapWordToOffset(right));
a61af66fc99e Initial load
duke
parents:
diff changeset
234 }
a61af66fc99e Initial load
duke
parents:
diff changeset
235 }
a61af66fc99e Initial load
duke
parents:
diff changeset
236
a61af66fc99e Initial load
duke
parents:
diff changeset
237 inline void CMSCollector::start_icms() {
a61af66fc99e Initial load
duke
parents:
diff changeset
238 if (CMSIncrementalMode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
239 ConcurrentMarkSweepThread::start_icms();
a61af66fc99e Initial load
duke
parents:
diff changeset
240 }
a61af66fc99e Initial load
duke
parents:
diff changeset
241 }
a61af66fc99e Initial load
duke
parents:
diff changeset
242
a61af66fc99e Initial load
duke
parents:
diff changeset
243 inline void CMSCollector::stop_icms() {
a61af66fc99e Initial load
duke
parents:
diff changeset
244 if (CMSIncrementalMode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
245 ConcurrentMarkSweepThread::stop_icms();
a61af66fc99e Initial load
duke
parents:
diff changeset
246 }
a61af66fc99e Initial load
duke
parents:
diff changeset
247 }
a61af66fc99e Initial load
duke
parents:
diff changeset
248
a61af66fc99e Initial load
duke
parents:
diff changeset
249 inline void CMSCollector::disable_icms() {
a61af66fc99e Initial load
duke
parents:
diff changeset
250 if (CMSIncrementalMode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
251 ConcurrentMarkSweepThread::disable_icms();
a61af66fc99e Initial load
duke
parents:
diff changeset
252 }
a61af66fc99e Initial load
duke
parents:
diff changeset
253 }
a61af66fc99e Initial load
duke
parents:
diff changeset
254
a61af66fc99e Initial load
duke
parents:
diff changeset
255 inline void CMSCollector::enable_icms() {
a61af66fc99e Initial load
duke
parents:
diff changeset
256 if (CMSIncrementalMode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
257 ConcurrentMarkSweepThread::enable_icms();
a61af66fc99e Initial load
duke
parents:
diff changeset
258 }
a61af66fc99e Initial load
duke
parents:
diff changeset
259 }
a61af66fc99e Initial load
duke
parents:
diff changeset
260
a61af66fc99e Initial load
duke
parents:
diff changeset
261 inline void CMSCollector::icms_wait() {
a61af66fc99e Initial load
duke
parents:
diff changeset
262 if (CMSIncrementalMode) {
a61af66fc99e Initial load
duke
parents:
diff changeset
263 cmsThread()->icms_wait();
a61af66fc99e Initial load
duke
parents:
diff changeset
264 }
a61af66fc99e Initial load
duke
parents:
diff changeset
265 }
a61af66fc99e Initial load
duke
parents:
diff changeset
266
a61af66fc99e Initial load
duke
parents:
diff changeset
267 inline void CMSCollector::save_sweep_limits() {
a61af66fc99e Initial load
duke
parents:
diff changeset
268 _cmsGen->save_sweep_limit();
a61af66fc99e Initial load
duke
parents:
diff changeset
269 _permGen->save_sweep_limit();
a61af66fc99e Initial load
duke
parents:
diff changeset
270 }
a61af66fc99e Initial load
duke
parents:
diff changeset
271
a61af66fc99e Initial load
duke
parents:
diff changeset
272 inline bool CMSCollector::is_dead_obj(oop obj) const {
a61af66fc99e Initial load
duke
parents:
diff changeset
273 HeapWord* addr = (HeapWord*)obj;
a61af66fc99e Initial load
duke
parents:
diff changeset
274 assert((_cmsGen->cmsSpace()->is_in_reserved(addr)
a61af66fc99e Initial load
duke
parents:
diff changeset
275 && _cmsGen->cmsSpace()->block_is_obj(addr))
a61af66fc99e Initial load
duke
parents:
diff changeset
276 ||
a61af66fc99e Initial load
duke
parents:
diff changeset
277 (_permGen->cmsSpace()->is_in_reserved(addr)
a61af66fc99e Initial load
duke
parents:
diff changeset
278 && _permGen->cmsSpace()->block_is_obj(addr)),
a61af66fc99e Initial load
duke
parents:
diff changeset
279 "must be object");
94
0834225a7916 6634032: CMS: Need CMSInitiatingPermOccupancyFraction for perm, divorcing from CMSInitiatingOccupancyFraction
ysr
parents: 0
diff changeset
280 return should_unload_classes() &&
0
a61af66fc99e Initial load
duke
parents:
diff changeset
281 _collectorState == Sweeping &&
a61af66fc99e Initial load
duke
parents:
diff changeset
282 !_markBitMap.isMarked(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
283 }
a61af66fc99e Initial load
duke
parents:
diff changeset
284
a61af66fc99e Initial load
duke
parents:
diff changeset
285 inline bool CMSCollector::should_abort_preclean() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
286 // We are in the midst of an "abortable preclean" and either
a61af66fc99e Initial load
duke
parents:
diff changeset
287 // scavenge is done or foreground GC wants to take over collection
a61af66fc99e Initial load
duke
parents:
diff changeset
288 return _collectorState == AbortablePreclean &&
a61af66fc99e Initial load
duke
parents:
diff changeset
289 (_abort_preclean || _foregroundGCIsActive ||
1994
6cd6d394f280 7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed())
ysr
parents: 1972
diff changeset
290 GenCollectedHeap::heap()->incremental_collection_will_fail(true /* consult_young */));
0
a61af66fc99e Initial load
duke
parents:
diff changeset
291 }
a61af66fc99e Initial load
duke
parents:
diff changeset
292
a61af66fc99e Initial load
duke
parents:
diff changeset
293 inline size_t CMSCollector::get_eden_used() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
294 return _young_gen->as_DefNewGeneration()->eden()->used();
a61af66fc99e Initial load
duke
parents:
diff changeset
295 }
a61af66fc99e Initial load
duke
parents:
diff changeset
296
a61af66fc99e Initial load
duke
parents:
diff changeset
297 inline size_t CMSCollector::get_eden_capacity() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
298 return _young_gen->as_DefNewGeneration()->eden()->capacity();
a61af66fc99e Initial load
duke
parents:
diff changeset
299 }
a61af66fc99e Initial load
duke
parents:
diff changeset
300
a61af66fc99e Initial load
duke
parents:
diff changeset
301 inline bool CMSStats::valid() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
302 return _valid_bits == _ALL_VALID;
a61af66fc99e Initial load
duke
parents:
diff changeset
303 }
a61af66fc99e Initial load
duke
parents:
diff changeset
304
a61af66fc99e Initial load
duke
parents:
diff changeset
305 inline void CMSStats::record_gc0_begin() {
a61af66fc99e Initial load
duke
parents:
diff changeset
306 if (_gc0_begin_time.is_updated()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
307 float last_gc0_period = _gc0_begin_time.seconds();
a61af66fc99e Initial load
duke
parents:
diff changeset
308 _gc0_period = AdaptiveWeightedAverage::exp_avg(_gc0_period,
a61af66fc99e Initial load
duke
parents:
diff changeset
309 last_gc0_period, _gc0_alpha);
a61af66fc99e Initial load
duke
parents:
diff changeset
310 _gc0_alpha = _saved_alpha;
a61af66fc99e Initial load
duke
parents:
diff changeset
311 _valid_bits |= _GC0_VALID;
a61af66fc99e Initial load
duke
parents:
diff changeset
312 }
a61af66fc99e Initial load
duke
parents:
diff changeset
313 _cms_used_at_gc0_begin = _cms_gen->cmsSpace()->used();
a61af66fc99e Initial load
duke
parents:
diff changeset
314
a61af66fc99e Initial load
duke
parents:
diff changeset
315 _gc0_begin_time.update();
a61af66fc99e Initial load
duke
parents:
diff changeset
316 }
a61af66fc99e Initial load
duke
parents:
diff changeset
317
a61af66fc99e Initial load
duke
parents:
diff changeset
318 inline void CMSStats::record_gc0_end(size_t cms_gen_bytes_used) {
a61af66fc99e Initial load
duke
parents:
diff changeset
319 float last_gc0_duration = _gc0_begin_time.seconds();
a61af66fc99e Initial load
duke
parents:
diff changeset
320 _gc0_duration = AdaptiveWeightedAverage::exp_avg(_gc0_duration,
a61af66fc99e Initial load
duke
parents:
diff changeset
321 last_gc0_duration, _gc0_alpha);
a61af66fc99e Initial load
duke
parents:
diff changeset
322
a61af66fc99e Initial load
duke
parents:
diff changeset
323 // Amount promoted.
a61af66fc99e Initial load
duke
parents:
diff changeset
324 _cms_used_at_gc0_end = cms_gen_bytes_used;
a61af66fc99e Initial load
duke
parents:
diff changeset
325
a61af66fc99e Initial load
duke
parents:
diff changeset
326 size_t promoted_bytes = 0;
a61af66fc99e Initial load
duke
parents:
diff changeset
327 if (_cms_used_at_gc0_end >= _cms_used_at_gc0_begin) {
a61af66fc99e Initial load
duke
parents:
diff changeset
328 promoted_bytes = _cms_used_at_gc0_end - _cms_used_at_gc0_begin;
a61af66fc99e Initial load
duke
parents:
diff changeset
329 }
a61af66fc99e Initial load
duke
parents:
diff changeset
330
a61af66fc99e Initial load
duke
parents:
diff changeset
331 // If the younger gen collections were skipped, then the
a61af66fc99e Initial load
duke
parents:
diff changeset
332 // number of promoted bytes will be 0 and adding it to the
a61af66fc99e Initial load
duke
parents:
diff changeset
333 // average will incorrectly lessen the average. It is, however,
a61af66fc99e Initial load
duke
parents:
diff changeset
334 // also possible that no promotion was needed.
a61af66fc99e Initial load
duke
parents:
diff changeset
335 //
a61af66fc99e Initial load
duke
parents:
diff changeset
336 // _gc0_promoted used to be calculated as
a61af66fc99e Initial load
duke
parents:
diff changeset
337 // _gc0_promoted = AdaptiveWeightedAverage::exp_avg(_gc0_promoted,
a61af66fc99e Initial load
duke
parents:
diff changeset
338 // promoted_bytes, _gc0_alpha);
a61af66fc99e Initial load
duke
parents:
diff changeset
339 _cms_gen->gc_stats()->avg_promoted()->sample(promoted_bytes);
a61af66fc99e Initial load
duke
parents:
diff changeset
340 _gc0_promoted = (size_t) _cms_gen->gc_stats()->avg_promoted()->average();
a61af66fc99e Initial load
duke
parents:
diff changeset
341
a61af66fc99e Initial load
duke
parents:
diff changeset
342 // Amount directly allocated.
a61af66fc99e Initial load
duke
parents:
diff changeset
343 size_t allocated_bytes = _cms_gen->direct_allocated_words() * HeapWordSize;
a61af66fc99e Initial load
duke
parents:
diff changeset
344 _cms_gen->reset_direct_allocated_words();
a61af66fc99e Initial load
duke
parents:
diff changeset
345 _cms_allocated = AdaptiveWeightedAverage::exp_avg(_cms_allocated,
a61af66fc99e Initial load
duke
parents:
diff changeset
346 allocated_bytes, _gc0_alpha);
a61af66fc99e Initial load
duke
parents:
diff changeset
347 }
a61af66fc99e Initial load
duke
parents:
diff changeset
348
a61af66fc99e Initial load
duke
parents:
diff changeset
349 inline void CMSStats::record_cms_begin() {
a61af66fc99e Initial load
duke
parents:
diff changeset
350 _cms_timer.stop();
a61af66fc99e Initial load
duke
parents:
diff changeset
351
a61af66fc99e Initial load
duke
parents:
diff changeset
352 // This is just an approximate value, but is good enough.
a61af66fc99e Initial load
duke
parents:
diff changeset
353 _cms_used_at_cms_begin = _cms_used_at_gc0_end;
a61af66fc99e Initial load
duke
parents:
diff changeset
354
a61af66fc99e Initial load
duke
parents:
diff changeset
355 _cms_period = AdaptiveWeightedAverage::exp_avg((float)_cms_period,
a61af66fc99e Initial load
duke
parents:
diff changeset
356 (float) _cms_timer.seconds(), _cms_alpha);
a61af66fc99e Initial load
duke
parents:
diff changeset
357 _cms_begin_time.update();
a61af66fc99e Initial load
duke
parents:
diff changeset
358
a61af66fc99e Initial load
duke
parents:
diff changeset
359 _cms_timer.reset();
a61af66fc99e Initial load
duke
parents:
diff changeset
360 _cms_timer.start();
a61af66fc99e Initial load
duke
parents:
diff changeset
361 }
a61af66fc99e Initial load
duke
parents:
diff changeset
362
a61af66fc99e Initial load
duke
parents:
diff changeset
363 inline void CMSStats::record_cms_end() {
a61af66fc99e Initial load
duke
parents:
diff changeset
364 _cms_timer.stop();
a61af66fc99e Initial load
duke
parents:
diff changeset
365
a61af66fc99e Initial load
duke
parents:
diff changeset
366 float cur_duration = _cms_timer.seconds();
a61af66fc99e Initial load
duke
parents:
diff changeset
367 _cms_duration = AdaptiveWeightedAverage::exp_avg(_cms_duration,
a61af66fc99e Initial load
duke
parents:
diff changeset
368 cur_duration, _cms_alpha);
a61af66fc99e Initial load
duke
parents:
diff changeset
369
a61af66fc99e Initial load
duke
parents:
diff changeset
370 // Avoid division by 0.
a61af66fc99e Initial load
duke
parents:
diff changeset
371 const size_t cms_used_mb = MAX2(_cms_used_at_cms_begin / M, (size_t)1);
a61af66fc99e Initial load
duke
parents:
diff changeset
372 _cms_duration_per_mb = AdaptiveWeightedAverage::exp_avg(_cms_duration_per_mb,
a61af66fc99e Initial load
duke
parents:
diff changeset
373 cur_duration / cms_used_mb,
a61af66fc99e Initial load
duke
parents:
diff changeset
374 _cms_alpha);
a61af66fc99e Initial load
duke
parents:
diff changeset
375
a61af66fc99e Initial load
duke
parents:
diff changeset
376 _cms_end_time.update();
a61af66fc99e Initial load
duke
parents:
diff changeset
377 _cms_alpha = _saved_alpha;
a61af66fc99e Initial load
duke
parents:
diff changeset
378 _allow_duty_cycle_reduction = true;
a61af66fc99e Initial load
duke
parents:
diff changeset
379 _valid_bits |= _CMS_VALID;
a61af66fc99e Initial load
duke
parents:
diff changeset
380
a61af66fc99e Initial load
duke
parents:
diff changeset
381 _cms_timer.start();
a61af66fc99e Initial load
duke
parents:
diff changeset
382 }
a61af66fc99e Initial load
duke
parents:
diff changeset
383
a61af66fc99e Initial load
duke
parents:
diff changeset
384 inline double CMSStats::cms_time_since_begin() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
385 return _cms_begin_time.seconds();
a61af66fc99e Initial load
duke
parents:
diff changeset
386 }
a61af66fc99e Initial load
duke
parents:
diff changeset
387
a61af66fc99e Initial load
duke
parents:
diff changeset
388 inline double CMSStats::cms_time_since_end() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
389 return _cms_end_time.seconds();
a61af66fc99e Initial load
duke
parents:
diff changeset
390 }
a61af66fc99e Initial load
duke
parents:
diff changeset
391
a61af66fc99e Initial load
duke
parents:
diff changeset
392 inline double CMSStats::promotion_rate() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
393 assert(valid(), "statistics not valid yet");
a61af66fc99e Initial load
duke
parents:
diff changeset
394 return gc0_promoted() / gc0_period();
a61af66fc99e Initial load
duke
parents:
diff changeset
395 }
a61af66fc99e Initial load
duke
parents:
diff changeset
396
a61af66fc99e Initial load
duke
parents:
diff changeset
397 inline double CMSStats::cms_allocation_rate() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
398 assert(valid(), "statistics not valid yet");
a61af66fc99e Initial load
duke
parents:
diff changeset
399 return cms_allocated() / gc0_period();
a61af66fc99e Initial load
duke
parents:
diff changeset
400 }
a61af66fc99e Initial load
duke
parents:
diff changeset
401
a61af66fc99e Initial load
duke
parents:
diff changeset
402 inline double CMSStats::cms_consumption_rate() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
403 assert(valid(), "statistics not valid yet");
a61af66fc99e Initial load
duke
parents:
diff changeset
404 return (gc0_promoted() + cms_allocated()) / gc0_period();
a61af66fc99e Initial load
duke
parents:
diff changeset
405 }
a61af66fc99e Initial load
duke
parents:
diff changeset
406
a61af66fc99e Initial load
duke
parents:
diff changeset
407 inline unsigned int CMSStats::icms_update_duty_cycle() {
a61af66fc99e Initial load
duke
parents:
diff changeset
408 // Update the duty cycle only if pacing is enabled and the stats are valid
a61af66fc99e Initial load
duke
parents:
diff changeset
409 // (after at least one young gen gc and one cms cycle have completed).
a61af66fc99e Initial load
duke
parents:
diff changeset
410 if (CMSIncrementalPacing && valid()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
411 return icms_update_duty_cycle_impl();
a61af66fc99e Initial load
duke
parents:
diff changeset
412 }
a61af66fc99e Initial load
duke
parents:
diff changeset
413 return _icms_duty_cycle;
a61af66fc99e Initial load
duke
parents:
diff changeset
414 }
a61af66fc99e Initial load
duke
parents:
diff changeset
415
a61af66fc99e Initial load
duke
parents:
diff changeset
416 inline void ConcurrentMarkSweepGeneration::save_sweep_limit() {
a61af66fc99e Initial load
duke
parents:
diff changeset
417 cmsSpace()->save_sweep_limit();
a61af66fc99e Initial load
duke
parents:
diff changeset
418 }
a61af66fc99e Initial load
duke
parents:
diff changeset
419
a61af66fc99e Initial load
duke
parents:
diff changeset
420 inline size_t ConcurrentMarkSweepGeneration::capacity() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
421 return _cmsSpace->capacity();
a61af66fc99e Initial load
duke
parents:
diff changeset
422 }
a61af66fc99e Initial load
duke
parents:
diff changeset
423
a61af66fc99e Initial load
duke
parents:
diff changeset
424 inline size_t ConcurrentMarkSweepGeneration::used() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
425 return _cmsSpace->used();
a61af66fc99e Initial load
duke
parents:
diff changeset
426 }
a61af66fc99e Initial load
duke
parents:
diff changeset
427
a61af66fc99e Initial load
duke
parents:
diff changeset
428 inline size_t ConcurrentMarkSweepGeneration::free() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
429 return _cmsSpace->free();
a61af66fc99e Initial load
duke
parents:
diff changeset
430 }
a61af66fc99e Initial load
duke
parents:
diff changeset
431
a61af66fc99e Initial load
duke
parents:
diff changeset
432 inline MemRegion ConcurrentMarkSweepGeneration::used_region() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
433 return _cmsSpace->used_region();
a61af66fc99e Initial load
duke
parents:
diff changeset
434 }
a61af66fc99e Initial load
duke
parents:
diff changeset
435
a61af66fc99e Initial load
duke
parents:
diff changeset
436 inline MemRegion ConcurrentMarkSweepGeneration::used_region_at_save_marks() const {
a61af66fc99e Initial load
duke
parents:
diff changeset
437 return _cmsSpace->used_region_at_save_marks();
a61af66fc99e Initial load
duke
parents:
diff changeset
438 }
a61af66fc99e Initial load
duke
parents:
diff changeset
439
a61af66fc99e Initial load
duke
parents:
diff changeset
440 inline void MarkFromRootsClosure::do_yield_check() {
a61af66fc99e Initial load
duke
parents:
diff changeset
441 if (ConcurrentMarkSweepThread::should_yield() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
442 !_collector->foregroundGCIsActive() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
443 _yield) {
a61af66fc99e Initial load
duke
parents:
diff changeset
444 do_yield_work();
a61af66fc99e Initial load
duke
parents:
diff changeset
445 }
a61af66fc99e Initial load
duke
parents:
diff changeset
446 }
a61af66fc99e Initial load
duke
parents:
diff changeset
447
a61af66fc99e Initial load
duke
parents:
diff changeset
448 inline void Par_MarkFromRootsClosure::do_yield_check() {
a61af66fc99e Initial load
duke
parents:
diff changeset
449 if (ConcurrentMarkSweepThread::should_yield() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
450 !_collector->foregroundGCIsActive() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
451 _yield) {
a61af66fc99e Initial load
duke
parents:
diff changeset
452 do_yield_work();
a61af66fc99e Initial load
duke
parents:
diff changeset
453 }
a61af66fc99e Initial load
duke
parents:
diff changeset
454 }
a61af66fc99e Initial load
duke
parents:
diff changeset
455
a61af66fc99e Initial load
duke
parents:
diff changeset
456 // Return value of "true" indicates that the on-going preclean
a61af66fc99e Initial load
duke
parents:
diff changeset
457 // should be aborted.
a61af66fc99e Initial load
duke
parents:
diff changeset
458 inline bool ScanMarkedObjectsAgainCarefullyClosure::do_yield_check() {
a61af66fc99e Initial load
duke
parents:
diff changeset
459 if (ConcurrentMarkSweepThread::should_yield() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
460 !_collector->foregroundGCIsActive() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
461 _yield) {
a61af66fc99e Initial load
duke
parents:
diff changeset
462 // Sample young gen size before and after yield
a61af66fc99e Initial load
duke
parents:
diff changeset
463 _collector->sample_eden();
a61af66fc99e Initial load
duke
parents:
diff changeset
464 do_yield_work();
a61af66fc99e Initial load
duke
parents:
diff changeset
465 _collector->sample_eden();
a61af66fc99e Initial load
duke
parents:
diff changeset
466 return _collector->should_abort_preclean();
a61af66fc99e Initial load
duke
parents:
diff changeset
467 }
a61af66fc99e Initial load
duke
parents:
diff changeset
468 return false;
a61af66fc99e Initial load
duke
parents:
diff changeset
469 }
a61af66fc99e Initial load
duke
parents:
diff changeset
470
a61af66fc99e Initial load
duke
parents:
diff changeset
471 inline void SurvivorSpacePrecleanClosure::do_yield_check() {
a61af66fc99e Initial load
duke
parents:
diff changeset
472 if (ConcurrentMarkSweepThread::should_yield() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
473 !_collector->foregroundGCIsActive() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
474 _yield) {
a61af66fc99e Initial load
duke
parents:
diff changeset
475 // Sample young gen size before and after yield
a61af66fc99e Initial load
duke
parents:
diff changeset
476 _collector->sample_eden();
a61af66fc99e Initial load
duke
parents:
diff changeset
477 do_yield_work();
a61af66fc99e Initial load
duke
parents:
diff changeset
478 _collector->sample_eden();
a61af66fc99e Initial load
duke
parents:
diff changeset
479 }
a61af66fc99e Initial load
duke
parents:
diff changeset
480 }
a61af66fc99e Initial load
duke
parents:
diff changeset
481
a61af66fc99e Initial load
duke
parents:
diff changeset
482 inline void SweepClosure::do_yield_check(HeapWord* addr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
483 if (ConcurrentMarkSweepThread::should_yield() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
484 !_collector->foregroundGCIsActive() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
485 _yield) {
a61af66fc99e Initial load
duke
parents:
diff changeset
486 do_yield_work(addr);
a61af66fc99e Initial load
duke
parents:
diff changeset
487 }
a61af66fc99e Initial load
duke
parents:
diff changeset
488 }
a61af66fc99e Initial load
duke
parents:
diff changeset
489
a61af66fc99e Initial load
duke
parents:
diff changeset
490 inline void MarkRefsIntoAndScanClosure::do_yield_check() {
a61af66fc99e Initial load
duke
parents:
diff changeset
491 // The conditions are ordered for the remarking phase
a61af66fc99e Initial load
duke
parents:
diff changeset
492 // when _yield is false.
a61af66fc99e Initial load
duke
parents:
diff changeset
493 if (_yield &&
a61af66fc99e Initial load
duke
parents:
diff changeset
494 !_collector->foregroundGCIsActive() &&
a61af66fc99e Initial load
duke
parents:
diff changeset
495 ConcurrentMarkSweepThread::should_yield()) {
a61af66fc99e Initial load
duke
parents:
diff changeset
496 do_yield_work();
a61af66fc99e Initial load
duke
parents:
diff changeset
497 }
a61af66fc99e Initial load
duke
parents:
diff changeset
498 }
a61af66fc99e Initial load
duke
parents:
diff changeset
499
a61af66fc99e Initial load
duke
parents:
diff changeset
500
a61af66fc99e Initial load
duke
parents:
diff changeset
501 inline void ModUnionClosure::do_MemRegion(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
502 // Align the end of mr so it's at a card boundary.
a61af66fc99e Initial load
duke
parents:
diff changeset
503 // This is superfluous except at the end of the space;
a61af66fc99e Initial load
duke
parents:
diff changeset
504 // we should do better than this XXX
a61af66fc99e Initial load
duke
parents:
diff changeset
505 MemRegion mr2(mr.start(), (HeapWord*)round_to((intptr_t)mr.end(),
a61af66fc99e Initial load
duke
parents:
diff changeset
506 CardTableModRefBS::card_size /* bytes */));
a61af66fc99e Initial load
duke
parents:
diff changeset
507 _t->mark_range(mr2);
a61af66fc99e Initial load
duke
parents:
diff changeset
508 }
a61af66fc99e Initial load
duke
parents:
diff changeset
509
a61af66fc99e Initial load
duke
parents:
diff changeset
510 inline void ModUnionClosurePar::do_MemRegion(MemRegion mr) {
a61af66fc99e Initial load
duke
parents:
diff changeset
511 // Align the end of mr so it's at a card boundary.
a61af66fc99e Initial load
duke
parents:
diff changeset
512 // This is superfluous except at the end of the space;
a61af66fc99e Initial load
duke
parents:
diff changeset
513 // we should do better than this XXX
a61af66fc99e Initial load
duke
parents:
diff changeset
514 MemRegion mr2(mr.start(), (HeapWord*)round_to((intptr_t)mr.end(),
a61af66fc99e Initial load
duke
parents:
diff changeset
515 CardTableModRefBS::card_size /* bytes */));
a61af66fc99e Initial load
duke
parents:
diff changeset
516 _t->par_mark_range(mr2);
a61af66fc99e Initial load
duke
parents:
diff changeset
517 }
1972
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
518
f95d63e2154a 6989984: Use standard include model for Hospot
stefank
parents: 1552
diff changeset
519 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP