src/share/vm/gc_implementation/g1/heapRegion.cpp
Print this page
rev 6796 : [mq]: templateOopIterate
rev 6801 : imported patch defaultToTrue
*** 55,65 ****
FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r,
OopClosure* oc) :
_r_bottom(r->bottom()), _r_end(r->end()), _oc(oc) { }
! template<class ClosureType>
HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h,
HeapRegion* hr,
HeapWord* cur, HeapWord* top) {
oop cur_oop = oop(cur);
size_t oop_size = hr->block_size(cur);
--- 55,65 ----
FilterOutOfRegionClosure::FilterOutOfRegionClosure(HeapRegion* r,
OopClosure* oc) :
_r_bottom(r->bottom()), _r_end(r->end()), _oc(oc) { }
! template<bool nv, class ClosureType>
HeapWord* walk_mem_region_loop(ClosureType* cl, G1CollectedHeap* g1h,
HeapRegion* hr,
HeapWord* cur, HeapWord* top) {
oop cur_oop = oop(cur);
size_t oop_size = hr->block_size(cur);
*** 67,77 ****
while (next_obj < top) {
// Keep filtering the remembered set.
if (!g1h->is_obj_dead(cur_oop, hr)) {
// Bottom lies entirely below top, so we can call the
// non-memRegion version of oop_iterate below.
! cur_oop->oop_iterate(cl);
}
cur = next_obj;
cur_oop = oop(cur);
oop_size = hr->block_size(cur);
next_obj = cur + oop_size;
--- 67,77 ----
while (next_obj < top) {
// Keep filtering the remembered set.
if (!g1h->is_obj_dead(cur_oop, hr)) {
// Bottom lies entirely below top, so we can call the
// non-memRegion version of oop_iterate below.
! cur_oop->oop_iterate<nv>(cl);
}
cur = next_obj;
cur_oop = oop(cur);
oop_size = hr->block_size(cur);
next_obj = cur + oop_size;
*** 99,141 ****
// Start filtering what we add to the remembered set. If the object is
// not considered dead, either because it is marked (in the mark bitmap)
// or it was allocated after marking finished, then we add it. Otherwise
// we can safely ignore the object.
if (!g1h->is_obj_dead(oop(bottom), _hr)) {
! oop_size = oop(bottom)->oop_iterate(cl2, mr);
} else {
oop_size = _hr->block_size(bottom);
}
bottom += oop_size;
if (bottom < top) {
// We replicate the loop below for several kinds of possible filters.
switch (_fk) {
case NoFilterKind:
! bottom = walk_mem_region_loop(_cl, g1h, _hr, bottom, top);
break;
case IntoCSFilterKind: {
FilterIntoCSClosure filt(this, g1h, _cl);
! bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
break;
}
case OutOfRegionFilterKind: {
FilterOutOfRegionClosure filt(_hr, _cl);
! bottom = walk_mem_region_loop(&filt, g1h, _hr, bottom, top);
break;
}
default:
ShouldNotReachHere();
}
// Last object. Need to do dead-obj filtering here too.
if (!g1h->is_obj_dead(oop(bottom), _hr)) {
! oop(bottom)->oop_iterate(cl2, mr);
}
}
}
// Minimum region size; we won't go lower than that.
--- 99,141 ----
// Start filtering what we add to the remembered set. If the object is
// not considered dead, either because it is marked (in the mark bitmap)
// or it was allocated after marking finished, then we add it. Otherwise
// we can safely ignore the object.
if (!g1h->is_obj_dead(oop(bottom), _hr)) {
! oop_size = oop(bottom)->oop_iterate<false>(cl2, mr);
} else {
oop_size = _hr->block_size(bottom);
}
bottom += oop_size;
if (bottom < top) {
// We replicate the loop below for several kinds of possible filters.
switch (_fk) {
case NoFilterKind:
! bottom = walk_mem_region_loop<false>(_cl, g1h, _hr, bottom, top);
break;
case IntoCSFilterKind: {
FilterIntoCSClosure filt(this, g1h, _cl);
! bottom = walk_mem_region_loop<true>(&filt, g1h, _hr, bottom, top);
break;
}
case OutOfRegionFilterKind: {
FilterOutOfRegionClosure filt(_hr, _cl);
! bottom = walk_mem_region_loop<true>(&filt, g1h, _hr, bottom, top);
break;
}
default:
ShouldNotReachHere();
}
// Last object. Need to do dead-obj filtering here too.
if (!g1h->is_obj_dead(oop(bottom), _hr)) {
! oop(bottom)->oop_iterate<false>(cl2, mr);
}
}
}
// Minimum region size; we won't go lower than that.