489 490 if (_g1->evacuation_failed()) { 491 double restore_remembered_set_start = os::elapsedTime(); 492 493 // Restore remembered sets for the regions pointing into the collection set. 494 // We just need to transfer the completed buffers from the DirtyCardQueueSet 495 // used to hold cards that contain references that point into the collection set 496 // to the DCQS used to hold the deferred RS updates. 497 _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs); 498 phase_times->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0); 499 } 500 501 // Free any completed buffers in the DirtyCardQueueSet used to hold cards 502 // which contain references that point into the collection. 503 _into_cset_dirty_card_queue_set.clear(); 504 assert(_into_cset_dirty_card_queue_set.completed_buffers_num() == 0, 505 "all buffers should be freed"); 506 _into_cset_dirty_card_queue_set.clear_n_completed_buffers(); 507 } 508 509 class G1ScrubRSClosure: public HeapRegionClosure { 510 G1CollectedHeap* _g1h; 511 G1CardLiveData* _live_data; 512 public: 513 G1ScrubRSClosure(G1CardLiveData* live_data) : 514 _g1h(G1CollectedHeap::heap()), 515 _live_data(live_data) { } 516 517 bool doHeapRegion(HeapRegion* r) { 518 if (!r->is_continues_humongous()) { 519 r->rem_set()->scrub(_live_data); 520 } 521 return false; 522 } 523 }; 524 525 void G1RemSet::scrub(uint worker_num, HeapRegionClaimer *hrclaimer) { 526 G1ScrubRSClosure scrub_cl(&_card_live_data); 527 _g1->heap_region_par_iterate(&scrub_cl, worker_num, hrclaimer); 528 } 529 530 G1UpdateRSOrPushRefOopClosure::G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, 531 G1ParPushHeapRSClosure* push_ref_cl, 532 bool record_refs_into_cset, 533 uint worker_i) : 534 _g1(g1h), 535 _from(NULL), 536 _record_refs_into_cset(record_refs_into_cset), 537 _has_refs_into_cset(false), 538 _push_ref_cl(push_ref_cl), 539 _worker_i(worker_i) { } 540 541 // Returns true if the given card contains references that point 542 // into the collection set, if we're checking for such references; 543 // false otherwise. 544 545 bool G1RemSet::refine_card(jbyte* card_ptr, 546 uint worker_i, 547 G1ParPushHeapRSClosure* oops_in_heap_closure) { 548 assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)), 549 "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", | 489 490 if (_g1->evacuation_failed()) { 491 double restore_remembered_set_start = os::elapsedTime(); 492 493 // Restore remembered sets for the regions pointing into the collection set. 494 // We just need to transfer the completed buffers from the DirtyCardQueueSet 495 // used to hold cards that contain references that point into the collection set 496 // to the DCQS used to hold the deferred RS updates. 497 _g1->dirty_card_queue_set().merge_bufferlists(&into_cset_dcqs); 498 phase_times->record_evac_fail_restore_remsets((os::elapsedTime() - restore_remembered_set_start) * 1000.0); 499 } 500 501 // Free any completed buffers in the DirtyCardQueueSet used to hold cards 502 // which contain references that point into the collection. 503 _into_cset_dirty_card_queue_set.clear(); 504 assert(_into_cset_dirty_card_queue_set.completed_buffers_num() == 0, 505 "all buffers should be freed"); 506 _into_cset_dirty_card_queue_set.clear_n_completed_buffers(); 507 } 508 509 G1UpdateRSOrPushRefOopClosure::G1UpdateRSOrPushRefOopClosure(G1CollectedHeap* g1h, 510 G1ParPushHeapRSClosure* push_ref_cl, 511 bool record_refs_into_cset, 512 uint worker_i) : 513 _g1(g1h), 514 _from(NULL), 515 _record_refs_into_cset(record_refs_into_cset), 516 _has_refs_into_cset(false), 517 _push_ref_cl(push_ref_cl), 518 _worker_i(worker_i) { } 519 520 // Returns true if the given card contains references that point 521 // into the collection set, if we're checking for such references; 522 // false otherwise. 523 524 bool G1RemSet::refine_card(jbyte* card_ptr, 525 uint worker_i, 526 G1ParPushHeapRSClosure* oops_in_heap_closure) { 527 assert(_g1->is_in_exact(_ct_bs->addr_for(card_ptr)), 528 "Card at " PTR_FORMAT " index " SIZE_FORMAT " representing heap at " PTR_FORMAT " (%u) must be in committed heap", |