|
1 | 1 | /*
|
2 |
| - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
45 | 45 | #include "gc/g1/g1Trace.hpp"
|
46 | 46 | #include "gc/g1/g1YoungCollector.hpp"
|
47 | 47 | #include "gc/g1/g1YoungGCPostEvacuateTasks.hpp"
|
| 48 | +#include "gc/g1/g1YoungGCPreEvacuateTasks.hpp" |
48 | 49 | #include "gc/g1/g1_globals.hpp"
|
49 | 50 | #include "gc/shared/concurrentGCBreakpoints.hpp"
|
50 | 51 | #include "gc/shared/gcTraceTime.inline.hpp"
|
@@ -462,48 +463,15 @@ void G1YoungCollector::set_young_collection_default_active_worker_threads(){
|
462 | 463 | log_info(gc,task)("Using %u workers of %u for evacuation", active_workers, workers()->max_workers());
|
463 | 464 | }
|
464 | 465 |
|
465 |
| -void G1YoungCollector::retire_tlabs() { |
466 |
| - Ticks start = Ticks::now(); |
467 |
| - _g1h->retire_tlabs(); |
468 |
| - double retire_time = (Ticks::now() - start).seconds() * MILLIUNITS; |
469 |
| - phase_times()->record_prepare_tlab_time_ms(retire_time); |
470 |
| -} |
471 |
| - |
472 |
| -void G1YoungCollector::concatenate_dirty_card_logs_and_stats() { |
473 |
| - Ticks start = Ticks::now(); |
474 |
| - G1DirtyCardQueueSet& qset = G1BarrierSet::dirty_card_queue_set(); |
475 |
| - size_t old_cards = qset.num_cards(); |
476 |
| - qset.concatenate_logs_and_stats(); |
477 |
| - size_t pending_cards = qset.num_cards(); |
478 |
| - size_t thread_buffer_cards = pending_cards - old_cards; |
479 |
| - policy()->record_concurrent_refinement_stats(pending_cards, thread_buffer_cards); |
480 |
| - double concat_time = (Ticks::now() - start).seconds() * MILLIUNITS; |
481 |
| - phase_times()->record_concatenate_dirty_card_logs_time_ms(concat_time); |
482 |
| -} |
483 |
| - |
484 |
| -#ifdef ASSERT |
485 |
| -void G1YoungCollector::verify_empty_dirty_card_logs() const { |
486 |
| - struct Verifier : public ThreadClosure { |
487 |
| - size_t _buffer_size; |
488 |
| - Verifier() : _buffer_size(G1BarrierSet::dirty_card_queue_set().buffer_size()) {} |
489 |
| - void do_thread(Thread* t) override { |
490 |
| - G1DirtyCardQueue& queue = G1ThreadLocalData::dirty_card_queue(t); |
491 |
| - assert((queue.buffer() == nullptr) || (queue.index() == _buffer_size), |
492 |
| - "non-empty dirty card queue for thread"); |
493 |
| - } |
494 |
| - } verifier; |
495 |
| - Threads::threads_do(&verifier); |
496 |
| -} |
497 |
| -#endif // ASSERT |
498 |
| - |
499 | 466 | void G1YoungCollector::pre_evacuate_collection_set(G1EvacInfo* evacuation_info) {
|
500 |
| - // Flush early, so later phases don't need to account for per-thread stuff. |
501 |
| - // Flushes deferred card marks, so must precede concatenating logs. |
502 |
| - retire_tlabs(); |
503 |
| - |
504 |
| - // Flush early, so later phases don't need to account for per-thread stuff. |
505 |
| - concatenate_dirty_card_logs_and_stats(); |
| 467 | + { |
| 468 | + Ticks start = Ticks::now(); |
| 469 | + G1PreEvacuateCollectionSetBatchTask cl; |
| 470 | + G1CollectedHeap::heap()->run_batch_task(&cl); |
| 471 | + phase_times()->record_pre_evacuate_prepare_time_ms((Ticks::now() - start).seconds() * 1000.0); |
| 472 | + } |
506 | 473 |
|
| 474 | + // Needs log buffers flushed. |
507 | 475 | calculate_collection_set(evacuation_info, policy()->max_pause_time_ms());
|
508 | 476 |
|
509 | 477 | // Please see comment in g1CollectedHeap.hpp and
|
@@ -535,7 +503,6 @@ void G1YoungCollector::pre_evacuate_collection_set(G1EvacInfo* evacuation_info)
|
535 | 503 | }
|
536 | 504 |
|
537 | 505 | assert(_g1h->verifier()->check_region_attr_table(), "Inconsistency in the region attributes table.");
|
538 |
| - verify_empty_dirty_card_logs(); |
539 | 506 |
|
540 | 507 | #if COMPILER2_OR_JVMCI
|
541 | 508 | DerivedPointerTable::clear();
|
|
0 commit comments