hotspot/src/share/vm/gc/g1/g1CardLiveData.cpp
changeset 46619 a3919f5e8d2b
parent 46618 d503911aa948
child 46625 edefffab74e2
equal deleted inserted replaced
46618:d503911aa948 46619:a3919f5e8d2b
   129   // lots of work most of the time.
   129   // lots of work most of the time.
   130   BitMap::idx_t _last_marked_bit_idx;
   130   BitMap::idx_t _last_marked_bit_idx;
   131 
   131 
   132   void clear_card_bitmap_range(HeapWord* start, HeapWord* end) {
   132   void clear_card_bitmap_range(HeapWord* start, HeapWord* end) {
   133     BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
   133     BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
   134     BitMap::idx_t end_idx = card_live_bitmap_index_for(align_ptr_up(end, CardTableModRefBS::card_size));
   134     BitMap::idx_t end_idx = card_live_bitmap_index_for(align_up(end, CardTableModRefBS::card_size));
   135 
   135 
   136     _card_bm.clear_range(start_idx, end_idx);
   136     _card_bm.clear_range(start_idx, end_idx);
   137   }
   137   }
   138 
   138 
   139   // Mark the card liveness bitmap for the object spanning from start to end.
   139   // Mark the card liveness bitmap for the object spanning from start to end.
   140   void mark_card_bitmap_range(HeapWord* start, HeapWord* end) {
   140   void mark_card_bitmap_range(HeapWord* start, HeapWord* end) {
   141     BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
   141     BitMap::idx_t start_idx = card_live_bitmap_index_for(start);
   142     BitMap::idx_t end_idx = card_live_bitmap_index_for(align_ptr_up(end, CardTableModRefBS::card_size));
   142     BitMap::idx_t end_idx = card_live_bitmap_index_for(align_up(end, CardTableModRefBS::card_size));
   143 
   143 
   144     assert((end_idx - start_idx) > 0, "Trying to mark zero sized range.");
   144     assert((end_idx - start_idx) > 0, "Trying to mark zero sized range.");
   145 
   145 
   146     if (start_idx == _last_marked_bit_idx) {
   146     if (start_idx == _last_marked_bit_idx) {
   147       start_idx++;
   147       start_idx++;
   421 };
   421 };
   422 
   422 
   423 void G1CardLiveData::clear(WorkGang* workers) {
   423 void G1CardLiveData::clear(WorkGang* workers) {
   424   guarantee(Universe::is_fully_initialized(), "Should not call this during initialization.");
   424   guarantee(Universe::is_fully_initialized(), "Should not call this during initialization.");
   425 
   425 
   426   size_t const num_chunks = align_size_up(live_cards_bm().size_in_bytes(), G1ClearCardLiveDataTask::chunk_size()) / G1ClearCardLiveDataTask::chunk_size();
   426   size_t const num_chunks = align_up(live_cards_bm().size_in_bytes(), G1ClearCardLiveDataTask::chunk_size()) / G1ClearCardLiveDataTask::chunk_size();
   427   uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers());
   427   uint const num_workers = (uint)MIN2(num_chunks, (size_t)workers->active_workers());
   428 
   428 
   429   G1ClearCardLiveDataTask cl(live_cards_bm(), num_chunks);
   429   G1ClearCardLiveDataTask cl(live_cards_bm(), num_chunks);
   430 
   430 
   431   log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks);
   431   log_debug(gc, ergo)("Running %s using %u workers for " SIZE_FORMAT " work units.", cl.name(), num_workers, num_chunks);