8373335: Serial: Clean up SerialHeap members by access specifies

Reviewed-by: jsikstro
This commit is contained in:
Albert Mingkun Yang 2025-12-10 13:08:12 +00:00
parent b58e3b600b
commit 655e9cda3f
2 changed files with 23 additions and 22 deletions

View File

@ -91,14 +91,16 @@ SerialHeap::SerialHeap() :
CollectedHeap(),
_young_gen(nullptr),
_old_gen(nullptr),
_young_gen_saved_top(nullptr),
_old_gen_saved_top(nullptr),
_rem_set(nullptr),
_gc_policy_counters(new GCPolicyCounters("Copy:MSC", 2, 2)),
_young_manager(nullptr),
_old_manager(nullptr),
_is_heap_almost_full(false),
_eden_pool(nullptr),
_survivor_pool(nullptr),
_old_pool(nullptr) {
_old_pool(nullptr),
_is_heap_almost_full(false) {
_young_manager = new GCMemoryManager("Copy");
_old_manager = new GCMemoryManager("MarkSweepCompact");
GCLocker::initialize();

View File

@ -76,6 +76,8 @@ class SerialHeap : public CollectedHeap {
private:
DefNewGeneration* _young_gen;
TenuredGeneration* _old_gen;
// Used during young-gc
HeapWord* _young_gen_saved_top;
HeapWord* _old_gen_saved_top;
@ -94,6 +96,10 @@ private:
GCMemoryManager* _young_manager;
GCMemoryManager* _old_manager;
MemoryPool* _eden_pool;
MemoryPool* _survivor_pool;
MemoryPool* _old_pool;
// Indicate whether heap is almost or approaching full.
// Usually, there is some memory headroom for application/gc to run properly.
// However, in extreme cases, e.g. young-gen is non-empty after a full gc, we
@ -113,6 +119,19 @@ private:
static void verify_not_in_native_if_java_thread() NOT_DEBUG_RETURN;
// Try to allocate space by expanding the heap.
HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
HeapWord* mem_allocate_cas_noexpand(size_t size, bool is_tlab);
HeapWord* mem_allocate_work(size_t size, bool is_tlab);
void initialize_serviceability() override;
// 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.
void save_marks();
public:
// Returns JNI_OK on success
jint initialize() override;
@ -211,26 +230,6 @@ public:
// generations in a fully generational heap.
CardTableRS* rem_set() { return _rem_set; }
public:
// 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.
void save_marks();
private:
// Try to allocate space by expanding the heap.
HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
HeapWord* mem_allocate_cas_noexpand(size_t size, bool is_tlab);
HeapWord* mem_allocate_work(size_t size, bool is_tlab);
MemoryPool* _eden_pool;
MemoryPool* _survivor_pool;
MemoryPool* _old_pool;
void initialize_serviceability() override;
public:
static SerialHeap* heap();
SerialHeap();