hotspot/src/share/vm/gc/cms/concurrentMarkSweepGeneration.inline.hpp
author tschatzl
Fri, 26 May 2017 13:46:49 +0200
changeset 46502 116a09d8f142
parent 35492 c8c0273e6b91
child 46620 750c6edff33b
permissions -rw-r--r--
8180755: Remove use of bitMap.inline.hpp include from instanceKlass.hpp and c1_ValueSet.hpp Reviewed-by: ehelin, coleenp, dholmes
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
46502
116a09d8f142 8180755: Remove use of bitMap.inline.hpp include from instanceKlass.hpp and c1_ValueSet.hpp
tschatzl
parents: 35492
diff changeset
     2
 * Copyright (c) 2001, 2017, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 670
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    25
#ifndef SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    26
#define SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    28
#include "gc/cms/cmsLockVerifier.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    29
#include "gc/cms/compactibleFreeListSpace.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    30
#include "gc/cms/concurrentMarkSweepGeneration.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    31
#include "gc/cms/concurrentMarkSweepThread.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    32
#include "gc/cms/parNewGeneration.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    33
#include "gc/shared/gcUtil.hpp"
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
    34
#include "gc/shared/genCollectedHeap.hpp"
46502
116a09d8f142 8180755: Remove use of bitMap.inline.hpp include from instanceKlass.hpp and c1_ValueSet.hpp
tschatzl
parents: 35492
diff changeset
    35
