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

8317994: Serial: Use SerialHeap in generation #16162

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions src/hotspot/share/gc/serial/generation.cpp
Original file line number Diff line number Diff line change
@@ -25,12 +25,12 @@
#include "precompiled.hpp"
#include "gc/serial/cardTableRS.hpp"
#include "gc/serial/generation.hpp"
#include "gc/serial/serialHeap.hpp"
#include "gc/shared/collectedHeap.inline.hpp"
#include "gc/shared/continuationGCSupport.inline.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.inline.hpp"
#include "gc/shared/spaceDecorator.inline.hpp"
@@ -58,11 +58,11 @@ Generation::Generation(ReservedSpace rs, size_t initial_size) :
}

size_t Generation::initial_size() {
GenCollectedHeap* gch = GenCollectedHeap::heap();
if (gch->is_young_gen(this)) {
return gch->young_gen_spec()->init_size();
SerialHeap* serial_heap = SerialHeap::heap();
if (serial_heap->is_young_gen(this)) {
return serial_heap->young_gen_spec()->init_size();
}
return gch->old_gen_spec()->init_size();
return serial_heap->old_gen_spec()->init_size();
}

size_t Generation::max_capacity() const {
@@ -86,7 +86,7 @@ void Generation::print_summary_info_on(outputStream* st) {
double time = sr->accumulated_time.seconds();
st->print_cr("Accumulated %s generation GC time %3.7f secs, "
"%u GC's, avg GC time %3.7f",
GenCollectedHeap::heap()->is_young_gen(this) ? "young" : "old" ,
SerialHeap::heap()->is_young_gen(this) ? "young" : "old" ,
time,
sr->invocations,
sr->invocations > 0 ? time / sr->invocations : 0.0);
@@ -116,8 +116,8 @@ size_t Generation::max_contiguous_available() const {
// The largest number of contiguous free words in this or any higher generation.
size_t avail = contiguous_available();
size_t old_avail = 0;
if (GenCollectedHeap::heap()->is_young_gen(this)) {
old_avail = GenCollectedHeap::heap()->old_gen()->contiguous_available();
if (SerialHeap::heap()->is_young_gen(this)) {
old_avail = SerialHeap::heap()->old_gen()->contiguous_available();
}
return MAX2(avail, old_avail);
}
@@ -135,7 +135,7 @@ oop Generation::promote(oop obj, size_t obj_size) {
assert(obj_size == obj->size(), "bad obj_size passed in");

#ifndef PRODUCT
if (GenCollectedHeap::heap()->promotion_should_fail()) {
if (SerialHeap::heap()->promotion_should_fail()) {
return nullptr;
}
#endif // #ifndef PRODUCT
@@ -236,8 +236,6 @@ void Generation::object_iterate(ObjectClosure* cl) {
space_iterate(&blk);
}

#if INCLUDE_SERIALGC

void Generation::prepare_for_compaction(CompactPoint* cp) {
// Generic implementation, can be specialized
ContiguousSpace* space = first_compaction_space();
@@ -268,5 +266,3 @@ void Generation::compact() {
sp = sp->next_compaction_space();
}
}

#endif // INCLUDE_SERIALGC
3 changes: 0 additions & 3 deletions src/hotspot/share/gc/serial/generation.hpp
Original file line number Diff line number Diff line change
@@ -54,7 +54,6 @@ class GenerationSpec;
class ContiguousSpace;
class CompactPoint;
class OopClosure;
class GenCollectedHeap;
class GCStats;

// A "ScratchBlock" represents a block of memory in one generation usable by
@@ -290,14 +289,12 @@ class Generation: public CHeapObj<mtGC> {
GCStats* gc_stats() const { return _gc_stats; }
virtual void update_gc_stats(Generation* current_generation, bool full) {}

#if INCLUDE_SERIALGC
// 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();
#endif

// Accessing "marks".