Skip to content

Commit 65f79c1

Browse files
committed
8347335: ZGC: Use limitless mark stack memory
Reviewed-by: aboldtch, iwalulya
1 parent e410af0 commit 65f79c1

25 files changed

+498
-734
lines changed

src/hotspot/share/gc/z/zAddressSpaceLimit.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,6 @@ static size_t address_space_limit() {
3939
return SIZE_MAX;
4040
}
4141

42-
size_t ZAddressSpaceLimit::mark_stack() {
43-
// Allow mark stacks to occupy 10% of the address space
44-
const size_t limit = address_space_limit() / 10;
45-
return align_up(limit, ZMarkStackSpaceExpandSize);
46-
}
47-
4842
size_t ZAddressSpaceLimit::heap() {
4943
// Allow the heap to occupy 50% of the address space
5044
const size_t limit = address_space_limit() / MaxVirtMemFraction;

src/hotspot/share/gc/z/zAddressSpaceLimit.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
class ZAddressSpaceLimit : public AllStatic {
3131
public:
32-
static size_t mark_stack();
3332
static size_t heap();
3433
};
3534

src/hotspot/share/gc/z/zArguments.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,6 @@ void ZArguments::select_max_gc_threads() {
120120
void ZArguments::initialize() {
121121
GCArguments::initialize();
122122

123-
// Check mark stack size
124-
const size_t mark_stack_space_limit = ZAddressSpaceLimit::mark_stack();
125-
if (ZMarkStackSpaceLimit > mark_stack_space_limit) {
126-
if (!FLAG_IS_DEFAULT(ZMarkStackSpaceLimit)) {
127-
vm_exit_during_initialization("ZMarkStackSpaceLimit too large for limited address space");
128-
}
129-
FLAG_SET_DEFAULT(ZMarkStackSpaceLimit, mark_stack_space_limit);
130-
}
131-
132123
// Enable NUMA by default
133124
if (FLAG_IS_DEFAULT(UseNUMA)) {
134125
FLAG_SET_DEFAULT(UseNUMA, true);

src/hotspot/share/gc/z/zBarrierSet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ void ZBarrierSet::on_thread_attach(Thread* thread) {
101101

102102
void ZBarrierSet::on_thread_detach(Thread* thread) {
103103
// Flush and free any remaining mark stacks
104-
ZHeap::heap()->mark_flush_and_free(thread);
104+
ZHeap::heap()->mark_flush(thread);
105105
}
106106

107107
static void deoptimize_allocation(JavaThread* thread) {

src/hotspot/share/gc/z/zGeneration.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,6 @@ ZGeneration::ZGeneration(ZGenerationId id, ZPageTable* page_table, ZPageAllocato
131131
_stat_relocation(),
132132
_gc_timer(nullptr) {}
133133

134-
bool ZGeneration::is_initialized() const {
135-
return _mark.is_initialized();
136-
}
137-
138134
ZWorkers* ZGeneration::workers() {
139135
return &_workers;
140136
}
@@ -151,8 +147,8 @@ void ZGeneration::threads_do(ThreadClosure* tc) const {
151147
_workers.threads_do(tc);
152148
}
153149

154-
void ZGeneration::mark_flush_and_free(Thread* thread) {
155-
_mark.flush_and_free(thread);
150+
void ZGeneration::mark_flush(Thread* thread) {
151+
_mark.flush(thread);
156152
}
157153

158154
void ZGeneration::mark_free() {

src/hotspot/share/gc/z/zGeneration.hpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ class ZGeneration {
9999
void log_phase_switch(Phase from, Phase to);
100100

101101
public:
102-
bool is_initialized() const;
103-
104102
// GC phases
105103
void set_phase(Phase new_phase);
106104
bool is_phase_relocate() const;
@@ -161,7 +159,7 @@ class ZGeneration {
161159
void mark_object(zaddress addr);
162160
template <bool resurrect, bool gc_thread, bool follow, bool finalizable>
163161
void mark_object_if_active(zaddress addr);
164-
void mark_flush_and_free(Thread* thread);
162+
void mark_flush(Thread* thread);
165163

166164
// Relocation
167165
void synchronize_relocation();

src/hotspot/share/gc/z/zGlobals.hpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -67,17 +67,6 @@ const int ZObjectAlignmentLarge = 1 << ZObjectAlignmentLargeShif
6767
const size_t ZCacheLineSize = ZPlatformCacheLineSize;
6868
#define ZCACHE_ALIGNED ATTRIBUTE_ALIGNED(ZCacheLineSize)
6969

70-
// Mark stack space
71-
const size_t ZMarkStackSpaceExpandSize = (size_t)1 << 25; // 32M
72-
73-
// Mark stack and magazine sizes
74-
const size_t ZMarkStackSizeShift = 11; // 2K
75-
const size_t ZMarkStackSize = (size_t)1 << ZMarkStackSizeShift;
76-
const size_t ZMarkStackHeaderSize = (size_t)1 << 4; // 16B
77-
const size_t ZMarkStackSlots = (ZMarkStackSize - ZMarkStackHeaderSize) / sizeof(uintptr_t);
78-
const size_t ZMarkStackMagazineSize = (size_t)1 << 15; // 32K
79-
const size_t ZMarkStackMagazineSlots = (ZMarkStackMagazineSize / ZMarkStackSize) - 1;
80-
8170
// Mark stripe size
8271
const size_t ZMarkStripeShift = ZGranuleSizeShift;
8372

src/hotspot/share/gc/z/zHeap.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ ZHeap::ZHeap()
6868
assert(_heap == nullptr, "Already initialized");
6969
_heap = this;
7070

71-
if (!_page_allocator.is_initialized() || !_young.is_initialized() || !_old.is_initialized()) {
71+
if (!_page_allocator.is_initialized()) {
7272
return;
7373
}
7474

@@ -271,9 +271,9 @@ void ZHeap::keep_alive(oop obj) {
271271
ZBarrier::mark<ZMark::Resurrect, ZMark::AnyThread, ZMark::Follow, ZMark::Strong>(addr);
272272
}
273273

274-
void ZHeap::mark_flush_and_free(Thread* thread) {
275-
_young.mark_flush_and_free(thread);
276-
_old.mark_flush_and_free(thread);
274+
void ZHeap::mark_flush(Thread* thread) {
275+
_young.mark_flush(thread);
276+
_old.mark_flush(thread);
277277
}
278278

279279
bool ZHeap::is_allocating(zaddress addr) const {

src/hotspot/share/gc/z/zHeap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class ZHeap {
9999
bool is_object_live(zaddress addr) const;
100100
bool is_object_strongly_live(zaddress addr) const;
101101
void keep_alive(oop obj);
102-
void mark_flush_and_free(Thread* thread);
102+
void mark_flush(Thread* thread);
103103

104104
// Page allocation
105105
ZPage* alloc_page(ZPageType type, size_t size, ZAllocationFlags flags, ZPageAge age);

src/hotspot/share/gc/z/zInitialize.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "gc/z/zInitialize.hpp"
3232
#include "gc/z/zJNICritical.hpp"
3333
#include "gc/z/zLargePages.hpp"
34-
#include "gc/z/zMarkStackAllocator.hpp"
3534
#include "gc/z/zNMT.hpp"
3635
#include "gc/z/zNUMA.hpp"
3736
#include "gc/z/zStat.hpp"

0 commit comments

Comments
 (0)