src/hotspot/share/gc/g1/g1ConcurrentMark.cpp
changeset 48890 f9884e190f2b
parent 48889 216c2aabbf1f
child 48969 7eb296a8ce2c
equal deleted inserted replaced
48889:216c2aabbf1f 48890:f9884e190f2b
   589     G1ConcurrentMark* _cm;
   589     G1ConcurrentMark* _cm;
   590   public:
   590   public:
   591     G1ClearBitmapHRClosure(G1CMBitMap* bitmap, G1ConcurrentMark* cm) : HeapRegionClosure(), _cm(cm), _bitmap(bitmap) {
   591     G1ClearBitmapHRClosure(G1CMBitMap* bitmap, G1ConcurrentMark* cm) : HeapRegionClosure(), _cm(cm), _bitmap(bitmap) {
   592     }
   592     }
   593 
   593 
   594     virtual bool do_heap_region(HeapRegion* r) {
   594     virtual bool doHeapRegion(HeapRegion* r) {
   595       size_t const chunk_size_in_words = G1ClearBitMapTask::chunk_size() / HeapWordSize;
   595       size_t const chunk_size_in_words = G1ClearBitMapTask::chunk_size() / HeapWordSize;
   596 
   596 
   597       HeapWord* cur = r->bottom();
   597       HeapWord* cur = r->bottom();
   598       HeapWord* const end = r->end();
   598       HeapWord* const end = r->end();
   599 
   599 
   636     SuspendibleThreadSetJoiner sts_join(_suspendible);
   636     SuspendibleThreadSetJoiner sts_join(_suspendible);
   637     G1CollectedHeap::heap()->heap_region_par_iterate_from_worker_offset(&_cl, &_hr_claimer, worker_id);
   637     G1CollectedHeap::heap()->heap_region_par_iterate_from_worker_offset(&_cl, &_hr_claimer, worker_id);
   638   }
   638   }
   639 
   639 
   640   bool is_complete() {
   640   bool is_complete() {
   641     return _cl.is_complete();
   641     return _cl.complete();
   642   }
   642   }
   643 };
   643 };
   644 
   644 
   645 void G1ConcurrentMark::clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield) {
   645 void G1ConcurrentMark::clear_bitmap(G1CMBitMap* bitmap, WorkGang* workers, bool may_yield) {
   646   assert(may_yield || SafepointSynchronize::is_at_safepoint(), "Non-yielding bitmap clear only allowed at safepoint.");
   646   assert(may_yield || SafepointSynchronize::is_at_safepoint(), "Non-yielding bitmap clear only allowed at safepoint.");
   692   bool _error;
   692   bool _error;
   693  public:
   693  public:
   694   CheckBitmapClearHRClosure(G1CMBitMap* bitmap) : _bitmap(bitmap) {
   694   CheckBitmapClearHRClosure(G1CMBitMap* bitmap) : _bitmap(bitmap) {
   695   }
   695   }
   696 
   696 
   697   virtual bool do_heap_region(HeapRegion* r) {
   697   virtual bool doHeapRegion(HeapRegion* r) {
   698     // This closure can be called concurrently to the mutator, so we must make sure
   698     // This closure can be called concurrently to the mutator, so we must make sure
   699     // that the result of the getNextMarkedWordAddress() call is compared to the
   699     // that the result of the getNextMarkedWordAddress() call is compared to the
   700     // value passed to it as limit to detect any found bits.
   700     // value passed to it as limit to detect any found bits.
   701     // end never changes in G1.
   701     // end never changes in G1.
   702     HeapWord* end = r->end();
   702     HeapWord* end = r->end();
   705 };
   705 };
   706 
   706 
   707 bool G1ConcurrentMark::next_mark_bitmap_is_clear() {
   707 bool G1ConcurrentMark::next_mark_bitmap_is_clear() {
   708   CheckBitmapClearHRClosure cl(_next_mark_bitmap);
   708   CheckBitmapClearHRClosure cl(_next_mark_bitmap);
   709   _g1h->heap_region_iterate(&cl);
   709   _g1h->heap_region_iterate(&cl);
   710   return cl.is_complete();
   710   return cl.complete();
   711 }
   711 }
   712 
   712 
   713 class NoteStartOfMarkHRClosure: public HeapRegionClosure {
   713 class NoteStartOfMarkHRClosure: public HeapRegionClosure {
   714 public:
   714 public:
   715   bool do_heap_region(HeapRegion* r) {
   715   bool doHeapRegion(HeapRegion* r) {
   716     r->note_start_of_marking();
   716     r->note_start_of_marking();
   717     return false;
   717     return false;
   718   }
   718   }
   719 };
   719 };
   720 
   720 
  1092 
  1092 
  1093   size_t freed_bytes() { return _freed_bytes; }
  1093   size_t freed_bytes() { return _freed_bytes; }
  1094   const uint old_regions_removed() { return _old_regions_removed; }
  1094   const uint old_regions_removed() { return _old_regions_removed; }
  1095   const uint humongous_regions_removed() { return _humongous_regions_removed; }
  1095   const uint humongous_regions_removed() { return _humongous_regions_removed; }
  1096 
  1096 
  1097   bool do_heap_region(HeapRegion *hr) {
  1097   bool doHeapRegion(HeapRegion *hr) {
  1098     _g1->reset_gc_time_stamps(hr);
  1098     _g1->reset_gc_time_stamps(hr);
  1099     hr->note_end_of_marking();
  1099     hr->note_end_of_marking();
  1100 
  1100 
  1101     if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young() && !hr->is_archive()) {
  1101     if (hr->used() > 0 && hr->max_live_bytes() == 0 && !hr->is_young() && !hr->is_archive()) {
  1102       _freed_bytes += hr->used();
  1102       _freed_bytes += hr->used();
  1133     FreeRegionList local_cleanup_list("Local Cleanup List");
  1133     FreeRegionList local_cleanup_list("Local Cleanup List");
  1134     HRRSCleanupTask hrrs_cleanup_task;
  1134     HRRSCleanupTask hrrs_cleanup_task;
  1135     G1NoteEndOfConcMarkClosure g1_note_end(_g1h, &local_cleanup_list,
  1135     G1NoteEndOfConcMarkClosure g1_note_end(_g1h, &local_cleanup_list,
  1136                                            &hrrs_cleanup_task);
  1136                                            &hrrs_cleanup_task);
  1137     _g1h->heap_region_par_iterate_from_worker_offset(&g1_note_end, &_hrclaimer, worker_id);
  1137     _g1h->heap_region_par_iterate_from_worker_offset(&g1_note_end, &_hrclaimer, worker_id);
  1138     assert(g1_note_end.is_complete(), "Shouldn't have yielded!");
  1138     assert(g1_note_end.complete(), "Shouldn't have yielded!");
  1139 
  1139 
  1140     // Now update the lists
  1140     // Now update the lists
  1141     _g1h->remove_from_old_sets(g1_note_end.old_regions_removed(), g1_note_end.humongous_regions_removed());
  1141     _g1h->remove_from_old_sets(g1_note_end.old_regions_removed(), g1_note_end.humongous_regions_removed());
  1142     {
  1142     {
  1143       MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
  1143       MutexLockerEx x(ParGCRareEvent_lock, Mutex::_no_safepoint_check_flag);
  2920                           "", "",
  2920                           "", "",
  2921                           "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)",
  2921                           "(bytes)", "(bytes)", "(bytes)", "(bytes/ms)",
  2922                           "(bytes)", "(bytes)");
  2922                           "(bytes)", "(bytes)");
  2923 }
  2923 }
  2924 
  2924 
  2925 bool G1PrintRegionLivenessInfoClosure::do_heap_region(HeapRegion* r) {
  2925 bool G1PrintRegionLivenessInfoClosure::doHeapRegion(HeapRegion* r) {
  2926   const char* type       = r->get_type_str();
  2926   const char* type       = r->get_type_str();
  2927   HeapWord* bottom       = r->bottom();
  2927   HeapWord* bottom       = r->bottom();
  2928   HeapWord* end          = r->end();
  2928   HeapWord* end          = r->end();
  2929   size_t capacity_bytes  = r->capacity();
  2929   size_t capacity_bytes  = r->capacity();
  2930   size_t used_bytes      = r->used();
  2930   size_t used_bytes      = r->used();