Skip to content

Commit

Permalink
move '_soft_ref_policy' to 'CollectedHeap'
Browse files Browse the repository at this point in the history
  • Loading branch information
LizBing committed Feb 3, 2024
1 parent a18b03b commit d1eff99
Show file tree
Hide file tree
Showing 13 changed files with 5 additions and 46 deletions.
5 changes: 0 additions & 5 deletions src/hotspot/share/gc/epsilon/epsilonHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
class EpsilonHeap : public CollectedHeap {
friend class VMStructs;
private:
SoftRefPolicy _soft_ref_policy;
EpsilonMonitoringSupport* _monitoring_support;
MemoryPool* _pool;
GCMemoryManager _memory_manager;
Expand Down Expand Up @@ -65,10 +64,6 @@ class EpsilonHeap : public CollectedHeap {
return "Epsilon";
}

SoftRefPolicy* soft_ref_policy() override {
return &_soft_ref_policy;
}

jint initialize() override;
void initialize_serviceability() override;

Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/gc/g1/g1CollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,6 @@ G1CollectedHeap::G1CollectedHeap() :
_workers(nullptr),
_card_table(nullptr),
_collection_pause_end(Ticks::now()),
_soft_ref_policy(),
_old_set("Old Region Set", new OldRegionSetChecker()),
_humongous_set("Humongous Region Set", new HumongousRegionSetChecker()),
_bot(nullptr),
Expand Down Expand Up @@ -1526,10 +1525,6 @@ void G1CollectedHeap::ref_processing_init() {
&_is_alive_closure_stw); // is alive closure
}

SoftRefPolicy* G1CollectedHeap::soft_ref_policy() {
return &_soft_ref_policy;
}

