8323993: Serial: Refactor gc_prologue and gc_epilogue
Reviewed-by: stefank, ehelin
This commit is contained in:
parent
aeb304b29e
commit
8e534598b5
@ -226,7 +226,7 @@ class DefNewGeneration: public Generation {
|
|||||||
|
|
||||||
HeapWord* par_allocate(size_t word_size, bool is_tlab);
|
HeapWord* par_allocate(size_t word_size, bool is_tlab);
|
||||||
|
|
||||||
virtual void gc_epilogue(bool full);
|
void gc_epilogue(bool full);
|
||||||
|
|
||||||
// Save the tops for eden, from, and to
|
// Save the tops for eden, from, and to
|
||||||
virtual void record_spaces_top();
|
virtual void record_spaces_top();
|
||||||
|
@ -224,14 +224,6 @@ class Generation: public CHeapObj<mtGC> {
|
|||||||
// still unsuccessful, return "null".
|
// still unsuccessful, return "null".
|
||||||
virtual HeapWord* expand_and_allocate(size_t word_size, bool is_tlab) = 0;
|
virtual HeapWord* expand_and_allocate(size_t word_size, bool is_tlab) = 0;
|
||||||
|
|
||||||
// Some generations may require some cleanup or preparation actions before
|
|
||||||
// allowing a collection. The default is to do nothing.
|
|
||||||
virtual void gc_prologue(bool full) {}
|
|
||||||
|
|
||||||
// Some generations may require some cleanup actions after a collection.
|
|
||||||
// The default is to do nothing.
|
|
||||||
virtual void gc_epilogue(bool full) {}
|
|
||||||
|
|
||||||
// Save the high water marks for the used space in a generation.
|
// Save the high water marks for the used space in a generation.
|
||||||
virtual void record_spaces_top() {}
|
virtual void record_spaces_top() {}
|
||||||
|
|
||||||
|
@ -1052,35 +1052,13 @@ void SerialHeap::print_heap_change(const PreGenGCValues& pre_gc_values) const {
|
|||||||
MetaspaceUtils::print_metaspace_change(pre_gc_values.metaspace_sizes());
|
MetaspaceUtils::print_metaspace_change(pre_gc_values.metaspace_sizes());
|
||||||
}
|
}
|
||||||
|
|
||||||
class GenGCPrologueClosure: public SerialHeap::GenClosure {
|
|
||||||
private:
|
|
||||||
bool _full;
|
|
||||||
public:
|
|
||||||
void do_generation(Generation* gen) {
|
|
||||||
gen->gc_prologue(_full);
|
|
||||||
}
|
|
||||||
GenGCPrologueClosure(bool full) : _full(full) {};
|
|
||||||
};
|
|
||||||
|
|
||||||
void SerialHeap::gc_prologue(bool full) {
|
void SerialHeap::gc_prologue(bool full) {
|
||||||
assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
|
assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
|
||||||
|
|
||||||
// Fill TLAB's and such
|
// Fill TLAB's and such
|
||||||
ensure_parsability(true); // retire TLABs
|
ensure_parsability(true); // retire TLABs
|
||||||
|
|
||||||
// Walk generations
|
_old_gen->gc_prologue();
|
||||||
GenGCPrologueClosure blk(full);
|
|
||||||
generation_iterate(&blk, false); // not old-to-young.
|
|
||||||
};
|
|
||||||
|
|
||||||
class GenGCEpilogueClosure: public SerialHeap::GenClosure {
|
|
||||||
private:
|
|
||||||
bool _full;
|
|
||||||
public:
|
|
||||||
void do_generation(Generation* gen) {
|
|
||||||
gen->gc_epilogue(_full);
|
|
||||||
}
|
|
||||||
GenGCEpilogueClosure(bool full) : _full(full) {};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void SerialHeap::gc_epilogue(bool full) {
|
void SerialHeap::gc_epilogue(bool full) {
|
||||||
@ -1090,8 +1068,8 @@ void SerialHeap::gc_epilogue(bool full) {
|
|||||||
|
|
||||||
resize_all_tlabs();
|
resize_all_tlabs();
|
||||||
|
|
||||||
GenGCEpilogueClosure blk(full);
|
_young_gen->gc_epilogue(full);
|
||||||
generation_iterate(&blk, false); // not old-to-young.
|
_old_gen->gc_epilogue();
|
||||||
|
|
||||||
MetaspaceCounters::update_performance_counters();
|
MetaspaceCounters::update_performance_counters();
|
||||||
};
|
};
|
||||||
|
@ -331,7 +331,7 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs,
|
|||||||
_the_space, _gen_counters);
|
_the_space, _gen_counters);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TenuredGeneration::gc_prologue(bool full) {
|
void TenuredGeneration::gc_prologue() {
|
||||||
_capacity_at_prologue = capacity();
|
_capacity_at_prologue = capacity();
|
||||||
_used_at_prologue = used();
|
_used_at_prologue = used();
|
||||||
}
|
}
|
||||||
@ -485,7 +485,7 @@ bool TenuredGeneration::no_allocs_since_save_marks() {
|
|||||||
return _the_space->saved_mark_at_top();
|
return _the_space->saved_mark_at_top();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TenuredGeneration::gc_epilogue(bool full) {
|
void TenuredGeneration::gc_epilogue() {
|
||||||
// update the generation and space performance counters
|
// update the generation and space performance counters
|
||||||
update_counters();
|
update_counters();
|
||||||
if (ZapUnusedHeapArea) {
|
if (ZapUnusedHeapArea) {
|
||||||
|
@ -140,8 +140,8 @@ class TenuredGeneration: public Generation {
|
|||||||
|
|
||||||
HeapWord* expand_and_allocate(size_t size, bool is_tlab);
|
HeapWord* expand_and_allocate(size_t size, bool is_tlab);
|
||||||
|
|
||||||
virtual void gc_prologue(bool full);
|
void gc_prologue();
|
||||||
virtual void gc_epilogue(bool full);
|
void gc_epilogue();
|
||||||
|
|
||||||
bool should_collect(bool full,
|
bool should_collect(bool full,
|
||||||
size_t word_size,
|
size_t word_size,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user