< prev index next >
src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Print this page
rev 49184 : imported patch 8197569-refactor-eager-reclaim
rev 49185 : [mq]: 8197569-stefanj-review
*** 2580,2613 ****
size_t buffer_num = dcqs.completed_buffers_num();
return buffer_size * buffer_num + extra_cards;
}
class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
private:
size_t _total_humongous;
size_t _candidate_humongous;
DirtyCardQueue _dcq;
! // We don't nominate objects with many remembered set entries, on
! // the assumption that such objects are likely still live.
! bool is_remset_small(HeapRegion* region) const {
! HeapRegionRemSet* const rset = region->rem_set();
! return G1EagerReclaimHumongousObjectsWithStaleRefs
! ? rset->occupancy_less_or_equal_than(G1RSetSparseRegionEntries)
! : rset->is_empty();
! }
!
! bool humongous_region_is_candidate(G1CollectedHeap* heap, HeapRegion* region) const {
assert(region->is_starts_humongous(), "Must start a humongous object");
oop obj = oop(region->bottom());
// Dead objects cannot be eager reclaim candidates. Due to class
// unloading it is unsafe to query their classes so we return early.
! if (heap->is_obj_dead(obj, region)) {
return false;
}
// Candidate selection must satisfy the following constraints
// while concurrent marking is in progress:
--- 2580,2614 ----
size_t buffer_num = dcqs.completed_buffers_num();
return buffer_size * buffer_num + extra_cards;
}
+ bool G1CollectedHeap::is_potential_eager_reclaim_candidate(HeapRegion* r) const {
+ // We don't nominate objects with many remembered set entries, on
+ // the assumption that such objects are likely still live.
+ HeapRegionRemSet* rem_set = r->rem_set();
+
+ return G1EagerReclaimHumongousObjectsWithStaleRefs ?
+ rem_set->occupancy_less_or_equal_than(G1RSetSparseRegionEntries) :
+ G1EagerReclaimHumongousObjects && rem_set->is_empty();
+ }
+
class RegisterHumongousWithInCSetFastTestClosure : public HeapRegionClosure {
private:
size_t _total_humongous;
size_t _candidate_humongous;
DirtyCardQueue _dcq;
! bool humongous_region_is_candidate(G1CollectedHeap* g1h, HeapRegion* region) const {
assert(region->is_starts_humongous(), "Must start a humongous object");
oop obj = oop(region->bottom());
// Dead objects cannot be eager reclaim candidates. Due to class
// unloading it is unsafe to query their classes so we return early.
! if (g1h->is_obj_dead(obj, region)) {
return false;
}
// Candidate selection must satisfy the following constraints
// while concurrent marking is in progress:
*** 2643,2653 ****
// such objects to be built-in and so ensured to be kept live.
// Frequent allocation and drop of large binary blobs is an
// important use case for eager reclaim, and this special handling
// may reduce needed headroom.
! return obj->is_typeArray() && is_remset_small(region);
}
public:
RegisterHumongousWithInCSetFastTestClosure()
: _total_humongous(0),
--- 2644,2655 ----
// such objects to be built-in and so ensured to be kept live.
// Frequent allocation and drop of large binary blobs is an
// important use case for eager reclaim, and this special handling
// may reduce needed headroom.
! return obj->is_typeArray() &&
! g1h->is_potential_eager_reclaim_candidate(region);
}
public:
RegisterHumongousWithInCSetFastTestClosure()
: _total_humongous(0),
*** 4815,4828 ****
next_bitmap->is_marked(r->bottom()),
g1h->is_humongous_reclaim_candidate(region_idx),
obj->is_typeArray()
);
! // Need to clear mark bit of the humongous object if already set.
! if (next_bitmap->is_marked(r->bottom())) {
! next_bitmap->clear(r->bottom());
! }
_humongous_objects_reclaimed++;
do {
HeapRegion* next = g1h->next_region_in_humongous(r);
_freed_bytes += r->used();
r->set_containing_set(NULL);
--- 4817,4827 ----
next_bitmap->is_marked(r->bottom()),
g1h->is_humongous_reclaim_candidate(region_idx),
obj->is_typeArray()
);
! g1h->concurrent_mark()->humongous_object_eagerly_reclaimed(r);
_humongous_objects_reclaimed++;
do {
HeapRegion* next = g1h->next_region_in_humongous(r);
_freed_bytes += r->used();
r->set_containing_set(NULL);
< prev index next >