Skip to content

Commit

Permalink
8320864: Serial: Extract out Full GC related fields from ContiguousSpace
Browse files Browse the repository at this point in the history
Reviewed-by: kbarrett, sjohanss
  • Loading branch information
albertnetymk committed Jan 9, 2024
1 parent 176606d commit 07fce8e
Show file tree
Hide file tree
Showing 11 changed files with 363 additions and 588 deletions.
452 changes: 352 additions & 100 deletions src/hotspot/share/gc/serial/genMarkSweep.cpp

Large diffs are not rendered by default.

9 changes: 1 addition & 8 deletions src/hotspot/share/gc/serial/genMarkSweep.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,8 @@ class GenMarkSweep : public MarkSweep {
static void invoke_at_safepoint(bool clear_all_softrefs);

private:

// Mark live objects
static void mark_sweep_phase1(bool clear_all_softrefs);
// Calculate new addresses
static void mark_sweep_phase2();
// Update pointers
static void mark_sweep_phase3();
// Move objects to new positions
static void mark_sweep_phase4();
static void phase1_mark(bool clear_all_softrefs);

// Temporary data structures for traversal and storing/restoring marks
static void allocate_stacks();
Expand Down
31 changes: 0 additions & 31 deletions src/hotspot/share/gc/serial/generation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,34 +218,3 @@ void Generation::object_iterate(ObjectClosure* cl) {
GenerationObjIterateClosure blk(cl);
space_iterate(&blk);
}

void Generation::prepare_for_compaction(CompactPoint* cp) {
// Generic implementation, can be specialized
ContiguousSpace* space = first_compaction_space();
while (space != nullptr) {
space->prepare_for_compaction(cp);
space = space->next_compaction_space();
}
}

class AdjustPointersClosure: public SpaceClosure {
public:
void do_space(Space* sp) {
sp->adjust_pointers();
}
};

void Generation::adjust_pointers() {
// Note that this is done over all spaces, not just the compactible
// ones.
AdjustPointersClosure blk;
space_iterate(&blk, true);
}

void Generation::compact() {
ContiguousSpace* sp = first_compaction_space();
while (sp != nullptr) {
sp->compact();
sp = sp->next_compaction_space();
}
}
9 changes: 1 addition & 8 deletions src/hotspot/share/gc/serial/generation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
class DefNewGeneration;
class GCMemoryManager;
class ContiguousSpace;
class CompactPoint;

class OopClosure;
class GCStats;

Expand Down Expand Up @@ -286,13 +286,6 @@ class Generation: public CHeapObj<mtGC> {
GCStats* gc_stats() const { return _gc_stats; }
virtual void update_gc_stats(Generation* current_generation, bool full) {}

// Mark sweep support phase2
virtual void prepare_for_compaction(CompactPoint* cp);
// Mark sweep support phase3
virtual void adjust_pointers();
// Mark sweep support phase4
virtual void compact();

// Accessing "marks".

// This function gives a generation a chance to note a point between
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/gc/serial/tenuredGeneration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ class TenuredGeneration: public Generation {
GenerationCounters* _gen_counters;
CSpaceCounters* _space_counters;

// Accessing spaces
TenuredSpace* space() const { return _the_space; }

// Attempt to expand the generation by "bytes". Expand by at a
// minimum "expand_bytes". Return true if some amount (not
Expand All @@ -85,6 +83,8 @@ class TenuredGeneration: public Generation {
public:
virtual void compute_new_size();

TenuredSpace* space() const { return _the_space; }

// Grow generation with specified size (returns false if unable to grow)
bool grow_by(size_t bytes);
// Grow generation to reserved size.
Expand Down
13 changes: 0 additions & 13 deletions src/hotspot/share/gc/shared/genCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,10 +713,6 @@ void GenCollectedHeap::process_roots(ScanningOption so,
DEBUG_ONLY(ScavengableNMethods::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
}

void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
WeakProcessor::oops_do(root_closure);
}

bool GenCollectedHeap::no_allocs_since_save_marks() {
return _young_gen->no_allocs_since_save_marks() &&
_old_gen->no_allocs_since_save_marks();
Expand Down Expand Up @@ -911,15 +907,6 @@ GenCollectedHeap* GenCollectedHeap::heap() {
return named_heap<GenCollectedHeap>(CollectedHeap::Serial);
}

#if INCLUDE_SERIALGC
void GenCollectedHeap::prepare_for_compaction() {
// Start by compacting into same gen.
CompactPoint cp(_old_gen);
_old_gen->prepare_for_compaction(&cp);
_young_gen->prepare_for_compaction(&cp);
}
#endif // INCLUDE_SERIALGC

void GenCollectedHeap::verify(VerifyOption option /* ignored */) {
log_debug(gc, verify)("%s", _old_gen->name());
_old_gen->verify();
Expand Down
12 changes: 0 additions & 12 deletions src/hotspot/share/gc/shared/genCollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,6 @@ class GenCollectedHeap : public CollectedHeap {
CLDClosure* weak_cld_closure,
CodeBlobToOopClosure* code_roots);

// Apply "root_closure" to all the weak roots of the system.
// These include JNI weak roots, string table,
// and referents of reachable weak refs.
void gen_process_weak_roots(OopClosure* root_closure);

// Set the saved marks of generations, if that makes sense.
// In particular, if any generation might iterate over the oops
// in other generations, it should call this method.
Expand Down Expand Up @@ -340,13 +335,6 @@ class GenCollectedHeap : public CollectedHeap {
HeapWord* mem_allocate_work(size_t size,
bool is_tlab);

#if INCLUDE_SERIALGC
// For use by mark-sweep. As implemented, mark-sweep-compact is global
// in an essential way: compaction is performed across generations, by
// iterating over spaces.
void prepare_for_compaction();
#endif

// Save the tops of the spaces in all generations
void record_gen_tops_before_GC() PRODUCT_RETURN;

Expand Down
Loading

1 comment on commit 07fce8e

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.