mirror of
https://github.com/openjdk/jdk.git
synced 2026-04-09 06:28:49 +00:00
8316957: Serial: Change GenCollectedHeap to SerialHeap inside gc/serial folder
Reviewed-by: iwalulya, tschatzl
This commit is contained in:
parent
bc5a39bb54
commit
d0c1444d92
@ -25,7 +25,7 @@
|
||||
#include "precompiled.hpp"
|
||||
#include "classfile/classLoaderDataGraph.hpp"
|
||||
#include "gc/serial/cardTableRS.hpp"
|
||||
#include "gc/shared/genCollectedHeap.hpp"
|
||||
#include "gc/serial/serialHeap.hpp"
|
||||
#include "gc/shared/generation.hpp"
|
||||
#include "gc/shared/space.inline.hpp"
|
||||
#include "memory/allocation.inline.hpp"
|
||||
@ -132,7 +132,7 @@ void CardTableRS::verify_used_region_at_save_marks(Space* sp) const {
|
||||
#endif
|
||||
|
||||
void CardTableRS::maintain_old_to_young_invariant(Generation* old_gen, bool is_young_gen_empty) {
|
||||
assert(GenCollectedHeap::heap()->is_old_gen(old_gen), "precondition");
|
||||
assert(SerialHeap::heap()->is_old_gen(old_gen), "precondition");
|
||||
|
||||
if (is_young_gen_empty) {
|
||||
clear_MemRegion(old_gen->prev_used_region());
|
||||
@ -193,13 +193,13 @@ public:
|
||||
virtual void do_space(Space* s) { _ct->verify_space(s, _boundary); }
|
||||
};
|
||||
|
||||
class VerifyCTGenClosure: public GenCollectedHeap::GenClosure {
|
||||
class VerifyCTGenClosure: public SerialHeap::GenClosure {
|
||||
CardTableRS* _ct;
|
||||
public:
|
||||
VerifyCTGenClosure(CardTableRS* ct) : _ct(ct) {}
|
||||
void do_generation(Generation* gen) {
|
||||
// Skip the youngest generation.
|
||||
if (GenCollectedHeap::heap()->is_young_gen(gen)) {
|
||||
if (SerialHeap::heap()->is_young_gen(gen)) {
|
||||
return;
|
||||
}
|
||||
// Normally, we're interested in pointers to younger generations.
|
||||
@ -416,7 +416,7 @@ void CardTableRS::verify() {
|
||||
// At present, we only know how to verify the card table RS for
|
||||
// generational heaps.
|
||||
VerifyCTGenClosure blk(this);
|
||||
GenCollectedHeap::heap()->generation_iterate(&blk, false);
|
||||
SerialHeap::heap()->generation_iterate(&blk, false);
|
||||
}
|
||||
|
||||
CardTableRS::CardTableRS(MemRegion whole_heap) :
|
||||
@ -439,5 +439,5 @@ void CardTableRS::non_clean_card_iterate(TenuredSpace* sp,
|
||||
}
|
||||
|
||||
bool CardTableRS::is_in_young(const void* p) const {
|
||||
return GenCollectedHeap::heap()->is_in_young(p);
|
||||
return SerialHeap::heap()->is_in_young(p);
|
||||
}
|
||||
|
||||
@ -337,7 +337,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
|
||||
{
|
||||
MemRegion cmr((HeapWord*)_virtual_space.low(),
|
||||
(HeapWord*)_virtual_space.high());
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
SerialHeap* gch = SerialHeap::heap();
|
||||
|
||||
gch->rem_set()->resize_covered_region(cmr);
|
||||
|
||||
@ -556,7 +556,7 @@ void DefNewGeneration::compute_new_size() {
|
||||
return;
|
||||
}
|
||||
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
SerialHeap* gch = SerialHeap::heap();
|
||||
|
||||
size_t old_size = gch->old_gen()->capacity();
|
||||
size_t new_size_before = _virtual_space.committed_size();
|
||||
@ -692,7 +692,7 @@ HeapWord* DefNewGeneration::allocate_from_space(size_t size) {
|
||||
|
||||
log_trace(gc, alloc)("DefNewGeneration::allocate_from_space(" SIZE_FORMAT "): will_fail: %s heap_lock: %s free: " SIZE_FORMAT "%s%s returns %s",
|
||||
size,
|
||||
GenCollectedHeap::heap()->incremental_collection_will_fail(false /* don't consult_young */) ?
|
||||
SerialHeap::heap()->incremental_collection_will_fail(false /* don't consult_young */) ?
|
||||
"true" : "false",
|
||||
Heap_lock->is_locked() ? "locked" : "unlocked",
|
||||
from()->free(),
|
||||
@ -716,7 +716,7 @@ void DefNewGeneration::adjust_desired_tenuring_threshold() {
|
||||
_tenuring_threshold = age_table()->compute_tenuring_threshold(desired_survivor_size);
|
||||
|
||||
if (UsePerfData) {
|
||||
GCPolicyCounters* gc_counters = GenCollectedHeap::heap()->counters();
|
||||
GCPolicyCounters* gc_counters = SerialHeap::heap()->counters();
|
||||
gc_counters->tenuring_threshold()->set_value(_tenuring_threshold);
|
||||
gc_counters->desired_survivor_size()->set_value(desired_survivor_size * oopSize);
|
||||
}
|
||||
@ -1009,8 +1009,7 @@ bool DefNewGeneration::collection_attempt_is_safe() {
|
||||
return false;
|
||||
}
|
||||
if (_old_gen == nullptr) {
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
_old_gen = gch->old_gen();
|
||||
_old_gen = SerialHeap::heap()->old_gen();
|
||||
}
|
||||
return _old_gen->promotion_attempt_is_safe(used());
|
||||
}
|
||||
@ -1023,7 +1022,7 @@ void DefNewGeneration::gc_epilogue(bool full) {
|
||||
// been done. Generally the young generation is empty at
|
||||
// a minimum at the end of a collection. If it is not, then
|
||||
// the heap is approaching full.
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
SerialHeap* gch = SerialHeap::heap();
|
||||
if (full) {
|
||||
DEBUG_ONLY(seen_incremental_collection_failed = false;)
|
||||
if (!collection_attempt_is_safe() && !_eden_space->is_empty()) {
|
||||
|
||||
@ -28,7 +28,6 @@
|
||||
#include "gc/serial/defNewGeneration.hpp"
|
||||
|
||||
#include "gc/serial/cardTableRS.hpp"
|
||||
#include "gc/shared/genCollectedHeap.hpp"
|
||||
#include "gc/shared/space.inline.hpp"
|
||||
#include "oops/access.inline.hpp"
|
||||
#include "utilities/devirtualizer.inline.hpp"
|
||||
|
||||
@ -36,12 +36,12 @@
|
||||
#include "gc/serial/defNewGeneration.hpp"
|
||||
#include "gc/serial/genMarkSweep.hpp"
|
||||
#include "gc/serial/serialGcRefProcProxyTask.hpp"
|
||||
#include "gc/serial/serialHeap.hpp"
|
||||
#include "gc/shared/collectedHeap.inline.hpp"
|
||||
#include "gc/shared/gcHeapSummary.hpp"
|
||||
#include "gc/shared/gcTimer.hpp"
|
||||
#include "gc/shared/gcTrace.hpp"
|
||||
#include "gc/shared/gcTraceTime.inline.hpp"
|
||||
#include "gc/shared/genCollectedHeap.hpp"
|
||||
#include "gc/shared/generation.hpp"
|
||||
#include "gc/shared/modRefBarrierSet.hpp"
|
||||
#include "gc/shared/preservedMarks.inline.hpp"
|
||||
@ -68,7 +68,7 @@
|
||||
void GenMarkSweep::invoke_at_safepoint(bool clear_all_softrefs) {
|
||||
assert(SafepointSynchronize::is_at_safepoint(), "must be at a safepoint");
|
||||
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
SerialHeap* gch = SerialHeap::heap();
|
||||
#ifdef ASSERT
|
||||
if (gch->soft_ref_policy()->should_clear_all_soft_refs()) {
|
||||
assert(clear_all_softrefs, "Policy should have been checked earlier");
|
||||
@ -129,7 +129,7 @@ void GenMarkSweep::invoke_at_safepoint(bool clear_all_softrefs) {
|
||||
void GenMarkSweep::allocate_stacks() {
|
||||
void* scratch = nullptr;
|
||||
size_t num_words;
|
||||
DefNewGeneration* young_gen = (DefNewGeneration*)GenCollectedHeap::heap()->young_gen();
|
||||
DefNewGeneration* young_gen = (DefNewGeneration*)SerialHeap::heap()->young_gen();
|
||||
young_gen->contribute_scratch(scratch, num_words);
|
||||
|
||||
if (scratch != nullptr) {
|
||||
@ -147,7 +147,7 @@ void GenMarkSweep::allocate_stacks() {
|
||||
|
||||
void GenMarkSweep::deallocate_stacks() {
|
||||
if (_preserved_count_max != 0) {
|
||||
DefNewGeneration* young_gen = (DefNewGeneration*)GenCollectedHeap::heap()->young_gen();
|
||||
DefNewGeneration* young_gen = (DefNewGeneration*)SerialHeap::heap()->young_gen();
|
||||
young_gen->reset_scratch();
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
|
||||
// Recursively traverse all live objects and mark them
|
||||
GCTraceTime(Info, gc, phases) tm("Phase 1: Mark live objects", _gc_timer);
|
||||
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
SerialHeap* gch = SerialHeap::heap();
|
||||
|
||||
ClassLoaderDataGraph::verify_claimed_marks_cleared(ClassLoaderData::_claim_stw_fullgc_mark);
|
||||
|
||||
@ -171,7 +171,7 @@ void GenMarkSweep::mark_sweep_phase1(bool clear_all_softrefs) {
|
||||
|
||||
CLDClosure* weak_cld_closure = ClassUnloading ? nullptr : &follow_cld_closure;
|
||||
MarkingCodeBlobClosure mark_code_closure(&follow_root_closure, !CodeBlobToOopClosure::FixRelocations, true);
|
||||
gch->process_roots(GenCollectedHeap::SO_None,
|
||||
gch->process_roots(SerialHeap::SO_None,
|
||||
&follow_root_closure,
|
||||
&follow_cld_closure,
|
||||
weak_cld_closure,
|
||||
@ -225,10 +225,10 @@ void GenMarkSweep::mark_sweep_phase2() {
|
||||
// Now all live objects are marked, compute the new object addresses.
|
||||
GCTraceTime(Info, gc, phases) tm("Phase 2: Compute new object addresses", _gc_timer);
|
||||
|
||||
GenCollectedHeap::heap()->prepare_for_compaction();
|
||||
SerialHeap::heap()->prepare_for_compaction();
|
||||
}
|
||||
|
||||
class GenAdjustPointersClosure: public GenCollectedHeap::GenClosure {
|
||||
class GenAdjustPointersClosure: public SerialHeap::GenClosure {
|
||||
public:
|
||||
void do_generation(Generation* gen) {
|
||||
gen->adjust_pointers();
|
||||
@ -236,7 +236,7 @@ public:
|
||||
};
|
||||
|
||||
void GenMarkSweep::mark_sweep_phase3() {
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
SerialHeap* gch = SerialHeap::heap();
|
||||
|
||||
// Adjust the pointers to reflect the new locations
|
||||
GCTraceTime(Info, gc, phases) tm("Phase 3: Adjust pointers", gc_timer());
|
||||
@ -244,7 +244,7 @@ void GenMarkSweep::mark_sweep_phase3() {
|
||||
ClassLoaderDataGraph::verify_claimed_marks_cleared(ClassLoaderData::_claim_stw_fullgc_adjust);
|
||||
|
||||
CodeBlobToOopClosure code_closure(&adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations);
|
||||
gch->process_roots(GenCollectedHeap::SO_AllCodeCache,
|
||||
gch->process_roots(SerialHeap::SO_AllCodeCache,
|
||||
&adjust_pointer_closure,
|
||||
&adjust_cld_closure,
|
||||
&adjust_cld_closure,
|
||||
@ -257,7 +257,7 @@ void GenMarkSweep::mark_sweep_phase3() {
|
||||
gch->generation_iterate(&blk, true);
|
||||
}
|
||||
|
||||
class GenCompactClosure: public GenCollectedHeap::GenClosure {
|
||||
class GenCompactClosure: public SerialHeap::GenClosure {
|
||||
public:
|
||||
void do_generation(Generation* gen) {
|
||||
gen->compact();
|
||||
@ -269,5 +269,5 @@ void GenMarkSweep::mark_sweep_phase4() {
|
||||
GCTraceTime(Info, gc, phases) tm("Phase 4: Move objects", _gc_timer);
|
||||
|
||||
GenCompactClosure blk;
|
||||
GenCollectedHeap::heap()->generation_iterate(&blk, true);
|
||||
SerialHeap::heap()->generation_iterate(&blk, true);
|
||||
}
|
||||
|
||||
@ -42,7 +42,7 @@ class SerialOldTracer;
|
||||
class STWGCTimer;
|
||||
|
||||
// MarkSweep takes care of global mark-compact garbage collection for a
|
||||
// GenCollectedHeap using a four-phase pointer forwarding algorithm. All
|
||||
// SerialHeap using a four-phase pointer forwarding algorithm. All
|
||||
// generations are assumed to support marking; those that can also support
|
||||
// compaction.
|
||||
//
|
||||
|
||||
@ -26,12 +26,12 @@
|
||||
#include "gc/serial/cardTableRS.hpp"
|
||||
#include "gc/serial/genMarkSweep.hpp"
|
||||
#include "gc/serial/serialBlockOffsetTable.inline.hpp"
|
||||
#include "gc/serial/serialHeap.hpp"
|
||||
#include "gc/serial/tenuredGeneration.inline.hpp"
|
||||
#include "gc/shared/collectorCounters.hpp"
|
||||
#include "gc/shared/gcLocker.hpp"
|
||||
#include "gc/shared/gcTimer.hpp"
|
||||
#include "gc/shared/gcTrace.hpp"
|
||||
#include "gc/shared/genCollectedHeap.hpp"
|
||||
#include "gc/shared/generationSpec.hpp"
|
||||
#include "gc/shared/space.hpp"
|
||||
#include "logging/log.hpp"
|
||||
@ -48,7 +48,7 @@ bool TenuredGeneration::grow_by(size_t bytes) {
|
||||
heap_word_size(_virtual_space.committed_size());
|
||||
MemRegion mr(space()->bottom(), new_word_size);
|
||||
// Expand card table
|
||||
GenCollectedHeap::heap()->rem_set()->resize_covered_region(mr);
|
||||
SerialHeap::heap()->rem_set()->resize_covered_region(mr);
|
||||
// Expand shared block offset array
|
||||
_bts->resize(new_word_size);
|
||||
|
||||
@ -135,7 +135,7 @@ void TenuredGeneration::shrink(size_t bytes) {
|
||||
_bts->resize(new_word_size);
|
||||
MemRegion mr(space()->bottom(), new_word_size);
|
||||
// Shrink the card table
|
||||
GenCollectedHeap::heap()->rem_set()->resize_covered_region(mr);
|
||||
SerialHeap::heap()->rem_set()->resize_covered_region(mr);
|
||||
|
||||
size_t new_mem_size = _virtual_space.committed_size();
|
||||
size_t old_mem_size = new_mem_size + size;
|
||||
@ -305,7 +305,7 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs,
|
||||
// which would cause problems when we commit/uncommit memory, and when we
|
||||
// clear and dirty cards.
|
||||
guarantee(_rs->is_aligned(reserved_mr.start()), "generation must be card aligned");
|
||||
if (reserved_mr.end() != GenCollectedHeap::heap()->reserved_region().end()) {
|
||||
if (reserved_mr.end() != SerialHeap::heap()->reserved_region().end()) {
|
||||
// Don't check at the very end of the heap as we'll assert that we're probing off
|
||||
// the end if we try.
|
||||
guarantee(_rs->is_aligned(reserved_mr.end()), "generation must be card aligned");
|
||||
@ -390,7 +390,7 @@ void TenuredGeneration::update_gc_stats(Generation* current_generation,
|
||||
bool full) {
|
||||
// If the young generation has been collected, gather any statistics
|
||||
// that are of interest at this point.
|
||||
bool current_is_young = GenCollectedHeap::heap()->is_young_gen(current_generation);
|
||||
bool current_is_young = SerialHeap::heap()->is_young_gen(current_generation);
|
||||
if (!full && current_is_young) {
|
||||
// Calculate size of data promoted from the young generation
|
||||
// before doing the collection.
|
||||
@ -429,7 +429,7 @@ void TenuredGeneration::collect(bool full,
|
||||
bool clear_all_soft_refs,
|
||||
size_t size,
|
||||
bool is_tlab) {
|
||||
GenCollectedHeap* gch = GenCollectedHeap::heap();
|
||||
SerialHeap* gch = SerialHeap::heap();
|
||||
|
||||
STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
|
||||
gc_timer->register_gc_start();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user