318 _scan_objs_on_card_cl(scan_obj_on_card),
319 _scan_state(scan_state),
320 _worker_i(worker_i),
321 _cards_scanned(0),
322 _cards_claimed(0),
323 _cards_skipped(0),
324 _rem_set_root_scan_time(),
325 _rem_set_trim_partially_time(),
326 _strong_code_root_scan_time(),
327 _strong_code_trim_partially_time() {
328 }
329
330 void G1ScanRSForRegionClosure::claim_card(size_t card_index, const uint region_idx_for_card){
331 _ct->set_card_claimed(card_index);
332 _scan_state->add_dirty_region(region_idx_for_card);
333 }
334
335 void G1ScanRSForRegionClosure::scan_card(MemRegion mr, uint region_idx_for_card) {
336 HeapRegion* const card_region = _g1h->region_at(region_idx_for_card);
337 assert(!card_region->is_young(), "Should not scan card in young region %u", region_idx_for_card);
338 _scan_objs_on_card_cl->set_from_is_young(false);
339 card_region->oops_on_card_seq_iterate_careful<true>(mr, _scan_objs_on_card_cl);
340 _scan_objs_on_card_cl->trim_queue_partially();
341 _cards_scanned++;
342 }
343
344 void G1ScanRSForRegionClosure::scan_rem_set_roots(HeapRegion* r) {
345 EventGCPhaseParallel event;
346 uint const region_idx = r->hrm_index();
347
348 if (_scan_state->claim_iter(region_idx)) {
349 // If we ever free the collection set concurrently, we should also
350 // clear the card table concurrently therefore we won't need to
351 // add regions of the collection set to the dirty cards region.
352 _scan_state->add_dirty_region(region_idx);
353 }
354
355 if (r->rem_set()->cardset_is_empty()) {
356 return;
357 }
358
714 }
715
716 // We claim lazily (so races are possible but they're benign), which reduces the
717 // number of potential duplicate scans (multiple threads may enqueue the same card twice).
718 *card_ptr = G1CardTable::clean_card_val() | G1CardTable::claimed_card_val();
719
720 _scan_state->add_dirty_region(card_region_idx);
721 if (scan_limit <= card_start) {
722 // If the card starts above the area in the region containing objects to scan, skip it.
723 return false;
724 }
725
726 // Don't use addr_for(card_ptr + 1) which can ask for
727 // a card beyond the heap.
728 HeapWord* card_end = card_start + G1CardTable::card_size_in_words;
729 MemRegion dirty_region(card_start, MIN2(scan_limit, card_end));
730 assert(!dirty_region.is_empty(), "sanity");
731
732 HeapRegion* const card_region = _g1h->region_at(card_region_idx);
733 assert(!card_region->is_young(), "Should not scan card in young region %u", card_region_idx);
734 update_rs_cl->set_from_is_young(false);
735 bool card_processed = card_region->oops_on_card_seq_iterate_careful<true>(dirty_region, update_rs_cl);
736 assert(card_processed, "must be");
737 return true;
738 }
739
740 void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) {
741 if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) &&
742 (period_count % G1SummarizeRSetStatsPeriod == 0)) {
743
744 G1RemSetSummary current(this);
745 _prev_period_summary.subtract_from(¤t);
746
747 Log(gc, remset) log;
748 log.trace("%s", header);
749 ResourceMark rm;
750 LogStream ls(log.trace());
751 _prev_period_summary.print_on(&ls);
752
753 _prev_period_summary.set(¤t);
754 }
|
318 _scan_objs_on_card_cl(scan_obj_on_card),
319 _scan_state(scan_state),
320 _worker_i(worker_i),
321 _cards_scanned(0),
322 _cards_claimed(0),
323 _cards_skipped(0),
324 _rem_set_root_scan_time(),
325 _rem_set_trim_partially_time(),
326 _strong_code_root_scan_time(),
327 _strong_code_trim_partially_time() {
328 }
329
330 void G1ScanRSForRegionClosure::claim_card(size_t card_index, const uint region_idx_for_card){
331 _ct->set_card_claimed(card_index);
332 _scan_state->add_dirty_region(region_idx_for_card);
333 }
334
335 void G1ScanRSForRegionClosure::scan_card(MemRegion mr, uint region_idx_for_card) {
336 HeapRegion* const card_region = _g1h->region_at(region_idx_for_card);
337 assert(!card_region->is_young(), "Should not scan card in young region %u", region_idx_for_card);
338 card_region->oops_on_card_seq_iterate_careful<true>(mr, _scan_objs_on_card_cl);
339 _scan_objs_on_card_cl->trim_queue_partially();
340 _cards_scanned++;
341 }
342
343 void G1ScanRSForRegionClosure::scan_rem_set_roots(HeapRegion* r) {
344 EventGCPhaseParallel event;
345 uint const region_idx = r->hrm_index();
346
347 if (_scan_state->claim_iter(region_idx)) {
348 // If we ever free the collection set concurrently, we should also
349 // clear the card table concurrently therefore we won't need to
350 // add regions of the collection set to the dirty cards region.
351 _scan_state->add_dirty_region(region_idx);
352 }
353
354 if (r->rem_set()->cardset_is_empty()) {
355 return;
356 }
357
713 }
714
715 // We claim lazily (so races are possible but they're benign), which reduces the
716 // number of potential duplicate scans (multiple threads may enqueue the same card twice).
717 *card_ptr = G1CardTable::clean_card_val() | G1CardTable::claimed_card_val();
718
719 _scan_state->add_dirty_region(card_region_idx);
720 if (scan_limit <= card_start) {
721 // If the card starts above the area in the region containing objects to scan, skip it.
722 return false;
723 }
724
725 // Don't use addr_for(card_ptr + 1) which can ask for
726 // a card beyond the heap.
727 HeapWord* card_end = card_start + G1CardTable::card_size_in_words;
728 MemRegion dirty_region(card_start, MIN2(scan_limit, card_end));
729 assert(!dirty_region.is_empty(), "sanity");
730
731 HeapRegion* const card_region = _g1h->region_at(card_region_idx);
732 assert(!card_region->is_young(), "Should not scan card in young region %u", card_region_idx);
733 bool card_processed = card_region->oops_on_card_seq_iterate_careful<true>(dirty_region, update_rs_cl);
734 assert(card_processed, "must be");
735 return true;
736 }
737
738 void G1RemSet::print_periodic_summary_info(const char* header, uint period_count) {
739 if ((G1SummarizeRSetStatsPeriod > 0) && log_is_enabled(Trace, gc, remset) &&
740 (period_count % G1SummarizeRSetStatsPeriod == 0)) {
741
742 G1RemSetSummary current(this);
743 _prev_period_summary.subtract_from(¤t);
744
745 Log(gc, remset) log;
746 log.trace("%s", header);
747 ResourceMark rm;
748 LogStream ls(log.trace());
749 _prev_period_summary.print_on(&ls);
750
751 _prev_period_summary.set(¤t);
752 }
|