8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
26 #define SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
27
28 #include "gc/cms/cmsLockVerifier.hpp"
29 #include "gc/cms/compactibleFreeListSpace.hpp"
30 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
31 #include "gc/cms/concurrentMarkSweepThread.hpp"
32 #include "gc/cms/parNewGeneration.hpp"
33 #include "gc/shared/gcUtil.hpp"
34 #include "gc/shared/genCollectedHeap.hpp"
35 #include "utilities/align.hpp"
36 #include "utilities/bitMap.inline.hpp"
37
38 inline void CMSBitMap::clear_all() {
39 assert_locked();
40 // CMS bitmaps are usually cover large memory regions
41 _bm.clear_large();
42 return;
43 }
44
45 inline size_t CMSBitMap::heapWordToOffset(HeapWord* addr) const {
46 return (pointer_delta(addr, _bmStartWord)) >> _shifter;
47 }
48
49 inline HeapWord* CMSBitMap::offsetToHeapWord(size_t offset) const {
50 return _bmStartWord + (offset << _shifter);
51 }
52
53 inline size_t CMSBitMap::heapWordDiffToOffsetDiff(size_t diff) const {
54 assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
239
240 inline void CMSCollector::save_sweep_limits() {
241 _cmsGen->save_sweep_limit();
242 }
243
244 inline bool CMSCollector::is_dead_obj(oop obj) const {
245 HeapWord* addr = (HeapWord*)obj;
246 assert((_cmsGen->cmsSpace()->is_in_reserved(addr)
247 && _cmsGen->cmsSpace()->block_is_obj(addr)),
248 "must be object");
249 return should_unload_classes() &&
250 _collectorState == Sweeping &&
251 !_markBitMap.isMarked(addr);
252 }
253
254 inline bool CMSCollector::should_abort_preclean() const {
255 // We are in the midst of an "abortable preclean" and either
256 // scavenge is done or foreground GC wants to take over collection
257 return _collectorState == AbortablePreclean &&
258 (_abort_preclean || _foregroundGCIsActive ||
259 GenCollectedHeap::heap()->incremental_collection_will_fail(true /* consult_young */));
260 }
261
262 inline size_t CMSCollector::get_eden_used() const {
263 return _young_gen->eden()->used();
264 }
265
266 inline size_t CMSCollector::get_eden_capacity() const {
267 return _young_gen->eden()->capacity();
268 }
269
270 inline bool CMSStats::valid() const {
271 return _valid_bits == _ALL_VALID;
272 }
273
274 inline void CMSStats::record_gc0_begin() {
275 if (_gc0_begin_time.is_updated()) {
276 float last_gc0_period = _gc0_begin_time.seconds();
277 _gc0_period = AdaptiveWeightedAverage::exp_avg(_gc0_period,
278 last_gc0_period, _gc0_alpha);
279 _gc0_alpha = _saved_alpha;
|
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #ifndef SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
26 #define SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
27
28 #include "gc/cms/cmsHeap.hpp"
29 #include "gc/cms/cmsLockVerifier.hpp"
30 #include "gc/cms/compactibleFreeListSpace.hpp"
31 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
32 #include "gc/cms/concurrentMarkSweepThread.hpp"
33 #include "gc/cms/parNewGeneration.hpp"
34 #include "gc/shared/gcUtil.hpp"
35 #include "utilities/align.hpp"
36 #include "utilities/bitMap.inline.hpp"
37
38 inline void CMSBitMap::clear_all() {
39 assert_locked();
40 // CMS bitmaps are usually cover large memory regions
41 _bm.clear_large();
42 return;
43 }
44
45 inline size_t CMSBitMap::heapWordToOffset(HeapWord* addr) const {
46 return (pointer_delta(addr, _bmStartWord)) >> _shifter;
47 }
48
49 inline HeapWord* CMSBitMap::offsetToHeapWord(size_t offset) const {
50 return _bmStartWord + (offset << _shifter);
51 }
52
53 inline size_t CMSBitMap::heapWordDiffToOffsetDiff(size_t diff) const {
54 assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
239
240 inline void CMSCollector::save_sweep_limits() {
241 _cmsGen->save_sweep_limit();
242 }
243
244 inline bool CMSCollector::is_dead_obj(oop obj) const {
245 HeapWord* addr = (HeapWord*)obj;
246 assert((_cmsGen->cmsSpace()->is_in_reserved(addr)
247 && _cmsGen->cmsSpace()->block_is_obj(addr)),
248 "must be object");
249 return should_unload_classes() &&
250 _collectorState == Sweeping &&
251 !_markBitMap.isMarked(addr);
252 }
253
254 inline bool CMSCollector::should_abort_preclean() const {
255 // We are in the midst of an "abortable preclean" and either
256 // scavenge is done or foreground GC wants to take over collection
257 return _collectorState == AbortablePreclean &&
258 (_abort_preclean || _foregroundGCIsActive ||
259 CMSHeap::heap()->incremental_collection_will_fail(true /* consult_young */));
260 }
261
262 inline size_t CMSCollector::get_eden_used() const {
263 return _young_gen->eden()->used();
264 }
265
266 inline size_t CMSCollector::get_eden_capacity() const {
267 return _young_gen->eden()->capacity();
268 }
269
270 inline bool CMSStats::valid() const {
271 return _valid_bits == _ALL_VALID;
272 }
273
274 inline void CMSStats::record_gc0_begin() {
275 if (_gc0_begin_time.is_updated()) {
276 float last_gc0_period = _gc0_begin_time.seconds();
277 _gc0_period = AdaptiveWeightedAverage::exp_avg(_gc0_period,
278 last_gc0_period, _gc0_alpha);
279 _gc0_alpha = _saved_alpha;
|