337 // region. See above on how this can happen. |
337 // region. See above on how this can happen. |
338 |
338 |
339 return res; |
339 return res; |
340 } |
340 } |
341 |
341 |
342 void ConcurrentG1Refine::clean_up_cache(int worker_i, G1RemSet* g1rs) { |
342 void ConcurrentG1Refine::clean_up_cache(int worker_i, |
|
343 G1RemSet* g1rs, |
|
344 DirtyCardQueue* into_cset_dcq) { |
343 assert(!use_cache(), "cache should be disabled"); |
345 assert(!use_cache(), "cache should be disabled"); |
344 int start_idx; |
346 int start_idx; |
345 |
347 |
346 while ((start_idx = _hot_cache_par_claimed_idx) < _n_hot) { // read once |
348 while ((start_idx = _hot_cache_par_claimed_idx) < _n_hot) { // read once |
347 int end_idx = start_idx + _hot_cache_par_chunk_size; |
349 int end_idx = start_idx + _hot_cache_par_chunk_size; |
351 // The current worker has successfully claimed the chunk [start_idx..end_idx) |
353 // The current worker has successfully claimed the chunk [start_idx..end_idx) |
352 end_idx = MIN2(end_idx, _n_hot); |
354 end_idx = MIN2(end_idx, _n_hot); |
353 for (int i = start_idx; i < end_idx; i++) { |
355 for (int i = start_idx; i < end_idx; i++) { |
354 jbyte* entry = _hot_cache[i]; |
356 jbyte* entry = _hot_cache[i]; |
355 if (entry != NULL) { |
357 if (entry != NULL) { |
356 g1rs->concurrentRefineOneCard(entry, worker_i); |
358 if (g1rs->concurrentRefineOneCard(entry, worker_i, true)) { |
|
359 // 'entry' contains references that point into the current |
|
360 // collection set. We need to record 'entry' in the DCQS |
|
361 // that's used for that purpose. |
|
362 // |
|
363 // The only time we care about recording cards that contain |
|
364 // references that point into the collection set is during |
|
365 // RSet updating while within an evacuation pause. |
|
366 // In this case worker_i should be the id of a GC worker thread |
|
367 assert(SafepointSynchronize::is_at_safepoint(), "not during an evacuation pause"); |
|
368 assert(worker_i < (int) DirtyCardQueueSet::num_par_ids(), "incorrect worker id"); |
|
369 into_cset_dcq->enqueue(entry); |
|
370 } |
357 } |
371 } |
358 } |
372 } |
359 } |
373 } |
360 } |
374 } |
361 } |
375 } |