Skip to content

Commit 47ed1a8

Browse files
committed
8368213: ZGC: Cleanup dead code, unimplemented declarations, unused private fields
Reviewed-by: stefank, jsikstro
1 parent 7ed72d9 commit 47ed1a8

File tree

9 files changed

+10
-45
lines changed

9 files changed

+10
-45
lines changed

src/hotspot/share/gc/shared/gcThreadLocalData.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,6 @@
4040
// should consider placing frequently accessed fields first in
4141
// T, so that field offsets relative to Thread are small, which
4242
// often allows for a more compact instruction encoding.
43-
typedef uint64_t GCThreadLocalData[43]; // 344 bytes
43+
typedef uint64_t GCThreadLocalData[40]; // 320 bytes
4444

4545
#endif // SHARE_GC_SHARED_GCTHREADLOCALDATA_HPP

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,6 @@ typedef zpointer (*ZBarrierColor)(zaddress, zpointer);
7171

7272
class ZGeneration;
7373

74-
void z_assert_is_barrier_safe();
75-
7674
class ZBarrier : public AllStatic {
7775
friend class ZContinuation;
7876
friend class ZStoreBarrierBuffer;

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

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,7 @@ static bool is_young_small(const ZDirectorStats& stats) {
306306
return young_used_percent <= 5.0;
307307
}
308308

309-
template <typename PrintFn = void(*)(size_t, double)>
310-
static bool is_high_usage(const ZDirectorStats& stats, PrintFn* print_function = nullptr) {
309+
static bool is_high_usage(const ZDirectorStats& stats, bool log = false) {
311310
// Calculate amount of free memory available. Note that we take the
312311
// relocation headroom into account to avoid in-place relocation.
313312
const size_t soft_max_capacity = stats._heap._soft_max_heap_size;
@@ -316,8 +315,9 @@ static bool is_high_usage(const ZDirectorStats& stats, PrintFn* print_function =
316315
const size_t free = free_including_headroom - MIN2(free_including_headroom, ZHeuristics::relocation_headroom());
317316
const double free_percent = percent_of(free, soft_max_capacity);
318317

319-
if (print_function != nullptr) {
320-
(*print_function)(free, free_percent);
318+
if (log) {
319+
log_debug(gc, director)("Rule Minor: High Usage, Free: %zuMB(%.1f%%)",
320+
free / M, free_percent);
321321
}
322322

323323
// The heap has high usage if there is less than 5% free memory left
@@ -377,19 +377,7 @@ static bool rule_minor_high_usage(const ZDirectorStats& stats) {
377377
// such that the allocation rate rule doesn't trigger, but the amount of free
378378
// memory is still slowly but surely heading towards zero. In this situation,
379379
// we start a GC cycle to avoid a potential allocation stall later.
380-
381-
const size_t soft_max_capacity = stats._heap._soft_max_heap_size;
382-
const size_t used = stats._heap._used;
383-
const size_t free_including_headroom = soft_max_capacity - MIN2(soft_max_capacity, used);
384-
const size_t free = free_including_headroom - MIN2(free_including_headroom, ZHeuristics::relocation_headroom());
385-
const double free_percent = percent_of(free, soft_max_capacity);
386-
387-
auto print_function = [&](size_t free, double free_percent) {
388-
log_debug(gc, director)("Rule Minor: High Usage, Free: %zuMB(%.1f%%)",
389-
free / M, free_percent);
390-
};
391-
392-
return is_high_usage(stats, &print_function);
380+
return is_high_usage(stats, true /* log */);
393381
}
394382

395383
// Major GC rules

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,11 @@ uint ZGenerationYoung::compute_tenuring_threshold(ZRelocationSetSelectorStats st
701701
double young_life_expectancy_sum = 0.0;
702702
uint young_life_expectancy_samples = 0;
703703
uint last_populated_age = 0;
704-
size_t last_populated_live = 0;
705704

706705
for (ZPageAge age : ZPageAgeRangeAll) {
707706
const size_t young_live = stats.small(age).live() + stats.medium(age).live() + stats.large(age).live();
708707
if (young_live > 0) {
709708
last_populated_age = untype(age);
710-
last_populated_live = young_live;
711709
if (young_live_last > 0) {
712710
young_life_expectancy_sum += double(young_live) / double(young_live_last);
713711
young_life_expectancy_samples++;
@@ -721,7 +719,6 @@ uint ZGenerationYoung::compute_tenuring_threshold(ZRelocationSetSelectorStats st
721719
return 0;
722720
}
723721

724-
const size_t young_used_at_mark_start = ZGeneration::young()->stat_heap()->used_generation_at_mark_start();
725722
const size_t young_garbage = ZGeneration::young()->stat_heap()->garbage_at_mark_end();
726723
const size_t young_allocated = ZGeneration::young()->stat_heap()->allocated_at_mark_end();
727724
const size_t soft_max_capacity = ZHeap::heap()->soft_max_capacity();

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ class ZGeneration {
8787

8888
void free_empty_pages(ZRelocationSetSelector* selector, int bulk);
8989
void flip_age_pages(const ZRelocationSetSelector* selector);
90-
void flip_age_pages(const ZArray<ZPage*>* pages);
9190

9291
void mark_free();
9392

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

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,6 @@ typedef ClaimingCLDToOopClosure<ClassLoaderData::_claim_strong> ZMarkOldCLDClosu
789789

790790
class ZMarkOldRootsTask : public ZTask {
791791
private:
792-
ZMark* const _mark;
793792
ZRootsIteratorStrongColored _roots_colored;
794793
ZRootsIteratorStrongUncolored _roots_uncolored;
795794

@@ -800,9 +799,8 @@ class ZMarkOldRootsTask : public ZTask {
800799
ZMarkNMethodClosure _nm_cl;
801800

802801
public:
803-
ZMarkOldRootsTask(ZMark* mark)
802+
ZMarkOldRootsTask()
804803
: ZTask("ZMarkOldRootsTask"),
805-
_mark(mark),
806804
_roots_colored(ZGenerationIdOptional::old),
807805
_roots_uncolored(ZGenerationIdOptional::old),
808806
_cl_colored(),
@@ -847,7 +845,6 @@ class ZMarkYoungCLDClosure : public ClaimingCLDToOopClosure<ClassLoaderData::_cl
847845

848846
class ZMarkYoungRootsTask : public ZTask {
849847
private:
850-
ZMark* const _mark;
851848
ZRootsIteratorAllColored _roots_colored;
852849
ZRootsIteratorAllUncolored _roots_uncolored;
853850

@@ -858,9 +855,8 @@ class ZMarkYoungRootsTask : public ZTask {
858855
ZMarkYoungNMethodClosure _nm_cl;
859856

860857
public:
861-
ZMarkYoungRootsTask(ZMark* mark)
858+
ZMarkYoungRootsTask()
862859
: ZTask("ZMarkYoungRootsTask"),
863-
_mark(mark),
864860
_roots_colored(ZGenerationIdOptional::young),
865861
_roots_uncolored(ZGenerationIdOptional::young),
866862
_cl_colored(),
@@ -928,13 +924,13 @@ void ZMark::resize_workers(uint nworkers) {
928924

929925
void ZMark::mark_young_roots() {
930926
SuspendibleThreadSetJoiner sts_joiner;
931-
ZMarkYoungRootsTask task(this);
927+
ZMarkYoungRootsTask task;
932928
workers()->run(&task);
933929
}
934930

935931
void ZMark::mark_old_roots() {
936932
SuspendibleThreadSetJoiner sts_joiner;
937-
ZMarkOldRootsTask task(this);
933+
ZMarkOldRootsTask task;
938934
workers()->run(&task);
939935
}
940936

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

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ class ZNMethodTable : public AllStatic {
4343
static ZNMethodTableIteration _iteration_secondary;
4444
static ZSafeDelete<ZNMethodTableEntry[]> _safe_delete;
4545

46-
static ZNMethodTableEntry* create(size_t size);
47-
static void destroy(ZNMethodTableEntry* table);
48-
4946
static size_t first_index(const nmethod* nm, size_t size);
5047
static size_t next_index(size_t prev_index, size_t size);
5148

@@ -67,9 +64,6 @@ class ZNMethodTable : public AllStatic {
6764
static void nmethods_do_begin(bool secondary);
6865
static void nmethods_do_end(bool secondary);
6966
static void nmethods_do(bool secondary, NMethodClosure* cl);
70-
71-
static void unlink(ZWorkers* workers, bool unloading_occurred);
72-
static void purge(ZWorkers* workers);
7367
};
7468

7569
#endif // SHARE_GC_Z_ZNMETHODTABLE_HPP

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

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,7 +1060,6 @@ void ZPartition::commit_increased_capacity(ZMemoryAllocation* allocation, const
10601060

10611061
const size_t already_committed = allocation->harvested();
10621062

1063-
const ZVirtualMemory already_committed_vmem = vmem.first_part(already_committed);
10641063
const ZVirtualMemory to_be_committed_vmem = vmem.last_part(already_committed);
10651064

10661065
// Try to commit the uncommitted physical memory
@@ -1422,7 +1421,6 @@ ZPage* ZPageAllocator::alloc_page(ZPageType type, size_t size, ZAllocationFlags
14221421
const ZPageAllocationStats stats = allocation.stats();
14231422
const int num_harvested_vmems = stats._num_harvested_vmems;
14241423
const size_t harvested = stats._total_harvested;
1425-
const size_t committed = stats._total_committed_capacity;
14261424

14271425
if (harvested > 0) {
14281426
ZStatInc(ZCounterMappedCacheHarvest, harvested);
@@ -1963,9 +1961,6 @@ void ZPageAllocator::cleanup_failed_commit_multi_partition(ZMultiPartitionAlloca
19631961
continue;
19641962
}
19651963

1966-
// Remove the harvested part
1967-
const ZVirtualMemory non_harvest_vmem = partial_vmem.last_part(allocation->harvested());
1968-
19691964
ZArray<ZVirtualMemory>* const partial_vmems = allocation->partial_vmems();
19701965

19711966
// Keep track of the start index

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ class ZThreadLocalData {
3939
uintptr_t _mark_bad_mask;
4040
uintptr_t _store_good_mask;
4141
uintptr_t _store_bad_mask;
42-
uintptr_t _uncolor_mask;
4342
uintptr_t _nmethod_disarmed;
4443
ZStoreBarrierBuffer* _store_barrier_buffer;
4544
ZMarkThreadLocalStacks _mark_stacks[2];
@@ -51,7 +50,6 @@ class ZThreadLocalData {
5150
_mark_bad_mask(0),
5251
_store_good_mask(0),
5352
_store_bad_mask(0),
54-
_uncolor_mask(0),
5553
_nmethod_disarmed(0),
5654
_store_barrier_buffer(new ZStoreBarrierBuffer()),
5755
_mark_stacks(),

0 commit comments

Comments
 (0)