src/share/vm/gc/g1/g1CollectedHeap.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/gc/g1/g1CollectedHeap.cpp Tue Mar 8 15:19:29 2016
--- new/src/share/vm/gc/g1/g1CollectedHeap.cpp Tue Mar 8 15:19:28 2016
*** 1126,1136 ****
--- 1126,1136 ----
ModRefBarrierSet* _mr_bs;
public:
PostMCRemSetClearClosure(G1CollectedHeap* g1h, ModRefBarrierSet* mr_bs) :
_g1h(g1h), _mr_bs(mr_bs) {}
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
HeapRegionRemSet* hrrs = r->rem_set();
_g1h->reset_gc_time_stamps(r);
if (r->is_continues_humongous()) {
*** 1144,1155 ****
--- 1144,1153 ----
// corresponding to the used region. But no: if we leave a dirty card
// in a region we might allocate into, then it would prevent that card
// from being enqueued, and cause it to be missed.
// Re: the performance cost: we shouldn't be doing full GC anyway!
_mr_bs->clear(MemRegion(r->bottom(), r->end()));
return false;
}
};
void G1CollectedHeap::clear_rsets_post_compaction() {
PostMCRemSetClearClosure rs_clear(this, g1_barrier_set());
*** 1163,1178 ****
--- 1161,1175 ----
RebuildRSOutOfRegionClosure(G1CollectedHeap* g1, uint worker_i = 0) :
_cl(g1->g1_rem_set(), worker_i),
_g1h(g1)
{ }
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
if (!r->is_continues_humongous()) {
_cl.set_from(r);
r->oop_iterate(&_cl);
}
return false;
}
};
class ParRebuildRSTask: public AbstractGangTask {
G1CollectedHeap* _g1;
*** 1190,1203 ****
--- 1187,1199 ----
class PostCompactionPrinterClosure: public HeapRegionClosure {
private:
G1HRPrinter* _hr_printer;
public:
! bool doHeapRegion(HeapRegion* hr) {
! void doHeapRegion(HeapRegion* hr) {
assert(!hr->is_young(), "not expecting to find young regions");
_hr_printer->post_compaction(hr);
return false;
}
PostCompactionPrinterClosure(G1HRPrinter* hr_printer)
: _hr_printer(hr_printer) { }
};
*** 2143,2160 ****
--- 2139,2155 ----
public:
CheckGCTimeStampsHRClosure(unsigned gc_time_stamp) :
_gc_time_stamp(gc_time_stamp), _failures(false) { }
! virtual bool doHeapRegion(HeapRegion* hr) {
! virtual void doHeapRegion(HeapRegion* hr) {
unsigned region_gc_time_stamp = hr->get_gc_time_stamp();
if (_gc_time_stamp != region_gc_time_stamp) {
log_error(gc, verify)("Region " HR_FORMAT " has GC time stamp = %d, expected %d", HR_FORMAT_PARAMS(hr),
region_gc_time_stamp, _gc_time_stamp);
_failures = true;
}
return false;
}
bool failures() { return _failures; }
};
*** 2195,2207 ****
--- 2190,2201 ----
class SumUsedClosure: public HeapRegionClosure {
size_t _used;
public:
SumUsedClosure() : _used(0) {}
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
_used += r->used();
return false;
}
size_t result() { return _used; }
};
size_t G1CollectedHeap::recalculate_used() const {
*** 2465,2501 ****
--- 2459,2505 ----
class IterateOopClosureRegionClosure: public HeapRegionClosure {
ExtendedOopClosure* _cl;
public:
IterateOopClosureRegionClosure(ExtendedOopClosure* cl) : _cl(cl) {}
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
if (!r->is_continues_humongous()) {
r->oop_iterate(_cl);
}
return false;
}
};
// Iterates an ObjectClosure over all objects within a HeapRegion.
class IterateObjectClosureRegionClosure: public HeapRegionClosure {
ObjectClosure* _cl;
public:
IterateObjectClosureRegionClosure(ObjectClosure* cl) : _cl(cl) {}
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
if (!r->is_continues_humongous()) {
r->object_iterate(_cl);
}
return false;
}
};
void G1CollectedHeap::object_iterate(ObjectClosure* cl) {
IterateObjectClosureRegionClosure blk(cl);
heap_region_iterate(&blk);
}
+ void G1CollectedHeap::heap_region_iterate(AbortableHeapRegionClosure* cl) const {
+ _hrm.iterate(cl);
+ }
+
+ void
+ G1CollectedHeap::heap_region_par_iterate(AbortableHeapRegionClosure* cl,
+ uint worker_id,
+ HeapRegionClaimer *hrclaimer,
+ bool concurrent) const {
+ _hrm.par_iterate(cl, worker_id, hrclaimer, concurrent);
+ }
+
void G1CollectedHeap::heap_region_iterate(HeapRegionClosure* cl) const {
_hrm.iterate(cl);
}
void
*** 2580,2593 ****
--- 2584,2594 ----
void G1CollectedHeap::collection_set_iterate(HeapRegionClosure* cl) {
HeapRegion* r = collection_set()->head();
while (r != NULL) {
HeapRegion* next = r->next_in_collection_set();
if (cl->doHeapRegion(r)) {
cl->incomplete();
return;
}
+ cl->doHeapRegion(r);
r = next;
}
}
void G1CollectedHeap::collection_set_iterate_from(HeapRegion* r,
*** 2600,2622 ****
--- 2601,2617 ----
assert(r->in_collection_set(),
"Start region must be a member of the collection set.");
HeapRegion* cur = r;
while (cur != NULL) {
HeapRegion* next = cur->next_in_collection_set();
if (cl->doHeapRegion(cur) && false) {
cl->incomplete();
return;
}
+ cl->doHeapRegion(cur);
cur = next;
}
cur = collection_set()->head();
while (cur != r) {
HeapRegion* next = cur->next_in_collection_set();
if (cl->doHeapRegion(cur) && false) {
cl->incomplete();
return;
}
+ cl->doHeapRegion(cur);
cur = next;
}
}
HeapRegion* G1CollectedHeap::next_compaction_region(const HeapRegion* from) const {
*** 2684,2696 ****
--- 2679,2690 ----
class PrintRegionClosure: public HeapRegionClosure {
outputStream* _st;
public:
PrintRegionClosure(outputStream* st) : _st(st) {}
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
r->print_on(_st);
return false;
}
};
bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
const HeapRegion* hr,
*** 2794,2804 ****
--- 2788,2798 ----
private:
const char* _msg;
size_t _occupied_sum;
public:
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
HeapRegionRemSet* hrrs = r->rem_set();
size_t occupied = hrrs->occupied();
_occupied_sum += occupied;
tty->print_cr("Printing RSet for region " HR_FORMAT, HR_FORMAT_PARAMS(r));
*** 2806,2816 ****
--- 2800,2809 ----
tty->print_cr(" RSet is empty");
} else {
hrrs->print();
}
tty->print_cr("----------");
return false;
}
PrintRSetsClosure(const char* msg) : _msg(msg), _occupied_sum(0) {
tty->cr();
tty->print_cr("========================================");
*** 3020,3032 ****
--- 3013,3025 ----
: _total_humongous(0),
_candidate_humongous(0),
_dcq(&JavaThread::dirty_card_queue_set()) {
}
! virtual bool doHeapRegion(HeapRegion* r) {
! virtual void doHeapRegion(HeapRegion* r) {
if (!r->is_starts_humongous()) {
- return false;
}
G1CollectedHeap* g1h = G1CollectedHeap::heap();
bool is_candidate = humongous_region_is_candidate(g1h, r);
uint rindex = r->hrm_index();
*** 3063,3074 ****
--- 3056,3065 ----
r->rem_set()->clear_locked();
}
assert(r->rem_set()->is_empty(), "At this point any humongous candidate remembered set must be empty.");
}
_total_humongous++;
return false;
}
size_t total_humongous() const { return _total_humongous; }
size_t candidate_humongous() const { return _candidate_humongous; }
*** 3096,3117 ****
--- 3087,3107 ----
cl.flush_rem_set_entries();
}
class VerifyRegionRemSetClosure : public HeapRegionClosure {
public:
! bool doHeapRegion(HeapRegion* hr) {
! void doHeapRegion(HeapRegion* hr) {
if (!hr->is_archive() && !hr->is_continues_humongous()) {
hr->verify_rem_set();
}
return false;
}
};
#ifdef ASSERT
class VerifyCSetClosure: public HeapRegionClosure {
public:
! bool doHeapRegion(HeapRegion* hr) {
! void doHeapRegion(HeapRegion* hr) {
// Here we check that the CSet region's RSet is ready for parallel
// iteration. The fields that we'll verify are only manipulated
// when the region is part of a CSet and is collected. Afterwards,
// we reset these fields when we clear the region's RSet (when the
// region is freed) so they are ready when the region is
*** 3121,3131 ****
--- 3111,3120 ----
// evacuation failure handling.
guarantee(hr->rem_set()->verify_ready_for_par_iteration(), "verification");
// Here's a good place to add any other checks we'd like to
// perform on CSet regions.
return false;
}
};
#endif // ASSERT
uint G1CollectedHeap::num_task_queues() const {
*** 4991,5003 ****
--- 4980,4992 ----
G1FreeHumongousRegionClosure(FreeRegionList* free_region_list) :
_free_region_list(free_region_list), _humongous_regions_removed(0), _freed_bytes(0) {
}
! virtual bool doHeapRegion(HeapRegion* r) {
! virtual void doHeapRegion(HeapRegion* r) {
if (!r->is_starts_humongous()) {
- return false;
}
G1CollectedHeap* g1h = G1CollectedHeap::heap();
oop obj = (oop)r->bottom();
*** 5042,5052 ****
--- 5031,5041 ----
r->rem_set()->strong_code_roots_list_length(),
next_bitmap->isMarked(r->bottom()),
g1h->is_humongous_reclaim_candidate(region_idx),
obj->is_typeArray()
);
- return false;
}
guarantee(obj->is_typeArray(),
"Only eagerly reclaiming type arrays is supported, but the object "
PTR_FORMAT " is not.", p2i(r->bottom()));
*** 5072,5083 ****
--- 5061,5070 ----
r->set_containing_set(NULL);
_humongous_regions_removed++;
g1h->free_humongous_region(r, _free_region_list, false);
r = next;
} while (r != NULL);
return false;
}
uint humongous_free_count() {
return _humongous_regions_removed;
}
*** 5191,5207 ****
--- 5178,5193 ----
class NoYoungRegionsClosure: public HeapRegionClosure {
private:
bool _success;
public:
NoYoungRegionsClosure() : _success(true) { }
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
if (r->is_young()) {
log_error(gc, verify)("Region [" PTR_FORMAT ", " PTR_FORMAT ") tagged as young",
p2i(r->bottom()), p2i(r->end()));
_success = false;
}
return false;
}
bool success() { return _success; }
};
bool G1CollectedHeap::check_young_list_empty(bool check_heap) {
*** 5221,5242 ****
--- 5207,5227 ----
HeapRegionSet *_old_set;
public:
TearDownRegionSetsClosure(HeapRegionSet* old_set) : _old_set(old_set) { }
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
if (r->is_old()) {
_old_set->remove(r);
} else {
// We ignore free regions, we'll empty the free list afterwards.
// We ignore young regions, we'll empty the young list afterwards.
// We ignore humongous regions, we're not tearing down the
// humongous regions set.
assert(r->is_free() || r->is_young() || r->is_humongous(),
"it cannot be another type");
}
return false;
}
~TearDownRegionSetsClosure() {
assert(_old_set->is_empty(), "post-condition");
}
*** 5288,5298 ****
--- 5273,5283 ----
if (!free_list_only) {
assert(_old_set->is_empty(), "pre-condition");
}
}
! bool doHeapRegion(HeapRegion* r) {
! void doHeapRegion(HeapRegion* r) {
if (r->is_empty()) {
// Add free regions to the free list
r->set_free();
r->set_allocation_context(AllocationContext::system());
_hrm->insert_into_free_list(r);
*** 5314,5325 ****
--- 5299,5308 ----
}
_old_set->add(r);
}
_total_used += r->used();
}
return false;
}
size_t total_used() {
return _total_used;
}
src/share/vm/gc/g1/g1CollectedHeap.cpp
Index
Unified diffs
Context diffs
Sdiffs
Wdiffs
Patch
New
Old
Previous File
Next File