8073146: G1 merges thread local age tables too early with global age table

Move merging of age and survivor table to the end of GC.

Reviewed-by: mgerdin, david
This commit is contained in:
Thomas Schatzl 2015-08-20 15:17:43 +02:00
parent 6cca258181
commit 041c76d48b
3 changed files with 9 additions and 14 deletions

View File

@ -3760,8 +3760,7 @@ void G1CollectedHeap::register_humongous_regions_with_cset() {
cl.flush_rem_set_entries();
}
void
G1CollectedHeap::setup_surviving_young_words() {
void G1CollectedHeap::setup_surviving_young_words() {
assert(_surviving_young_words == NULL, "pre-condition");
uint array_length = g1_policy()->young_cset_region_length();
_surviving_young_words = NEW_C_HEAP_ARRAY(size_t, (size_t) array_length, mtGC);
@ -3777,17 +3776,15 @@ G1CollectedHeap::setup_surviving_young_words() {
#endif // !ASSERT
}
void
G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
void G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
assert_at_safepoint(true);
uint array_length = g1_policy()->young_cset_region_length();
for (uint i = 0; i < array_length; ++i) {
_surviving_young_words[i] += surv_young_words[i];
}
}
void
G1CollectedHeap::cleanup_surviving_young_words() {
void G1CollectedHeap::cleanup_surviving_young_words() {
guarantee( _surviving_young_words != NULL, "pre-condition" );
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words);
_surviving_young_words = NULL;
@ -4605,10 +4602,6 @@ public:
_g1h->g1_policy()->phase_times()->record_thread_work_item(G1GCPhaseTimes::Termination, worker_id, evac_term_attempts);
}
// Flush any statistics.
_g1h->g1_policy()->record_thread_age_table(pss->age_table());
_g1h->update_surviving_young_words(pss->surviving_young_words());
assert(pss->queue_is_empty(), "should be empty");
if (PrintTerminationStats) {

View File

@ -72,8 +72,12 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint worker_id)
}
G1ParScanThreadState::~G1ParScanThreadState() {
// Update allocation statistics.
_plab_allocator->flush_and_retire_stats();
delete _plab_allocator;
_g1h->g1_policy()->record_thread_age_table(&_age_table);
// Update heap statistics.
_g1h->update_surviving_young_words(_surviving_young_words);
FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
}
@ -252,7 +256,7 @@ oop G1ParScanThreadState::copy_to_survivor_space(InCSetState const state,
} else {
obj->set_mark(old_mark->set_age(age));
}
age_table()->add(age, word_sz);
_age_table.add(age, word_sz);
} else {
obj->set_mark(old_mark);
}

View File

@ -87,8 +87,6 @@ class G1ParScanThreadState : public CHeapObj<mtGC> {
void set_ref_processor(ReferenceProcessor* rp) { _scanner.set_ref_processor(rp); }
ageTable* age_table() { return &_age_table; }
#ifdef ASSERT
bool queue_is_empty() const { return _refs->is_empty(); }