Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8269914: Factor out heap printing for G1 young and full gc #4705

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -91,7 +91,7 @@ bool G1Allocator::is_retained_old_region(HeapRegion* hr) {
return _retained_old_gc_alloc_region == hr;
}

void G1Allocator::reuse_retained_old_region(G1EvacuationInfo& evacuation_info,
void G1Allocator::reuse_retained_old_region(G1EvacuationInfo* evacuation_info,
OldGCAllocRegion* old,
HeapRegion** retained_old) {
HeapRegion* retained_region = *retained_old;
@@ -120,11 +120,11 @@ void G1Allocator::reuse_retained_old_region(G1EvacuationInfo& evacuation_info,
_g1h->old_set_remove(retained_region);
old->set(retained_region);
_g1h->hr_printer()->reuse(retained_region);
evacuation_info.set_alloc_regions_used_before(retained_region->used());
evacuation_info->set_alloc_regions_used_before(retained_region->used());
}
}

void G1Allocator::init_gc_alloc_regions(G1EvacuationInfo& evacuation_info) {
void G1Allocator::init_gc_alloc_regions(G1EvacuationInfo* evacuation_info) {
assert_at_safepoint_on_vm_thread();

_survivor_is_full = false;
@@ -140,14 +140,14 @@ void G1Allocator::init_gc_alloc_regions(G1EvacuationInfo& evacuation_info) {
&_retained_old_gc_alloc_region);
}

void G1Allocator::release_gc_alloc_regions(G1EvacuationInfo& evacuation_info) {
void G1Allocator::release_gc_alloc_regions(G1EvacuationInfo* evacuation_info) {
uint survivor_region_count = 0;
for (uint node_index = 0; node_index < _num_alloc_regions; node_index++) {
survivor_region_count += survivor_gc_alloc_region(node_index)->count();
survivor_gc_alloc_region(node_index)->release();
}
evacuation_info.set_allocation_regions(survivor_region_count +
old_gc_alloc_region()->count());
evacuation_info->set_allocation_regions(survivor_region_count +
old_gc_alloc_region()->count());

// If we have an old GC alloc region to release, we'll save it in
// _retained_old_gc_alloc_region. If we don't
@@ -68,7 +68,7 @@ class G1Allocator : public CHeapObj<mtGC> {
void set_survivor_full();
void set_old_full();

void reuse_retained_old_region(G1EvacuationInfo& evacuation_info,
void reuse_retained_old_region(G1EvacuationInfo* evacuation_info,
OldGCAllocRegion* old,
HeapRegion** retained);

@@ -105,8 +105,8 @@ class G1Allocator : public CHeapObj<mtGC> {
void init_mutator_alloc_regions();
void release_mutator_alloc_regions();

void init_gc_alloc_regions(G1EvacuationInfo& evacuation_info);
void release_gc_alloc_regions(G1EvacuationInfo& evacuation_info);
void init_gc_alloc_regions(G1EvacuationInfo* evacuation_info);
void release_gc_alloc_regions(G1EvacuationInfo* evacuation_info);
void abandon_gc_alloc_regions();
bool is_retained_old_region(HeapRegion* hr);

@@ -2797,10 +2797,10 @@ void G1CollectedHeap::start_new_collection_set() {
phase_times()->record_start_new_cset_time_ms((os::elapsedTime() - start) * 1000.0);
}

void G1CollectedHeap::calculate_collection_set(G1EvacuationInfo& evacuation_info, double target_pause_time_ms) {
void G1CollectedHeap::calculate_collection_set(G1EvacuationInfo* evacuation_info, double target_pause_time_ms) {

_collection_set.finalize_initial_collection_set(target_pause_time_ms, &_survivor);
evacuation_info.set_collectionset_regions(collection_set()->region_length() +
evacuation_info->set_collectionset_regions(collection_set()->region_length() +
collection_set()->optional_region_length());

_cm->verify_no_collection_set_oops();
@@ -2940,12 +2940,12 @@ G1HeapPrinterMark::G1HeapPrinterMark(G1CollectedHeap* g1h) : _g1h(g1h), _heap_tr
G1HeapPrinterMark::~G1HeapPrinterMark() {
_g1h->policy()->print_age_table();
_g1h->rem_set()->print_coarsen_stats();
// We are at the end of the GC. Total collections has already been increased.
_g1h->rem_set()->print_periodic_summary_info("After GC RS summary", _g1h->total_collections() - 1);

_heap_transition.print();
_g1h->print_heap_regions();
_g1h->print_heap_after_gc();
// We are at the end of the GC. Total collections has already been increased.
_g1h->rem_set()->print_periodic_summary_info("After GC RS summary", _g1h->total_collections() - 1);
// Print NUMA statistics.
_g1h->numa()->print_statistics();
}
@@ -3067,15 +3067,15 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
// of the collection set!).
_allocator->release_mutator_alloc_regions();

calculate_collection_set(*jtm.evacuation_info(), target_pause_time_ms);
calculate_collection_set(jtm.evacuation_info(), target_pause_time_ms);

G1RedirtyCardsQueueSet rdcqs(G1BarrierSet::dirty_card_queue_set().allocator());
G1ParScanThreadStateSet per_thread_states(this,
&rdcqs,
workers()->active_workers(),
collection_set()->young_region_length(),
collection_set()->optional_region_length());
pre_evacuate_collection_set(*jtm.evacuation_info(), &per_thread_states);
pre_evacuate_collection_set(jtm.evacuation_info(), &per_thread_states);

bool may_do_optional_evacuation = _collection_set.optional_region_length() != 0;
// Actually do the work...
@@ -3084,7 +3084,7 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus
if (may_do_optional_evacuation) {
evacuate_optional_collection_set(&per_thread_states);
}
post_evacuate_collection_set(*jtm.evacuation_info(), &rdcqs, &per_thread_states);
post_evacuate_collection_set(jtm.evacuation_info(), &rdcqs, &per_thread_states);

start_new_collection_set();

@@ -3103,7 +3103,7 @@ void G1CollectedHeap::do_collection_pause_at_safepoint_helper(double target_paus

// Need to report the collection pause now since record_collection_pause_end()
// modifies it to the next state.
_gc_tracer_stw->report_young_gc_pause(collector_state()->young_gc_pause_type(concurrent_operation_is_full_mark));
jtm.report_pause_type(collector_state()->young_gc_pause_type(concurrent_operation_is_full_mark));

double sample_end_time_sec = os::elapsedTime();
double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
@@ -3549,7 +3549,7 @@ class G1PrepareEvacuationTask : public AbstractGangTask {
}
};

void G1CollectedHeap::pre_evacuate_collection_set(G1EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* per_thread_states) {
void G1CollectedHeap::pre_evacuate_collection_set(G1EvacuationInfo* evacuation_info, G1ParScanThreadStateSet* per_thread_states) {
_bytes_used_during_gc = 0;

_expand_heap_after_alloc_failure = true;
@@ -3817,7 +3817,7 @@ void G1CollectedHeap::evacuate_optional_collection_set(G1ParScanThreadStateSet*
_collection_set.abandon_optional_collection_set(per_thread_states);
}

void G1CollectedHeap::post_evacuate_collection_set(G1EvacuationInfo& evacuation_info,
void G1CollectedHeap::post_evacuate_collection_set(G1EvacuationInfo* evacuation_info,
G1RedirtyCardsQueueSet* rdcqs,
G1ParScanThreadStateSet* per_thread_states) {
G1GCPhaseTimes* p = phase_times();
@@ -3838,16 +3838,16 @@ void G1CollectedHeap::post_evacuate_collection_set(G1EvacuationInfo& evacuation_

post_evacuate_cleanup_1(per_thread_states, rdcqs);

post_evacuate_cleanup_2(&_preserved_marks_set, rdcqs, &evacuation_info, per_thread_states->surviving_young_words());
post_evacuate_cleanup_2(&_preserved_marks_set, rdcqs, evacuation_info, per_thread_states->surviving_young_words());

assert_used_and_recalculate_used_equal(this);

rebuild_free_region_list();

record_obj_copy_mem_stats();

evacuation_info.set_collectionset_used_before(collection_set()->bytes_used_before());
evacuation_info.set_bytes_used(_bytes_used_during_gc);
evacuation_info->set_collectionset_used_before(collection_set()->bytes_used_before());
evacuation_info->set_bytes_used(_bytes_used_during_gc);
}

void G1CollectedHeap::record_obj_copy_mem_stats() {
@@ -804,7 +804,7 @@ class G1CollectedHeap : public CollectedHeap {
void verify_before_young_collection(G1HeapVerifier::G1VerifyType type);
void verify_after_young_collection(G1HeapVerifier::G1VerifyType type);

void calculate_collection_set(G1EvacuationInfo& evacuation_info, double target_pause_time_ms);
void calculate_collection_set(G1EvacuationInfo* evacuation_info, double target_pause_time_ms);

// Actually do the work of evacuating the parts of the collection set.
// The has_optional_evacuation_work flag for the initial collection set
@@ -830,8 +830,8 @@ class G1CollectedHeap : public CollectedHeap {
void evacuate_next_optional_regions(G1ParScanThreadStateSet* per_thread_states);

public:
void pre_evacuate_collection_set(G1EvacuationInfo& evacuation_info, G1ParScanThreadStateSet* pss);
void post_evacuate_collection_set(G1EvacuationInfo& evacuation_info,
void pre_evacuate_collection_set(G1EvacuationInfo* evacuation_info, G1ParScanThreadStateSet* pss);
void post_evacuate_collection_set(G1EvacuationInfo* evacuation_info,
G1RedirtyCardsQueueSet* rdcqs,
G1ParScanThreadStateSet* pss);

@@ -68,7 +68,6 @@ class G1FullGCScope : public StackObj {
bool explicit_gc,
bool clear_soft,
bool do_maximal_compaction);
~G1FullGCScope() { }

bool is_explicit_gc();
bool should_clear_soft_refs();