/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "gc_implementation/g1/concurrentMark.hpp"
#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
// Utility routine to set an exclusive range of cards on the given
// card liveness bitmap
bool is_par) {
// Set the exclusive bit range [start_idx, end_idx).
// Silently clip the end index
// For small ranges use a simple loop; otherwise use set_range or
// use par_at_put_range (if parallel). The range is made up of the
// allow up to object sizes up to 4K to be handled using the loop.
if (is_par) {
card_bm->par_set_bit(i);
} else {
}
}
} else {
// Note BitMap::par_at_put_range() and BitMap::set_range() are exclusive.
if (is_par) {
} else {
}
}
}
// Returns the index in the liveness accounting card bitmap
// for the given address
// Below, the term "card num" means the result of shifting an address
// by the card shift -- address 0 corresponds to card number 0. One
// must subtract the card num of the bottom of the heap to obtain a
// card table index.
return card_num - heap_bottom_card_num();
}
// counting data structures.
BitMap* task_card_bm) {
// Add to the task local marked bytes for this region.
// Note: if we're looking at the last region in heap - end
// could be actually just beyond the end of the heap; end_idx
// will then correspond to a (non-existent) card that is also
// just beyond the heap.
// end of region is not card aligned - incremement to cover
// all the cards spanned by the region.
end_idx += 1;
}
// the 'par' BitMap routines.
// Set bits in the exclusive bit range [start_idx, end_idx).
}
// data structures for the given worker id.
HeapRegion* hr,
}
// Counts the given memory region, which may be a single object, in the
}
HeapRegion* hr,
BitMap* task_card_bm) {
}
// structures for the given worker id.
HeapRegion* hr,
}
// Attempts to mark the given object and, if successful, counts
HeapRegion* hr,
BitMap* task_card_bm) {
// Update the task specific count data for the object.
return true;
}
return false;
}
// Attempts to mark the given object and, if successful, counts
// given worker id.
HeapRegion* hr,
return true;
}
return false;
}
// Attempts to mark the given object and, if successful, counts
// given worker id.
HeapRegion* hr,
// Update the task specific count data for the object.
return true;
}
return false;
}
// As above - but we don't know the heap region containing the
// object and so have to supply it.
}
// Similar to the above routine but we already know the size, in words, of
// Update the task specific count data for the object.
return true;
}
return false;
}
// Unconditionally mark the given object, and unconditinally count
// the object in the counting structures for worker id 0.
// Should *not* be called from parallel code.
// Update the task specific count data for the object.
return true;
}
// As above - but we don't have the heap region containing the
// object, so we have to supply it.
}
if (end_addr > start_addr) {
// Right-open interval [start-offset, end-offset).
while (start_offset < end_offset) {
return false;
}
}
}
return true;
}
}
if (_cm->verbose_high()) {
}
// The local task queue looks full. We need to push some entries
// to the global stack.
if (_cm->verbose_medium()) {
"moving entries to the global stack",
_task_id);
}
// this should succeed since, even if we overflow the global
// stack, we should have definitely removed some entries from the
// local queue. So, there must be space on it.
}
if (tmp_size > _local_max_size) {
}
++_local_pushes );
}
// This determines whether the method below will check both the local
// and global fingers when determining whether to push on the stack a
// gray object (value 1) or whether it will only check the global one
// (value 0). The tradeoffs are that the former will be a bit more
// accurate and possibly push less on the stack, but it might also be
// a little bit slower.
if (_cm->verbose_high()) {
}
// Only get the containing region if the object is not marked on the
// bitmap (otherwise, it's a waste of time since we won't do
// anything with it).
if (_cm->verbose_high()) {
}
// we need to mark it first
// No OrderAccess:store_load() is needed. It is implicit in the
// CAS done in CMBitMap::parMark() call in the routine above.
// we will check both the local and global fingers
if (_cm->verbose_high()) {
}
// do nothing
} else if (objAddr < global_finger) {
// Notice that the global finger might be moving forward
// concurrently. This is not a problem. In the worst case, we
// mark the object while it is above the global finger and, by
// the time we read the global finger, it has moved forward
// passed this object. In this case, the object will probably
// be visited when a task is scanning the region and will also
// be pushed on the stack. So, some duplicate work, but no
// correctness problems.
if (_cm->verbose_high()) {
}
} else {
// do nothing
}
#else // _CHECK_BOTH_FINGERS_
// we will only check the global finger
if (objAddr < global_finger) {
// see long comment above
if (_cm->verbose_high()) {
}
}
#endif // _CHECK_BOTH_FINGERS_
}
}
}
}
}
// Note we are overriding the read-only view of the prev map here, via
// the cast.
}
} else {
}
// Given that we're looking for a region that contains an object
// header it's impossible to get back a HC region.
// We cannot assert that word_size == obj->size() given that obj
// might not be in a consistent state (another thread might be in
// the process of copying it). So the best thing we can do is to
// assert that word_size is under an upper bound which is its
// containing region's capacity.
HR_FORMAT_PARAMS(hr)));
}
}
}
#endif // SHARE_VM_GC_IMPLEMENTATION_G1_CONCURRENTMARK_INLINE_HPP