#include "utilities/bitMap.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
inline void CMSBitMap::clear_all() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  // CMS bitmaps are usually cover large memory regions
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  _bm.clear_large();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  return;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
inline size_t CMSBitMap::heapWordToOffset(HeapWord* addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  return (pointer_delta(addr, _bmStartWord)) >> _shifter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
inline HeapWord* CMSBitMap::offsetToHeapWord(size_t offset) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  return _bmStartWord + (offset << _shifter);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
inline size_t CMSBitMap::heapWordDiffToOffsetDiff(size_t diff) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  assert((diff & ((1 << _shifter) - 1)) == 0, "argument check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  return diff >> _shifter;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
inline void CMSBitMap::mark(HeapWord* addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
         "outside underlying space?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  _bm.set_bit(heapWordToOffset(addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
inline bool CMSBitMap::par_mark(HeapWord* addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
         "outside underlying space?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
  return _bm.par_at_put(heapWordToOffset(addr), true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
inline void CMSBitMap::par_clear(HeapWord* addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
         "outside underlying space?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  _bm.par_at_put(heapWordToOffset(addr), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
inline void CMSBitMap::mark_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
  // Range size is usually just 1 bit.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  _bm.set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
                BitMap::small_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
inline void CMSBitMap::clear_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  // Range size is usually just 1 bit.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  _bm.clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
                  BitMap::small_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
inline void CMSBitMap::par_mark_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // Range size is usually just 1 bit.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  _bm.par_set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
                    BitMap::small_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
inline void CMSBitMap::par_clear_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  // Range size is usually just 1 bit.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  _bm.par_clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
                      BitMap::small_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
inline void CMSBitMap::mark_large_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  // Range size must be greater than 32 bytes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  _bm.set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
                BitMap::large_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
inline void CMSBitMap::clear_large_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  // Range size must be greater than 32 bytes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  _bm.clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
                  BitMap::large_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
inline void CMSBitMap::par_mark_large_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  // Range size must be greater than 32 bytes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
  _bm.par_set_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
                    BitMap::large_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
inline void CMSBitMap::par_clear_large_range(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  NOT_PRODUCT(region_invariant(mr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  // Range size must be greater than 32 bytes.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  _bm.par_clear_range(heapWordToOffset(mr.start()), heapWordToOffset(mr.end()),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
                      BitMap::large_range);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
// Starting at "addr" (inclusive) return a memory region
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
// corresponding to the first maximally contiguous marked ("1") region.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
inline MemRegion CMSBitMap::getAndClearMarkedRegion(HeapWord* addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  return getAndClearMarkedRegion(addr, endWord());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
// Starting at "start_addr" (inclusive) return a memory region
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
// corresponding to the first maximal contiguous marked ("1") region
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
// strictly less than end_addr.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
inline MemRegion CMSBitMap::getAndClearMarkedRegion(HeapWord* start_addr,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
                                                    HeapWord* end_addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  HeapWord *start, *end;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  start = getNextMarkedWordAddress  (start_addr, end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  end   = getNextUnmarkedWordAddress(start,      end_addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  assert(start <= end, "Consistency check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  MemRegion mr(start, end);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  if (!mr.is_empty()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    clear_range(mr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  return mr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
inline bool CMSBitMap::isMarked(HeapWord* addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
         "outside underlying space?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  return _bm.at(heapWordToOffset(addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
// The same as isMarked() but without a lock check.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
inline bool CMSBitMap::par_isMarked(HeapWord* addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
         "outside underlying space?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  return _bm.at(heapWordToOffset(addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
inline bool CMSBitMap::isUnmarked(HeapWord* addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  assert(_bmStartWord <= addr && addr < (_bmStartWord + _bmWordSize),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
         "outside underlying space?");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  return !_bm.at(heapWordToOffset(addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
// Return the HeapWord address corresponding to next "1" bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
// (inclusive).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
inline HeapWord* CMSBitMap::getNextMarkedWordAddress(HeapWord* addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  return getNextMarkedWordAddress(addr, endWord());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
// Return the least HeapWord address corresponding to next "1" bit
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
// starting at start_addr (inclusive) but strictly less than end_addr.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
inline HeapWord* CMSBitMap::getNextMarkedWordAddress(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  HeapWord* start_addr, HeapWord* end_addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  size_t nextOffset = _bm.get_next_one_offset(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
                        heapWordToOffset(start_addr),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
                        heapWordToOffset(end_addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  HeapWord* nextAddr = offsetToHeapWord(nextOffset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  assert(nextAddr >= start_addr &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
         nextAddr <= end_addr, "get_next_one postcondition");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  assert((nextAddr == end_addr) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
         isMarked(nextAddr), "get_next_one postcondition");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  return nextAddr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 13728
diff changeset
   202
// Return the HeapWord address corresponding to the next "0" bit
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
// (inclusive).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
inline HeapWord* CMSBitMap::getNextUnmarkedWordAddress(HeapWord* addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
  return getNextUnmarkedWordAddress(addr, endWord());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
22551
9bf46d16dcc6 8025856: Fix typos in the GC code
jwilhelm
parents: 13728
diff changeset
   208
// Return the HeapWord address corresponding to the next "0" bit
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
// (inclusive).
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
inline HeapWord* CMSBitMap::getNextUnmarkedWordAddress(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  HeapWord* start_addr, HeapWord* end_addr) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  size_t nextOffset = _bm.get_next_zero_offset(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
                        heapWordToOffset(start_addr),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
                        heapWordToOffset(end_addr));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
  HeapWord* nextAddr = offsetToHeapWord(nextOffset);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
  assert(nextAddr >= start_addr &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
         nextAddr <= end_addr, "get_next_zero postcondition");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  assert((nextAddr == end_addr) ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
          isUnmarked(nextAddr), "get_next_zero postcondition");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  return nextAddr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
inline bool CMSBitMap::isAllClear() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
  return getNextMarkedWordAddress(startWord()) >= endWord();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
inline void CMSBitMap::iterate(BitMapClosure* cl, HeapWord* left,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
                            HeapWord* right) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  assert_locked();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
  left = MAX2(_bmStartWord, left);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  right = MIN2(_bmStartWord + _bmWordSize, right);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
  if (right > left) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    _bm.iterate(cl, heapWordToOffset(left), heapWordToOffset(right));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
inline void CMSCollector::save_sweep_limits() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  _cmsGen->save_sweep_limit();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
inline bool CMSCollector::is_dead_obj(oop obj) const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
  HeapWord* addr = (HeapWord*)obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
  assert((_cmsGen->cmsSpace()->is_in_reserved(addr)
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   246
          && _cmsGen->cmsSpace()->block_is_obj(addr)),
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
         "must be object");
341
6578aad59716 6634032: CMS: Need CMSInitiatingPermOccupancyFraction for perm, divorcing from CMSInitiatingOccupancyFraction
ysr
parents: 1
diff changeset
   248
  return  should_unload_classes() &&
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
          _collectorState == Sweeping &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
         !_markBitMap.isMarked(addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
inline bool CMSCollector::should_abort_preclean() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  // We are in the midst of an "abortable preclean" and either
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  // scavenge is done or foreground GC wants to take over collection
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  return _collectorState == AbortablePreclean &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
         (_abort_preclean || _foregroundGCIsActive ||
7419
263dd4e89b9d 7001033: assert(gch->gc_cause() == GCCause::_scavenge_alot || !gch->incremental_collection_failed())
ysr
parents: 7397
diff changeset
   258
          GenCollectedHeap::heap()->incremental_collection_will_fail(true /* consult_young */));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
inline size_t CMSCollector::get_eden_used() const {
27903
14c6e2f23fa0 8065992: Change CMSCollector::_young_gen to be a ParNewGeneration*
brutisso
parents: 27686
diff changeset
   262
  return _young_gen->eden()->used();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
inline size_t CMSCollector::get_eden_capacity() const {
27903
14c6e2f23fa0 8065992: Change CMSCollector::_young_gen to be a ParNewGeneration*
brutisso
parents: 27686
diff changeset
   266
  return _young_gen->eden()->capacity();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
inline bool CMSStats::valid() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  return _valid_bits == _ALL_VALID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
inline void CMSStats::record_gc0_begin() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  if (_gc0_begin_time.is_updated()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
    float last_gc0_period = _gc0_begin_time.seconds();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
    _gc0_period = AdaptiveWeightedAverage::exp_avg(_gc0_period,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
      last_gc0_period, _gc0_alpha);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
    _gc0_alpha = _saved_alpha;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
    _valid_bits |= _GC0_VALID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  _cms_used_at_gc0_begin = _cms_gen->cmsSpace()->used();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
  _gc0_begin_time.update();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
inline void CMSStats::record_gc0_end(size_t cms_gen_bytes_used) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  float last_gc0_duration = _gc0_begin_time.seconds();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  _gc0_duration = AdaptiveWeightedAverage::exp_avg(_gc0_duration,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    last_gc0_duration, _gc0_alpha);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  // Amount promoted.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  _cms_used_at_gc0_end = cms_gen_bytes_used;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  size_t promoted_bytes = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  if (_cms_used_at_gc0_end >= _cms_used_at_gc0_begin) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
    promoted_bytes = _cms_used_at_gc0_end - _cms_used_at_gc0_begin;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
32623
390a27af5657 8134626: Misc cleanups after generation array removal
jwilhelm
parents: 30764
diff changeset
   299
  // If the young gen collection was skipped, then the
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  // number of promoted bytes will be 0 and adding it to the
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
  // average will incorrectly lessen the average.  It is, however,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  // also possible that no promotion was needed.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  //
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  // _gc0_promoted used to be calculated as
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  // _gc0_promoted = AdaptiveWeightedAverage::exp_avg(_gc0_promoted,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
  //  promoted_bytes, _gc0_alpha);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
  _cms_gen->gc_stats()->avg_promoted()->sample(promoted_bytes);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
  _gc0_promoted = (size_t) _cms_gen->gc_stats()->avg_promoted()->average();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
  // Amount directly allocated.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  size_t allocated_bytes = _cms_gen->direct_allocated_words() * HeapWordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  _cms_gen->reset_direct_allocated_words();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  _cms_allocated = AdaptiveWeightedAverage::exp_avg(_cms_allocated,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
    allocated_bytes, _gc0_alpha);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
inline void CMSStats::record_cms_begin() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  _cms_timer.stop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
  // This is just an approximate value, but is good enough.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  _cms_used_at_cms_begin = _cms_used_at_gc0_end;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
  _cms_period = AdaptiveWeightedAverage::exp_avg((float)_cms_period,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
    (float) _cms_timer.seconds(), _cms_alpha);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  _cms_begin_time.update();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
  _cms_timer.reset();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  _cms_timer.start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
inline void CMSStats::record_cms_end() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  _cms_timer.stop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  float cur_duration = _cms_timer.seconds();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  _cms_duration = AdaptiveWeightedAverage::exp_avg(_cms_duration,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    cur_duration, _cms_alpha);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
  _cms_end_time.update();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
  _cms_alpha = _saved_alpha;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
  _allow_duty_cycle_reduction = true;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  _valid_bits |= _CMS_VALID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
  _cms_timer.start();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
inline double CMSStats::cms_time_since_begin() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  return _cms_begin_time.seconds();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
inline double CMSStats::cms_time_since_end() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
  return _cms_end_time.seconds();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
inline double CMSStats::promotion_rate() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  assert(valid(), "statistics not valid yet");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  return gc0_promoted() / gc0_period();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
inline double CMSStats::cms_allocation_rate() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  assert(valid(), "statistics not valid yet");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
  return cms_allocated() / gc0_period();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
inline double CMSStats::cms_consumption_rate() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
  assert(valid(), "statistics not valid yet");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
  return (gc0_promoted() + cms_allocated()) / gc0_period();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
inline void ConcurrentMarkSweepGeneration::save_sweep_limit() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
  cmsSpace()->save_sweep_limit();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
inline MemRegion ConcurrentMarkSweepGeneration::used_region_at_save_marks() const {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
  return _cmsSpace->used_region_at_save_marks();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
inline void MarkFromRootsClosure::do_yield_check() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
  if (ConcurrentMarkSweepThread::should_yield() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
      !_collector->foregroundGCIsActive() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
      _yield) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    do_yield_work();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
35492
c8c0273e6b91 8146690: Make all classes in GC follow the naming convention.
david
parents: 32623
diff changeset
   385
inline void ParMarkFromRootsClosure::do_yield_check() {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  if (ConcurrentMarkSweepThread::should_yield() &&
27686
f91c482793e6 8064702: Remove the CMS foreground collector
brutisso
parents: 27625
diff changeset
   387
      !_collector->foregroundGCIsActive()) {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
    do_yield_work();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   392
inline void PushOrMarkClosure::do_yield_check() {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   393
  _parent->do_yield_check();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   394
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   395
35492
c8c0273e6b91 8146690: Make all classes in GC follow the naming convention.
david
parents: 32623
diff changeset
   396
inline void ParPushOrMarkClosure::do_yield_check() {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   397
  _parent->do_yield_check();
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   398
}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7419
diff changeset
   399
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
// Return value of "true" indicates that the on-going preclean
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
// should be aborted.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
inline bool ScanMarkedObjectsAgainCarefullyClosure::do_yield_check() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
  if (ConcurrentMarkSweepThread::should_yield() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
      !_collector->foregroundGCIsActive() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
      _yield) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
    // Sample young gen size before and after yield
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
    _collector->sample_eden();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
    do_yield_work();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    _collector->sample_eden();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    return _collector->should_abort_preclean();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  return false;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
inline void SurvivorSpacePrecleanClosure::do_yield_check() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
  if (ConcurrentMarkSweepThread::should_yield() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
      !_collector->foregroundGCIsActive() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
      _yield) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
    // Sample young gen size before and after yield
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    _collector->sample_eden();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
    do_yield_work();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
    _collector->sample_eden();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
inline void SweepClosure::do_yield_check(HeapWord* addr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
  if (ConcurrentMarkSweepThread::should_yield() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
      !_collector->foregroundGCIsActive() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
      _yield) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    do_yield_work(addr);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
inline void MarkRefsIntoAndScanClosure::do_yield_check() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  // The conditions are ordered for the remarking phase
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  // when _yield is false.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
  if (_yield &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
      !_collector->foregroundGCIsActive() &&
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
      ConcurrentMarkSweepThread::should_yield()) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
    do_yield_work();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
inline void ModUnionClosure::do_MemRegion(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
  // Align the end of mr so it's at a card boundary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
  // This is superfluous except at the end of the space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
  // we should do better than this XXX
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
  MemRegion mr2(mr.start(), (HeapWord*)round_to((intptr_t)mr.end(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
                 CardTableModRefBS::card_size /* bytes */));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
  _t->mark_range(mr2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
inline void ModUnionClosurePar::do_MemRegion(MemRegion mr) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  // Align the end of mr so it's at a card boundary.
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
  // This is superfluous except at the end of the space;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
  // we should do better than this XXX
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
  MemRegion mr2(mr.start(), (HeapWord*)round_to((intptr_t)mr.end(),
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
                 CardTableModRefBS::card_size /* bytes */));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
  _t->par_mark_range(mr2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
}
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
   462
30764
fec48bf5a827 8079792: GC directory structure cleanup
pliden
parents: 28033
diff changeset
   463
#endif // SHARE_VM_GC_CMS_CONCURRENTMARKSWEEPGENERATION_INLINE_HPP