39
39
#include " jfr/jfrEvents.hpp"
40
40
#include " utilities/ticks.hpp"
41
41
42
- G1PostEvacuateCollectionSetCleanupTask1::G1PostEvacuateCollectionSetCleanupTask1 (G1ParScanThreadStateSet* per_thread_states) :
42
+ G1PostEvacuateCollectionSetCleanupTask1::G1PostEvacuateCollectionSetCleanupTask1 (G1ParScanThreadStateSet* per_thread_states,
43
+ G1EvacFailureRegions* evac_failure_regions) :
43
44
G1BatchedGangTask(" Post Evacuate Cleanup 1" , G1CollectedHeap::heap()->phase_times())
44
45
{
45
46
add_serial_task (new MergePssTask (per_thread_states));
@@ -48,7 +49,7 @@ G1PostEvacuateCollectionSetCleanupTask1::G1PostEvacuateCollectionSetCleanupTask1
48
49
add_serial_task (new SampleCollectionSetCandidatesTask ());
49
50
}
50
51
if (RemoveSelfForwardPtrsTask::should_execute ()) {
51
- add_parallel_task (new RemoveSelfForwardPtrsTask (per_thread_states->rdcqs ()));
52
+ add_parallel_task (new RemoveSelfForwardPtrsTask (per_thread_states->rdcqs (), evac_failure_regions ));
52
53
}
53
54
add_parallel_task (G1CollectedHeap::heap ()->rem_set ()->create_cleanup_after_scan_heap_roots_task ());
54
55
}
@@ -100,19 +101,23 @@ bool G1PostEvacuateCollectionSetCleanupTask1::RemoveSelfForwardPtrsTask::should_
100
101
return G1CollectedHeap::heap ()->evacuation_failed ();
101
102
}
102
103
103
- G1PostEvacuateCollectionSetCleanupTask1::RemoveSelfForwardPtrsTask::RemoveSelfForwardPtrsTask (G1RedirtyCardsQueueSet* rdcqs) :
104
- G1AbstractSubTask(G1GCPhaseTimes::RemoveSelfForwardingPtr), _task(rdcqs) { }
104
+ G1PostEvacuateCollectionSetCleanupTask1::
105
+ RemoveSelfForwardPtrsTask::RemoveSelfForwardPtrsTask (G1RedirtyCardsQueueSet* rdcqs,
106
+ G1EvacFailureRegions* evac_failure_regions) :
107
+ G1AbstractSubTask(G1GCPhaseTimes::RemoveSelfForwardingPtr),
108
+ _task(rdcqs, evac_failure_regions),
109
+ _evac_failure_regions(evac_failure_regions) { }
105
110
106
111
G1PostEvacuateCollectionSetCleanupTask1::RemoveSelfForwardPtrsTask::~RemoveSelfForwardPtrsTask () {
107
112
G1CollectedHeap* g1h = G1CollectedHeap::heap ();
108
- assert (_task.num_failed_regions () == g1h ->num_regions_failed_evacuation (),
113
+ assert (_task.num_failed_regions () == _evac_failure_regions ->num_regions_failed_evacuation (),
109
114
" Removed regions %u inconsistent with expected %u" ,
110
- _task.num_failed_regions (), g1h ->num_regions_failed_evacuation ());
115
+ _task.num_failed_regions (), _evac_failure_regions ->num_regions_failed_evacuation ());
111
116
}
112
117
113
118
double G1PostEvacuateCollectionSetCleanupTask1::RemoveSelfForwardPtrsTask::worker_cost () const {
114
119
assert (should_execute (), " Should not call this if not executed" );
115
- return G1CollectedHeap::heap () ->num_regions_failed_evacuation ();
120
+ return _evac_failure_regions ->num_regions_failed_evacuation ();
116
121
}
117
122
118
123
void G1PostEvacuateCollectionSetCleanupTask1::RemoveSelfForwardPtrsTask::do_work (uint worker_id) {
@@ -291,6 +296,7 @@ class RedirtyLoggedCardTableEntryClosure : public G1CardTableEntryClosure {
291
296
size_t _num_dirtied;
292
297
G1CollectedHeap* _g1h;
293
298
G1CardTable* _g1_ct;
299
+ G1EvacFailureRegions* _evac_failure_regions;
294
300
295
301
HeapRegion* region_for_card (CardValue* card_ptr) const {
296
302
return _g1h->heap_region_containing (_g1_ct->addr_for (card_ptr));
@@ -299,12 +305,16 @@ class RedirtyLoggedCardTableEntryClosure : public G1CardTableEntryClosure {
299
305
bool will_become_free (HeapRegion* hr) const {
300
306
// A region will be freed by during the FreeCollectionSet phase if the region is in the
301
307
// collection set and has not had an evacuation failure.
302
- return _g1h->is_in_cset (hr) && !_g1h-> evacuation_failed (hr->hrm_index ());
308
+ return _g1h->is_in_cset (hr) && !_evac_failure_regions-> contains (hr->hrm_index ());
303
309
}
304
310
305
311
public:
306
- RedirtyLoggedCardTableEntryClosure (G1CollectedHeap* g1h) : G1CardTableEntryClosure(),
307
- _num_dirtied (0 ), _g1h(g1h), _g1_ct(g1h->card_table ()) { }
312
+ RedirtyLoggedCardTableEntryClosure (G1CollectedHeap* g1h, G1EvacFailureRegions* evac_failure_regions) :
313
+ G1CardTableEntryClosure (),
314
+ _num_dirtied (0 ),
315
+ _g1h (g1h),
316
+ _g1_ct (g1h->card_table ()),
317
+ _evac_failure_regions(evac_failure_regions) { }
308
318
309
319
void do_card_ptr (CardValue* card_ptr, uint worker_id) {
310
320
HeapRegion* hr = region_for_card (card_ptr);
@@ -319,10 +329,13 @@ class RedirtyLoggedCardTableEntryClosure : public G1CardTableEntryClosure {
319
329
size_t num_dirtied () const { return _num_dirtied; }
320
330
};
321
331
322
- G1PostEvacuateCollectionSetCleanupTask2::RedirtyLoggedCardsTask::RedirtyLoggedCardsTask (G1RedirtyCardsQueueSet* rdcqs) :
332
+ G1PostEvacuateCollectionSetCleanupTask2::
333
+ RedirtyLoggedCardsTask::RedirtyLoggedCardsTask (G1RedirtyCardsQueueSet* rdcqs,
334
+ G1EvacFailureRegions* evac_failure_regions) :
323
335
G1AbstractSubTask(G1GCPhaseTimes::RedirtyCards),
324
336
_rdcqs(rdcqs),
325
- _nodes(rdcqs->all_completed_buffers ()) { }
337
+ _nodes(rdcqs->all_completed_buffers ()),
338
+ _evac_failure_regions(evac_failure_regions) { }
326
339
327
340
G1PostEvacuateCollectionSetCleanupTask2::RedirtyLoggedCardsTask::~RedirtyLoggedCardsTask () {
328
341
G1DirtyCardQueueSet& dcq = G1BarrierSet::dirty_card_queue_set ();
@@ -336,7 +349,7 @@ double G1PostEvacuateCollectionSetCleanupTask2::RedirtyLoggedCardsTask::worker_c
336
349
}
337
350
338
351
void G1PostEvacuateCollectionSetCleanupTask2::RedirtyLoggedCardsTask::do_work (uint worker_id) {
339
- RedirtyLoggedCardTableEntryClosure cl (G1CollectedHeap::heap ());
352
+ RedirtyLoggedCardTableEntryClosure cl (G1CollectedHeap::heap (), _evac_failure_regions );
340
353
const size_t buffer_size = _rdcqs->buffer_size ();
341
354
BufferNode* next = Atomic::load (&_nodes);
342
355
while (next != nullptr ) {
@@ -462,6 +475,7 @@ class FreeCSetClosure : public HeapRegionClosure {
462
475
Tickspan _young_time;
463
476
Tickspan _non_young_time;
464
477
FreeCSetStats* _stats;
478
+ G1EvacFailureRegions* _evac_failure_regions;
465
479
466
480
void assert_tracks_surviving_words (HeapRegion* r) {
467
481
assert (r->young_index_in_cset () != 0 &&
@@ -504,14 +518,16 @@ class FreeCSetClosure : public HeapRegionClosure {
504
518
public:
505
519
FreeCSetClosure (const size_t * surviving_young_words,
506
520
uint worker_id,
507
- FreeCSetStats* stats) :
521
+ FreeCSetStats* stats,
522
+ G1EvacFailureRegions* evac_failure_regions) :
508
523
HeapRegionClosure (),
509
524
_g1h (G1CollectedHeap::heap()),
510
525
_surviving_young_words (surviving_young_words),
511
526
_worker_id (worker_id),
512
527
_young_time (),
513
528
_non_young_time (),
514
- _stats (stats) { }
529
+ _stats (stats),
530
+ _evac_failure_regions (evac_failure_regions) { }
515
531
516
532
virtual bool do_heap_region (HeapRegion* r) {
517
533
assert (r->in_collection_set (), " Invariant: %u missing from CSet" , r->hrm_index ());
@@ -525,7 +541,7 @@ class FreeCSetClosure : public HeapRegionClosure {
525
541
r->record_surv_words_in_group (_surviving_young_words[r->young_index_in_cset ()]);
526
542
}
527
543
528
- if (_g1h-> evacuation_failed (r->hrm_index ())) {
544
+ if (_evac_failure_regions-> contains (r->hrm_index ())) {
529
545
handle_failed_region (r);
530
546
} else {
531
547
handle_evacuated_region (r);
@@ -559,15 +575,18 @@ void G1PostEvacuateCollectionSetCleanupTask2::FreeCollectionSetTask::report_stat
559
575
total_stats.report (_g1h, _evacuation_info);
560
576
}
561
577
562
- G1PostEvacuateCollectionSetCleanupTask2::FreeCollectionSetTask::FreeCollectionSetTask (G1EvacuationInfo* evacuation_info,
563
- const size_t * surviving_young_words) :
578
+ G1PostEvacuateCollectionSetCleanupTask2::
579
+ FreeCollectionSetTask::FreeCollectionSetTask (G1EvacuationInfo* evacuation_info,
580
+ const size_t * surviving_young_words,
581
+ G1EvacFailureRegions* evac_failure_regions) :
564
582
G1AbstractSubTask(G1GCPhaseTimes::FreeCollectionSet),
565
583
_g1h(G1CollectedHeap::heap()),
566
584
_evacuation_info(evacuation_info),
567
585
_worker_stats(nullptr ),
568
586
_claimer(0 ),
569
587
_surviving_young_words(surviving_young_words),
570
- _active_workers(0 ) {
588
+ _active_workers(0 ),
589
+ _evac_failure_regions(evac_failure_regions) {
571
590
_g1h->clear_eden ();
572
591
}
573
592
@@ -596,14 +615,15 @@ void G1PostEvacuateCollectionSetCleanupTask2::FreeCollectionSetTask::set_max_wor
596
615
}
597
616
598
617
void G1PostEvacuateCollectionSetCleanupTask2::FreeCollectionSetTask::do_work (uint worker_id) {
599
- FreeCSetClosure cl (_surviving_young_words, worker_id, worker_stats (worker_id));
618
+ FreeCSetClosure cl (_surviving_young_words, worker_id, worker_stats (worker_id), _evac_failure_regions );
600
619
_g1h->collection_set_par_iterate_all (&cl, &_claimer, worker_id);
601
620
// Report per-region type timings.
602
621
cl.report_timing ();
603
622
}
604
623
605
624
G1PostEvacuateCollectionSetCleanupTask2::G1PostEvacuateCollectionSetCleanupTask2 (G1ParScanThreadStateSet* per_thread_states,
606
- G1EvacuationInfo* evacuation_info) :
625
+ G1EvacuationInfo* evacuation_info,
626
+ G1EvacFailureRegions* evac_failure_regions) :
607
627
G1BatchedGangTask(" Post Evacuate Cleanup 2" , G1CollectedHeap::heap()->phase_times())
608
628
{
609
629
add_serial_task (new ResetHotCardCacheTask ());
@@ -618,6 +638,8 @@ G1PostEvacuateCollectionSetCleanupTask2::G1PostEvacuateCollectionSetCleanupTask2
618
638
if (RestorePreservedMarksTask::should_execute ()) {
619
639
add_parallel_task (new RestorePreservedMarksTask (per_thread_states->preserved_marks_set ()));
620
640
}
621
- add_parallel_task (new RedirtyLoggedCardsTask (per_thread_states->rdcqs ()));
622
- add_parallel_task (new FreeCollectionSetTask (evacuation_info, per_thread_states->surviving_young_words ()));
641
+ add_parallel_task (new RedirtyLoggedCardsTask (per_thread_states->rdcqs (), evac_failure_regions));
642
+ add_parallel_task (new FreeCollectionSetTask (evacuation_info,
643
+ per_thread_states->surviving_young_words (),
644
+ evac_failure_regions));
623
645
}
0 commit comments