< prev index next >
src/share/vm/gc/g1/concurrentMark.inline.hpp
Print this page
*** 87,99 ****
HeapWord* start = mr.start();
HeapWord* end = mr.end();
size_t region_size_bytes = mr.byte_size();
uint index = hr->hrm_index();
- assert(!hr->is_continues_humongous(), "should not be HC region");
assert(hr == g1h->heap_region_containing(start), "sanity");
- assert(hr == g1h->heap_region_containing(mr.last()), "sanity");
assert(marked_bytes_array != NULL, "pre-condition");
assert(task_card_bm != NULL, "pre-condition");
// Add to the task local marked bytes for this region.
marked_bytes_array[index] += region_size_bytes;
--- 87,97 ----
*** 114,152 ****
// the 'par' BitMap routines.
// Set bits in the exclusive bit range [start_idx, end_idx).
set_card_bitmap_range(task_card_bm, start_idx, end_idx, false /* is_par */);
}
- // Counts the given memory region in the task/worker counting
- // data structures for the given worker id.
- inline void ConcurrentMark::count_region(MemRegion mr,
- HeapRegion* hr,
- uint worker_id) {
- size_t* marked_bytes_array = count_marked_bytes_array_for(worker_id);
- BitMap* task_card_bm = count_card_bitmap_for(worker_id);
- count_region(mr, hr, marked_bytes_array, task_card_bm);
- }
-
// Counts the given object in the given task/worker counting data structures.
inline void ConcurrentMark::count_object(oop obj,
HeapRegion* hr,
size_t* marked_bytes_array,
! BitMap* task_card_bm) {
! MemRegion mr((HeapWord*)obj, obj->size());
count_region(mr, hr, marked_bytes_array, task_card_bm);
}
// Attempts to mark the given object and, if successful, counts
// the object in the given task/worker counting structures.
inline bool ConcurrentMark::par_mark_and_count(oop obj,
HeapRegion* hr,
size_t* marked_bytes_array,
BitMap* task_card_bm) {
! HeapWord* addr = (HeapWord*)obj;
! if (_nextMarkBitMap->parMark(addr)) {
// Update the task specific count data for the object.
! count_object(obj, hr, marked_bytes_array, task_card_bm);
return true;
}
return false;
}
--- 112,149 ----
// the 'par' BitMap routines.
// Set bits in the exclusive bit range [start_idx, end_idx).
set_card_bitmap_range(task_card_bm, start_idx, end_idx, false /* is_par */);
}
// Counts the given object in the given task/worker counting data structures.
inline void ConcurrentMark::count_object(oop obj,
HeapRegion* hr,
size_t* marked_bytes_array,
! BitMap* task_card_bm,
! size_t word_size) {
! assert(!hr->is_continues_humongous(), "Cannot enter count_object with continues humongous");
! if (!hr->is_starts_humongous()) {
! MemRegion mr((HeapWord*)obj, word_size);
! count_region(mr, hr, marked_bytes_array, task_card_bm);
! } else {
! do {
! MemRegion mr(hr->bottom(), hr->top());
count_region(mr, hr, marked_bytes_array, task_card_bm);
+ hr = _g1h->next_region_by_index(hr);
+ } while (hr != NULL && hr->is_continues_humongous());
+ }
}
// Attempts to mark the given object and, if successful, counts
// the object in the given task/worker counting structures.
inline bool ConcurrentMark::par_mark_and_count(oop obj,
HeapRegion* hr,
size_t* marked_bytes_array,
BitMap* task_card_bm) {
! if (_nextMarkBitMap->parMark((HeapWord*)obj)) {
// Update the task specific count data for the object.
! count_object(obj, hr, marked_bytes_array, task_card_bm, obj->size());
return true;
}
return false;
}
*** 155,168 ****
// given worker id.
inline bool ConcurrentMark::par_mark_and_count(oop obj,
size_t word_size,
HeapRegion* hr,
uint worker_id) {
! HeapWord* addr = (HeapWord*)obj;
! if (_nextMarkBitMap->parMark(addr)) {
! MemRegion mr(addr, word_size);
! count_region(mr, hr, worker_id);
return true;
}
return false;
}
--- 152,165 ----
// given worker id.
inline bool ConcurrentMark::par_mark_and_count(oop obj,
size_t word_size,
HeapRegion* hr,
uint worker_id) {
! if (_nextMarkBitMap->parMark((HeapWord*)obj)) {
! size_t* marked_bytes_array = count_marked_bytes_array_for(worker_id);
! BitMap* task_card_bm = count_card_bitmap_for(worker_id);
! count_object(obj, hr, marked_bytes_array, task_card_bm, word_size);
return true;
}
return false;
}
*** 349,359 ****
assert(obj != NULL, "null check is implicit");
if (!_nextMarkBitMap->isMarked(objAddr)) {
// 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).
! HeapRegion* hr = _g1h->heap_region_containing_raw(obj);
if (!hr->obj_allocated_since_next_marking(obj)) {
make_reference_grey(obj, hr);
}
}
}
--- 346,356 ----
assert(obj != NULL, "null check is implicit");
if (!_nextMarkBitMap->isMarked(objAddr)) {
// 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).
! HeapRegion* hr = _g1h->heap_region_containing(obj);
if (!hr->obj_allocated_since_next_marking(obj)) {
make_reference_grey(obj, hr);
}
}
}
*** 369,397 ****
inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
uint worker_id, HeapRegion* hr) {
assert(obj != NULL, "pre-condition");
HeapWord* addr = (HeapWord*) obj;
if (hr == NULL) {
! hr = _g1h->heap_region_containing_raw(addr);
} else {
assert(hr->is_in(addr), "pre-condition");
}
assert(hr != NULL, "sanity");
// Given that we're looking for a region that contains an object
// header it's impossible to get back a HC region.
assert(!hr->is_continues_humongous(), "sanity");
- // 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.
- assert(word_size * HeapWordSize <= hr->capacity(),
- "size: " SIZE_FORMAT " capacity: " SIZE_FORMAT " " HR_FORMAT,
- word_size * HeapWordSize, hr->capacity(),
- HR_FORMAT_PARAMS(hr));
-
if (addr < hr->next_top_at_mark_start()) {
if (!_nextMarkBitMap->isMarked(addr)) {
par_mark_and_count(obj, word_size, hr, worker_id);
}
}
--- 366,384 ----
inline void ConcurrentMark::grayRoot(oop obj, size_t word_size,
uint worker_id, HeapRegion* hr) {
assert(obj != NULL, "pre-condition");
HeapWord* addr = (HeapWord*) obj;
if (hr == NULL) {
! hr = _g1h->heap_region_containing(addr);
} else {
assert(hr->is_in(addr), "pre-condition");
}
assert(hr != NULL, "sanity");
// Given that we're looking for a region that contains an object
// header it's impossible to get back a HC region.
assert(!hr->is_continues_humongous(), "sanity");
if (addr < hr->next_top_at_mark_start()) {
if (!_nextMarkBitMap->isMarked(addr)) {
par_mark_and_count(obj, word_size, hr, worker_id);
}
}
< prev index next >