< prev index next >

src/hotspot/share/gc/g1/g1CollectionSet.cpp

Print this page




 502 
 503 void G1CollectionSet::finalize_initial_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor) {
 504   double time_remaining_ms = finalize_young_part(target_pause_time_ms, survivor);
 505   finalize_old_part(time_remaining_ms);
 506 }
 507 
 508 bool G1CollectionSet::finalize_optional_for_evacuation(double remaining_pause_time) {
 509   update_incremental_marker();
 510 
 511   uint num_selected_regions;
 512   _policy->calculate_optional_collection_set_regions(candidates(),
 513                                                      _num_optional_regions,
 514                                                      remaining_pause_time,
 515                                                      num_selected_regions);
 516 
 517   move_candidates_to_collection_set(num_selected_regions);
 518 
 519   _num_optional_regions -= num_selected_regions;
 520 
 521   stop_incremental_building();
 522 
 523   _g1h->verify_region_attr_remset_update();
 524 
 525   return num_selected_regions > 0;
 526 }
 527 
 528 void G1CollectionSet::abandon_optional_collection_set(G1ParScanThreadStateSet* pss) {
 529   for (uint i = 0; i < _num_optional_regions; i++) {
 530     HeapRegion* r = candidates()->at(candidates()->cur_idx() + i);
 531     pss->record_unused_optional_region(r);
 532     // Clear collection set marker and make sure that the remembered set information
 533     // is correct as we still need it later.
 534     _g1h->clear_region_attr(r);
 535     _g1h->register_region_with_region_attr(r);
 536     r->clear_index_in_opt_cset();
 537   }
 538   free_optional_regions();
 539 
 540   _g1h->verify_region_attr_remset_update();
 541 }
 542 
 543 #ifdef ASSERT
 544 class G1VerifyYoungCSetIndicesClosure : public HeapRegionClosure {
 545 private:
 546   size_t _young_length;
 547   int* _heap_region_indices;
 548 public:
 549   G1VerifyYoungCSetIndicesClosure(size_t young_length) : HeapRegionClosure(), _young_length(young_length) {
 550     _heap_region_indices = NEW_C_HEAP_ARRAY(int, young_length, mtGC);
 551     for (size_t i = 0; i < young_length; i++) {
 552       _heap_region_indices[i] = -1;
 553     }
 554   }
 555   ~G1VerifyYoungCSetIndicesClosure() {
 556     FREE_C_HEAP_ARRAY(int, _heap_region_indices);
 557   }
 558 
 559   virtual bool do_heap_region(HeapRegion* r) {
 560     const int idx = r->young_index_in_cset();




 502 
 503 void G1CollectionSet::finalize_initial_collection_set(double target_pause_time_ms, G1SurvivorRegions* survivor) {
 504   double time_remaining_ms = finalize_young_part(target_pause_time_ms, survivor);
 505   finalize_old_part(time_remaining_ms);
 506 }
 507 
 508 bool G1CollectionSet::finalize_optional_for_evacuation(double remaining_pause_time) {
 509   update_incremental_marker();
 510 
 511   uint num_selected_regions;
 512   _policy->calculate_optional_collection_set_regions(candidates(),
 513                                                      _num_optional_regions,
 514                                                      remaining_pause_time,
 515                                                      num_selected_regions);
 516 
 517   move_candidates_to_collection_set(num_selected_regions);
 518 
 519   _num_optional_regions -= num_selected_regions;
 520 
 521   stop_incremental_building();



 522   return num_selected_regions > 0;
 523 }
 524 
 525 void G1CollectionSet::abandon_optional_collection_set(G1ParScanThreadStateSet* pss) {
 526   for (uint i = 0; i < _num_optional_regions; i++) {
 527     HeapRegion* r = candidates()->at(candidates()->cur_idx() + i);
 528     pss->record_unused_optional_region(r);


 529     _g1h->clear_region_attr(r);

 530     r->clear_index_in_opt_cset();
 531   }
 532   free_optional_regions();


 533 }
 534 
 535 #ifdef ASSERT
 536 class G1VerifyYoungCSetIndicesClosure : public HeapRegionClosure {
 537 private:
 538   size_t _young_length;
 539   int* _heap_region_indices;
 540 public:
 541   G1VerifyYoungCSetIndicesClosure(size_t young_length) : HeapRegionClosure(), _young_length(young_length) {
 542     _heap_region_indices = NEW_C_HEAP_ARRAY(int, young_length, mtGC);
 543     for (size_t i = 0; i < young_length; i++) {
 544       _heap_region_indices[i] = -1;
 545     }
 546   }
 547   ~G1VerifyYoungCSetIndicesClosure() {
 548     FREE_C_HEAP_ARRAY(int, _heap_region_indices);
 549   }
 550 
 551   virtual bool do_heap_region(HeapRegion* r) {
 552     const int idx = r->young_index_in_cset();


< prev index next >