size_t G1CollectedHeap::capacity() const {
return _hrm.length() * HeapRegion::GrainBytes;
}
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/g1/g1CollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,6 @@ class G1CollectedHeap : public CollectedHeap {

Ticks _collection_pause_end;

SoftRefPolicy _soft_ref_policy;

static size_t _humongous_object_threshold_in_words;

// These sets keep track of old and humongous regions respectively.
Expand Down Expand Up @@ -927,8 +925,6 @@ class G1CollectedHeap : public CollectedHeap {

inline bool is_collection_set_candidate(const HeapRegion* r) const;

SoftRefPolicy* soft_ref_policy() override;

void initialize_serviceability() override;
MemoryUsage memory_usage() override;
GrowableArray<GCMemoryManager*> memory_managers() override;
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class ParallelScavengeHeap : public CollectedHeap {
static PSAdaptiveSizePolicy* _size_policy;
static PSGCAdaptivePolicyCounters* _gc_policy_counters;

SoftRefPolicy _soft_ref_policy;

unsigned int _death_march_count;

GCMemoryManager* _young_manager;
Expand Down Expand Up @@ -135,8 +133,6 @@ class ParallelScavengeHeap : public CollectedHeap {
return "Parallel";
}

SoftRefPolicy* soft_ref_policy() override { return &_soft_ref_policy; }

GrowableArray<GCMemoryManager*> memory_managers() override;
GrowableArray<MemoryPool*> memory_pools() override;

Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/serial/serialHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ SerialHeap::SerialHeap() :
_young_gen(nullptr),
_old_gen(nullptr),
_rem_set(nullptr),
_soft_ref_policy(),
_gc_policy_counters(new GCPolicyCounters("Copy:MSC", 2, 2)),
_incremental_collection_failed(false),
_young_manager(nullptr),
Expand Down
4 changes: 0 additions & 4 deletions src/hotspot/share/gc/serial/serialHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ class SerialHeap : public CollectedHeap {
// The singleton CardTable Remembered Set.
CardTableRS* _rem_set;

SoftRefPolicy _soft_ref_policy;

GCPolicyCounters* _gc_policy_counters;

// Indicates that the most recent previous incremental collection failed.
Expand Down Expand Up @@ -154,8 +152,6 @@ class SerialHeap : public CollectedHeap {
MemRegion reserved_region() const { return _reserved; }
bool is_in_reserved(const void* addr) const { return _reserved.contains(addr); }

SoftRefPolicy* soft_ref_policy() override { return &_soft_ref_policy; }

// Performance Counter support
GCPolicyCounters* counters() { return _gc_policy_counters; }

Expand Down
6 changes: 4 additions & 2 deletions src/hotspot/share/gc/shared/collectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

#include "gc/shared/gcCause.hpp"
#include "gc/shared/gcWhen.hpp"
#include "gc/shared/softRefPolicy.hpp"
#include "gc/shared/verifyOption.hpp"
#include "memory/allocation.hpp"
#include "memory/metaspace.hpp"
Expand Down Expand Up @@ -56,7 +57,6 @@ class GCMemoryManager;
class MemoryPool;
class MetaspaceSummary;
class ReservedHeapSpace;
class SoftRefPolicy;
class Thread;
class ThreadClosure;
class VirtualSpaceSummary;
Expand Down Expand Up @@ -105,6 +105,8 @@ class CollectedHeap : public CHeapObj<mtGC> {
size_t _capacity_at_last_gc;
size_t _used_at_last_gc;

SoftRefPolicy _soft_ref_policy;

// First, set it to java_lang_Object.
// Then, set it to FillerObject after the FillerObject_klass loading is complete.
static Klass* _filler_object_klass;
Expand Down Expand Up @@ -403,7 +405,7 @@ class CollectedHeap : public CHeapObj<mtGC> {
void increment_total_full_collections() { _total_full_collections++; }

// Return the SoftRefPolicy for the heap;
virtual SoftRefPolicy* soft_ref_policy() = 0;
SoftRefPolicy* soft_ref_policy() { return &_soft_ref_policy; }

virtual MemoryUsage memory_usage();
virtual GrowableArray<GCMemoryManager*> memory_managers() = 0;
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,6 @@ ShenandoahHeap::ShenandoahHeap(ShenandoahCollectorPolicy* policy) :
_stw_memory_manager("Shenandoah Pauses"),
_cycle_memory_manager("Shenandoah Cycles"),
_gc_timer(new ConcurrentGCTimer()),
_soft_ref_policy(),
_log_min_obj_alignment_in_bytes(LogMinObjAlignmentInBytes),
_ref_processor(new ShenandoahReferenceProcessor(MAX2(_max_workers, 1U))),
_marking_context(nullptr),
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,12 @@ class ShenandoahHeap : public CollectedHeap, public ShenandoahSpaceInfo {
GCMemoryManager _stw_memory_manager;
GCMemoryManager _cycle_memory_manager;
ConcurrentGCTimer* _gc_timer;
SoftRefPolicy _soft_ref_policy;

// For exporting to SA
int _log_min_obj_alignment_in_bytes;
public:
ShenandoahMonitoringSupport* monitoring_support() { return _monitoring_support; }
GCMemoryManager* cycle_memory_manager() { return &_cycle_memory_manager; }
GCMemoryManager* stw_memory_manager() { return &_stw_memory_manager; }
SoftRefPolicy* soft_ref_policy() override { return &_soft_ref_policy; }

GrowableArray<GCMemoryManager*> memory_managers() override;
GrowableArray<MemoryPool*> memory_pools() override;
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/share/gc/x/xCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ XCollectedHeap* XCollectedHeap::heap() {
}

XCollectedHeap::XCollectedHeap() :
_soft_ref_policy(),
_barrier_set(),
_initialize(&_barrier_set),
_heap(),
Expand Down Expand Up @@ -95,10 +94,6 @@ void XCollectedHeap::stop() {
gc_threads_do(&cl);
}

SoftRefPolicy* XCollectedHeap::soft_ref_policy() {
return &_soft_ref_policy;
}

size_t XCollectedHeap::max_capacity() const {
return _heap.max_capacity();
}
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/gc/x/xCollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class XCollectedHeap : public CollectedHeap {
friend class ::VMStructs;

private:
SoftRefPolicy _soft_ref_policy;
XBarrierSet _barrier_set;
XInitialize _initialize;
XHeap _heap;
Expand All @@ -65,8 +64,6 @@ class XCollectedHeap : public CollectedHeap {
void initialize_serviceability() override;
void stop() override;

SoftRefPolicy* soft_ref_policy() override;

size_t max_capacity() const override;
size_t capacity() const override;
size_t used() const override;
Expand Down
7 changes: 1 addition & 6 deletions src/hotspot/share/gc/z/zCollectedHeap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ ZCollectedHeap* ZCollectedHeap::heap() {
}

ZCollectedHeap::ZCollectedHeap()
: _soft_ref_policy(),
_barrier_set(),
: _barrier_set(),
_initialize(&_barrier_set),
_heap(),
_driver_minor(new ZDriverMinor()),
Expand Down Expand Up @@ -106,10 +105,6 @@ void ZCollectedHeap::stop() {
gc_threads_do(&cl);
}

SoftRefPolicy* ZCollectedHeap::soft_ref_policy() {
return &_soft_ref_policy;
}

size_t ZCollectedHeap::max_capacity() const {
return _heap.max_capacity();
}
Expand Down
3 changes: 0 additions & 3 deletions src/hotspot/share/gc/z/zCollectedHeap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class ZCollectedHeap : public CollectedHeap {
friend class VMStructs;

private:
SoftRefPolicy _soft_ref_policy;
ZBarrierSet _barrier_set;
ZInitialize _initialize;
ZHeap _heap;
Expand All @@ -66,8 +65,6 @@ class ZCollectedHeap : public CollectedHeap {
void initialize_serviceability() override;
void stop() override;

SoftRefPolicy* soft_ref_policy() override;

size_t max_capacity() const override;
size_t capacity() const override;
size_t used() const override;
Expand Down

0 comments on commit d1eff99

Please sign in to comment.