837 } |
837 } |
838 |
838 |
839 public: |
839 public: |
840 G1ScanCollectionSetRegionClosure(G1RemSetScanState* scan_state, |
840 G1ScanCollectionSetRegionClosure(G1RemSetScanState* scan_state, |
841 G1ParScanThreadState* pss, |
841 G1ParScanThreadState* pss, |
842 uint worker_i, |
842 uint worker_id, |
843 G1GCPhaseTimes::GCParPhases scan_phase, |
843 G1GCPhaseTimes::GCParPhases scan_phase, |
844 G1GCPhaseTimes::GCParPhases code_roots_phase) : |
844 G1GCPhaseTimes::GCParPhases code_roots_phase) : |
845 _pss(pss), |
845 _pss(pss), |
846 _scan_state(scan_state), |
846 _scan_state(scan_state), |
847 _scan_phase(scan_phase), |
847 _scan_phase(scan_phase), |
848 _code_roots_phase(code_roots_phase), |
848 _code_roots_phase(code_roots_phase), |
849 _worker_id(worker_i), |
849 _worker_id(worker_id), |
850 _opt_refs_scanned(0), |
850 _opt_refs_scanned(0), |
851 _opt_refs_memory_used(0), |
851 _opt_refs_memory_used(0), |
852 _strong_code_root_scan_time(), |
852 _strong_code_root_scan_time(), |
853 _strong_code_trim_partially_time(), |
853 _strong_code_trim_partially_time(), |
854 _rem_set_opt_root_scan_time(), |
854 _rem_set_opt_root_scan_time(), |
1059 public: |
1059 public: |
1060 G1MergeLogBufferCardsClosure(G1CollectedHeap* g1h, G1RemSetScanState* scan_state) : |
1060 G1MergeLogBufferCardsClosure(G1CollectedHeap* g1h, G1RemSetScanState* scan_state) : |
1061 _scan_state(scan_state), _ct(g1h->card_table()), _cards_dirty(0), _cards_skipped(0) |
1061 _scan_state(scan_state), _ct(g1h->card_table()), _cards_dirty(0), _cards_skipped(0) |
1062 {} |
1062 {} |
1063 |
1063 |
1064 void do_card_ptr(CardValue* card_ptr, uint worker_i) { |
1064 void do_card_ptr(CardValue* card_ptr, uint worker_id) { |
1065 // The only time we care about recording cards that |
1065 // The only time we care about recording cards that |
1066 // contain references that point into the collection set |
1066 // contain references that point into the collection set |
1067 // is during RSet updating within an evacuation pause. |
1067 // is during RSet updating within an evacuation pause. |
1068 // In this case worker_id should be the id of a GC worker thread. |
1068 // In this case worker_id should be the id of a GC worker thread. |
1069 assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); |
1069 assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); |
1261 g1h->addr_to_region(ct->addr_for(card_ptr))); |
1261 g1h->addr_to_region(ct->addr_for(card_ptr))); |
1262 #endif |
1262 #endif |
1263 } |
1263 } |
1264 |
1264 |
1265 void G1RemSet::refine_card_concurrently(CardValue* card_ptr, |
1265 void G1RemSet::refine_card_concurrently(CardValue* card_ptr, |
1266 uint worker_i) { |
1266 uint worker_id) { |
1267 assert(!_g1h->is_gc_active(), "Only call concurrently"); |
1267 assert(!_g1h->is_gc_active(), "Only call concurrently"); |
1268 |
1268 |
1269 // Construct the region representing the card. |
1269 // Construct the region representing the card. |
1270 HeapWord* start = _ct->addr_for(card_ptr); |
1270 HeapWord* start = _ct->addr_for(card_ptr); |
1271 // And find the region containing it. |
1271 // And find the region containing it. |
1373 // a card beyond the heap. |
1373 // a card beyond the heap. |
1374 HeapWord* end = start + G1CardTable::card_size_in_words; |
1374 HeapWord* end = start + G1CardTable::card_size_in_words; |
1375 MemRegion dirty_region(start, MIN2(scan_limit, end)); |
1375 MemRegion dirty_region(start, MIN2(scan_limit, end)); |
1376 assert(!dirty_region.is_empty(), "sanity"); |
1376 assert(!dirty_region.is_empty(), "sanity"); |
1377 |
1377 |
1378 G1ConcurrentRefineOopClosure conc_refine_cl(_g1h, worker_i); |
1378 G1ConcurrentRefineOopClosure conc_refine_cl(_g1h, worker_id); |
1379 if (r->oops_on_memregion_seq_iterate_careful<false>(dirty_region, &conc_refine_cl) != NULL) { |
1379 if (r->oops_on_memregion_seq_iterate_careful<false>(dirty_region, &conc_refine_cl) != NULL) { |
1380 _num_conc_refined_cards++; // Unsynchronized update, only used for logging. |
1380 _num_conc_refined_cards++; // Unsynchronized update, only used for logging. |
1381 return; |
1381 return; |
1382 } |
1382 } |
1383 |
1383 |