95 while (_hot_cache_par_claimed_idx < _hot_cache_size) {
96 size_t end_idx = Atomic::add(_hot_cache_par_chunk_size,
97 &_hot_cache_par_claimed_idx);
98 size_t start_idx = end_idx - _hot_cache_par_chunk_size;
99 // The current worker has successfully claimed the chunk [start_idx..end_idx)
100 end_idx = MIN2(end_idx, _hot_cache_size);
101 for (size_t i = start_idx; i < end_idx; i++) {
102 jbyte* card_ptr = _hot_cache[i];
103 if (card_ptr != NULL) {
104 if (g1rs->refine_card(card_ptr, worker_i, true)) {
105 // The part of the heap spanned by the card contains references
106 // that point into the current collection set.
107 // We need to record the card pointer in the DirtyCardQueueSet
108 // that we use for such cards.
109 //
110 // The only time we care about recording cards that contain
111 // references that point into the collection set is during
112 // RSet updating while within an evacuation pause.
113 // In this case worker_i should be the id of a GC worker thread
114 assert(SafepointSynchronize::is_at_safepoint(), "Should be at a safepoint");
115 assert(worker_i < ParallelGCThreads,
116 err_msg("incorrect worker id: %u", worker_i));
117
118 into_cset_dcq->enqueue(card_ptr);
119 }
120 } else {
121 break;
122 }
123 }
124 }
125
126 // The existing entries in the hot card cache, which were just refined
127 // above, are discarded prior to re-enabling the cache near the end of the GC.
128 }
129
130 void G1HotCardCache::reset_card_counts(HeapRegion* hr) {
131 _card_counts.clear_region(hr);
132 }
133
134 void G1HotCardCache::reset_card_counts() {
135 _card_counts.clear_all();
136 }
|
95 while (_hot_cache_par_claimed_idx < _hot_cache_size) {
96 size_t end_idx = Atomic::add(_hot_cache_par_chunk_size,
97 &_hot_cache_par_claimed_idx);
98 size_t start_idx = end_idx - _hot_cache_par_chunk_size;
99 // The current worker has successfully claimed the chunk [start_idx..end_idx)
100 end_idx = MIN2(end_idx, _hot_cache_size);
101 for (size_t i = start_idx; i < end_idx; i++) {
102 jbyte* card_ptr = _hot_cache[i];
103 if (card_ptr != NULL) {
104 if (g1rs->refine_card(card_ptr, worker_i, true)) {
105 // The part of the heap spanned by the card contains references
106 // that point into the current collection set.
107 // We need to record the card pointer in the DirtyCardQueueSet
108 // that we use for such cards.
109 //
110 // The only time we care about recording cards that contain
111 // references that point into the collection set is during
112 // RSet updating while within an evacuation pause.
113 // In this case worker_i should be the id of a GC worker thread
114 assert(SafepointSynchronize::is_at_safepoint(), "Should be at a safepoint");
115 assert(worker_i < ParallelGCThreads, "incorrect worker id: %u", worker_i);
116
117 into_cset_dcq->enqueue(card_ptr);
118 }
119 } else {
120 break;
121 }
122 }
123 }
124
125 // The existing entries in the hot card cache, which were just refined
126 // above, are discarded prior to re-enabling the cache near the end of the GC.
127 }
128
129 void G1HotCardCache::reset_card_counts(HeapRegion* hr) {
130 _card_counts.clear_region(hr);
131 }
132
133 void G1HotCardCache::reset_card_counts() {
134 _card_counts.clear_all();
135 }
|