< prev index next >
src/hotspot/share/gc/g1/g1RemSet.cpp
Print this page
rev 49520 : imported patch 8178105-switch-at-remark
rev 49524 : imported patch 8200426-g1h-refactoring
rev 49525 : [mq]: 8200426-sangheon-review
*** 274,291 ****
G1CollectedHeap::heap()->verifier()->verify_card_table_cleanup();
#endif
}
};
! G1RemSet::G1RemSet(G1CollectedHeap* g1,
G1CardTable* ct,
G1HotCardCache* hot_card_cache) :
! _g1(g1),
_scan_state(new G1RemSetScanState()),
_num_conc_refined_cards(0),
_ct(ct),
! _g1p(_g1->g1_policy()),
_hot_card_cache(hot_card_cache),
_prev_period_summary() {
}
G1RemSet::~G1RemSet() {
--- 274,291 ----
G1CollectedHeap::heap()->verifier()->verify_card_table_cleanup();
#endif
}
};
! G1RemSet::G1RemSet(G1CollectedHeap* g1h,
G1CardTable* ct,
G1HotCardCache* hot_card_cache) :
! _g1h(g1h),
_scan_state(new G1RemSetScanState()),
_num_conc_refined_cards(0),
_ct(ct),
! _g1p(_g1h->g1_policy()),
_hot_card_cache(hot_card_cache),
_prev_period_summary() {
}
G1RemSet::~G1RemSet() {
*** 406,418 ****
void G1RemSet::scan_rem_set(G1ParScanThreadState* pss,
CodeBlobClosure* heap_region_codeblobs,
uint worker_i) {
double rs_time_start = os::elapsedTime();
! G1ScanObjsDuringScanRSClosure scan_cl(_g1, pss);
G1ScanRSForRegionClosure cl(_scan_state, &scan_cl, heap_region_codeblobs, worker_i);
! _g1->collection_set_iterate_from(&cl, worker_i);
double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) -
cl.strong_code_root_scan_time_sec();
G1GCPhaseTimes* p = _g1p->phase_times();
--- 406,418 ----
void G1RemSet::scan_rem_set(G1ParScanThreadState* pss,
CodeBlobClosure* heap_region_codeblobs,
uint worker_i) {
double rs_time_start = os::elapsedTime();
! G1ScanObjsDuringScanRSClosure scan_cl(_g1h, pss);
G1ScanRSForRegionClosure cl(_scan_state, &scan_cl, heap_region_codeblobs, worker_i);
! _g1h->collection_set_iterate_from(&cl, worker_i);
double scan_rs_time_sec = (os::elapsedTime() - rs_time_start) -
cl.strong_code_root_scan_time_sec();
G1GCPhaseTimes* p = _g1p->phase_times();
*** 457,477 ****
size_t cards_scanned() const { return _cards_scanned; }
size_t cards_skipped() const { return _cards_skipped; }
};
void G1RemSet::update_rem_set(G1ParScanThreadState* pss, uint worker_i) {
! G1ScanObjsDuringUpdateRSClosure update_rs_cl(_g1, pss, worker_i);
! G1RefineCardClosure refine_card_cl(_g1, &update_rs_cl);
G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
if (G1HotCardCache::default_use_cache()) {
// Apply the closure to the entries of the hot card cache.
G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i);
! _g1->iterate_hcc_closure(&refine_card_cl, worker_i);
}
// Apply the closure to all remaining log entries.
! _g1->iterate_dirty_card_closure(&refine_card_cl, worker_i);
G1GCPhaseTimes* p = _g1p->phase_times();
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_scanned(), G1GCPhaseTimes::UpdateRSScannedCards);
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_skipped(), G1GCPhaseTimes::UpdateRSSkippedCards);
}
--- 457,477 ----
size_t cards_scanned() const { return _cards_scanned; }
size_t cards_skipped() const { return _cards_skipped; }
};
void G1RemSet::update_rem_set(G1ParScanThreadState* pss, uint worker_i) {
! G1ScanObjsDuringUpdateRSClosure update_rs_cl(_g1h, pss, worker_i);
! G1RefineCardClosure refine_card_cl(_g1h, &update_rs_cl);
G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
if (G1HotCardCache::default_use_cache()) {
// Apply the closure to the entries of the hot card cache.
G1GCParPhaseTimesTracker y(_g1p->phase_times(), G1GCPhaseTimes::ScanHCC, worker_i);
! _g1h->iterate_hcc_closure(&refine_card_cl, worker_i);
}
// Apply the closure to all remaining log entries.
! _g1h->iterate_dirty_card_closure(&refine_card_cl, worker_i);
G1GCPhaseTimes* p = _g1p->phase_times();
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_scanned(), G1GCPhaseTimes::UpdateRSScannedCards);
p->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, refine_card_cl.cards_skipped(), G1GCPhaseTimes::UpdateRSSkippedCards);
}
*** 493,507 ****
_scan_state->reset();
}
void G1RemSet::cleanup_after_oops_into_collection_set_do() {
! G1GCPhaseTimes* phase_times = _g1->g1_policy()->phase_times();
// Set all cards back to clean.
double start = os::elapsedTime();
! _scan_state->clear_card_table(_g1->workers());
phase_times->record_clear_ct_time((os::elapsedTime() - start) * 1000.0);
}
inline void check_card_ptr(jbyte* card_ptr, G1CardTable* ct) {
#ifdef ASSERT
--- 493,507 ----
_scan_state->reset();
}
void G1RemSet::cleanup_after_oops_into_collection_set_do() {
! G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times();
// Set all cards back to clean.
double start = os::elapsedTime();
! _scan_state->clear_card_table(_g1h->workers());
phase_times->record_clear_ct_time((os::elapsedTime() - start) * 1000.0);
}
inline void check_card_ptr(jbyte* card_ptr, G1CardTable* ct) {
#ifdef ASSERT
*** 515,525 ****
#endif
}
void G1RemSet::refine_card_concurrently(jbyte* card_ptr,
uint worker_i) {
! assert(!_g1->is_gc_active(), "Only call concurrently");
check_card_ptr(card_ptr, _ct);
// If the card is no longer dirty, nothing to do.
if (*card_ptr != G1CardTable::dirty_card_val()) {
--- 515,525 ----
#endif
}
void G1RemSet::refine_card_concurrently(jbyte* card_ptr,
uint worker_i) {
! assert(!_g1h->is_gc_active(), "Only call concurrently");
check_card_ptr(card_ptr, _ct);
// If the card is no longer dirty, nothing to do.
if (*card_ptr != G1CardTable::dirty_card_val()) {
*** 527,537 ****
}
// Construct the region representing the card.
HeapWord* start = _ct->addr_for(card_ptr);
// And find the region containing it.
! HeapRegion* r = _g1->heap_region_containing(start);
// This check is needed for some uncommon cases where we should
// ignore the card.
//
// The region could be young. Cards for young regions are
--- 527,537 ----
}
// Construct the region representing the card.
HeapWord* start = _ct->addr_for(card_ptr);
// And find the region containing it.
! HeapRegion* r = _g1h->heap_region_containing(start);
// This check is needed for some uncommon cases where we should
// ignore the card.
//
// The region could be young. Cards for young regions are
*** 572,582 ****
// There was no eviction. Nothing to do.
return;
} else if (card_ptr != orig_card_ptr) {
// Original card was inserted and an old card was evicted.
start = _ct->addr_for(card_ptr);
! r = _g1->heap_region_containing(start);
// Check whether the region formerly in the cache should be
// ignored, as discussed earlier for the original card. The
// region could have been freed while in the cache.
if (!r->is_old_or_humongous()) {
--- 572,582 ----
// There was no eviction. Nothing to do.
return;
} else if (card_ptr != orig_card_ptr) {
// Original card was inserted and an old card was evicted.
start = _ct->addr_for(card_ptr);
! r = _g1h->heap_region_containing(start);
// Check whether the region formerly in the cache should be
// ignored, as discussed earlier for the original card. The
// region could have been freed while in the cache.
if (!r->is_old_or_humongous()) {
*** 621,631 ****
// a card beyond the heap.
HeapWord* end = start + G1CardTable::card_size_in_words;
MemRegion dirty_region(start, MIN2(scan_limit, end));
assert(!dirty_region.is_empty(), "sanity");
! G1ConcurrentRefineOopClosure conc_refine_cl(_g1, worker_i);
bool card_processed =
r->oops_on_card_seq_iterate_careful<false>(dirty_region, &conc_refine_cl);
// If unable to process the card then we encountered an unparsable
--- 621,631 ----
// a card beyond the heap.
HeapWord* end = start + G1CardTable::card_size_in_words;
MemRegion dirty_region(start, MIN2(scan_limit, end));
assert(!dirty_region.is_empty(), "sanity");
! G1ConcurrentRefineOopClosure conc_refine_cl(_g1h, worker_i);
bool card_processed =
r->oops_on_card_seq_iterate_careful<false>(dirty_region, &conc_refine_cl);
// If unable to process the card then we encountered an unparsable
*** 649,659 ****
}
}
bool G1RemSet::refine_card_during_gc(jbyte* card_ptr,
G1ScanObjsDuringUpdateRSClosure* update_rs_cl) {
! assert(_g1->is_gc_active(), "Only call during GC");
check_card_ptr(card_ptr, _ct);
// If the card is no longer dirty, nothing to do. This covers cards that were already
// scanned as parts of the remembered sets.
--- 649,659 ----
}
}
bool G1RemSet::refine_card_during_gc(jbyte* card_ptr,
G1ScanObjsDuringUpdateRSClosure* update_rs_cl) {
! assert(_g1h->is_gc_active(), "Only call during GC");
check_card_ptr(card_ptr, _ct);
// If the card is no longer dirty, nothing to do. This covers cards that were already
// scanned as parts of the remembered sets.
*** 666,676 ****
*card_ptr = G1CardTable::clean_card_val() | G1CardTable::claimed_card_val();
// Construct the region representing the card.
HeapWord* card_start = _ct->addr_for(card_ptr);
// And find the region containing it.
! uint const card_region_idx = _g1->addr_to_region(card_start);
_scan_state->add_dirty_region(card_region_idx);
HeapWord* scan_limit = _scan_state->scan_top(card_region_idx);
if (scan_limit <= card_start) {
// If the card starts above the area in the region containing objects to scan, skip it.
--- 666,676 ----
*card_ptr = G1CardTable::clean_card_val() | G1CardTable::claimed_card_val();
// Construct the region representing the card.
HeapWord* card_start = _ct->addr_for(card_ptr);
// And find the region containing it.
! uint const card_region_idx = _g1h->addr_to_region(card_start);
_scan_state->add_dirty_region(card_region_idx);
HeapWord* scan_limit = _scan_state->scan_top(card_region_idx);
if (scan_limit <= card_start) {
// If the card starts above the area in the region containing objects to scan, skip it.
*** 681,691 ****
// a card beyond the heap.
HeapWord* card_end = card_start + G1CardTable::card_size_in_words;
MemRegion dirty_region(card_start, MIN2(scan_limit, card_end));
assert(!dirty_region.is_empty(), "sanity");
! HeapRegion* const card_region = _g1->region_at(card_region_idx);
update_rs_cl->set_region(card_region);
bool card_processed = card_region->oops_on_card_seq_iterate_careful<true>(dirty_region, update_rs_cl);
assert(card_processed, "must be");
return true;
}
--- 681,691 ----
// a card beyond the heap.
HeapWord* card_end = card_start + G1CardTable::card_size_in_words;
MemRegion dirty_region(card_start, MIN2(scan_limit, card_end));
assert(!dirty_region.is_empty(), "sanity");
! HeapRegion* const card_region = _g1h->region_at(card_region_idx);
update_rs_cl->set_region(card_region);
bool card_processed = card_region->oops_on_card_seq_iterate_careful<true>(dirty_region, update_rs_cl);
assert(card_processed, "must be");
return true;
}
< prev index next >