8221260: Initialize more class members on construction, remove some unused ones
Reviewed-by: kbarrett, tschatzl
--- a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -205,8 +205,10 @@
MemoryType type) :
G1RegionToSpaceMapper(rs, actual_size, page_size, alloc_granularity, commit_factor, type),
_rs(rs),
+ _dram_mapper(NULL),
_num_committed_dram(0),
_num_committed_nvdimm(0),
+ _start_index_of_dram(0),
_page_size(page_size),
_commit_factor(commit_factor),
_type(type) {
@@ -248,7 +250,6 @@
_dram_mapper = new G1RegionsSmallerThanCommitSizeMapper(rs_dram, rs_dram.size(), _page_size, _region_granularity, _commit_factor, _type);
}
- _start_index_of_nvdimm = 0;
_start_index_of_dram = (uint)(rs_nvdimm.size() / _region_granularity);
return true;
}
--- a/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/g1/g1RegionToSpaceMapper.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -101,12 +101,10 @@
// part of space is mapped to dram and part to nv-dimm
class G1RegionToHeteroSpaceMapper : public G1RegionToSpaceMapper {
private:
- size_t _pages_per_region;
ReservedSpace _rs;
G1RegionToSpaceMapper* _dram_mapper;
uint _num_committed_dram;
uint _num_committed_nvdimm;
- uint _start_index_of_nvdimm;
uint _start_index_of_dram;
size_t _page_size;
size_t _commit_factor;
--- a/src/hotspot/share/gc/parallel/adjoiningGenerations.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/adjoiningGenerations.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -119,7 +119,7 @@
}
}
-AdjoiningGenerations::AdjoiningGenerations() { }
+AdjoiningGenerations::AdjoiningGenerations(): _young_gen(NULL), _old_gen(NULL), _virtual_spaces(NULL) { }
size_t AdjoiningGenerations::reserved_byte_size() {
return virtual_spaces()->reserved_space().size();
--- a/src/hotspot/share/gc/parallel/adjoiningGenerations.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/adjoiningGenerations.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -50,6 +50,7 @@
bool request_young_gen_expansion(size_t desired_change_in_bytes);
protected:
+ AdjoiningGenerations();
// The young generation and old generation, respectively
PSYoungGen* _young_gen;
PSOldGen* _old_gen;
@@ -59,7 +60,6 @@
public:
AdjoiningGenerations(ReservedSpace rs, GenerationSizer* policy, size_t alignment);
- AdjoiningGenerations();
// Accessors
PSYoungGen* young_gen() { return _young_gen; }
--- a/src/hotspot/share/gc/parallel/gcTaskThread.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/gcTaskThread.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -167,7 +167,6 @@
// so that a task can complete without waiting for idle tasks.
// They have to be terminated separately.
IdleGCTask::destroy((IdleGCTask*)task);
- set_is_working(true);
}
// Check if we should release our inner resources.
--- a/src/hotspot/share/gc/parallel/gcTaskThread.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/gcTaskThread.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -47,8 +47,6 @@
GCTaskTimeStamp* time_stamp_at(uint index);
void add_task_timestamp(const char* name, jlong t_entry, jlong t_exit);
- bool _is_working; // True if participating in GC tasks
-
// Factory create and destroy methods.
static GCTaskThread* create(GCTaskManager* manager,
uint which,
@@ -85,7 +83,6 @@
uint processor_id() const {
return _processor_id;
}
- void set_is_working(bool v) { _is_working = v; }
};
class GCTaskTimeStamp : public CHeapObj<mtGC>
--- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -93,7 +93,15 @@
public:
ParallelScavengeHeap(GenerationSizer* policy) :
- CollectedHeap(), _collector_policy(policy), _death_march_count(0) { }
+ CollectedHeap(),
+ _collector_policy(policy),
+ _gens(NULL),
+ _death_march_count(0),
+ _young_manager(NULL),
+ _old_manager(NULL),
+ _eden_pool(NULL),
+ _survivor_pool(NULL),
+ _old_pool(NULL) { }
// For use by VM operations
enum CollectionType {
--- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -49,34 +49,25 @@
init_survivor_size,
gc_pause_goal_sec,
gc_cost_ratio),
+ _avg_major_pause(new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding)),
+ _avg_base_footprint(new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight)),
+ _gc_stats(),
_collection_cost_margin_fraction(AdaptiveSizePolicyCollectionCostMargin / 100.0),
+ _major_pause_old_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)),
+ _major_pause_young_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)),
_latest_major_mutator_interval_seconds(0),
_space_alignment(space_alignment),
_gc_minor_pause_goal_sec(gc_minor_pause_goal_sec),
_live_at_last_full_gc(init_promo_size),
- _young_gen_change_for_major_pause_count(0)
+ _change_old_gen_for_min_pauses(0),
+ _change_young_gen_for_maj_pauses(0),
+ _old_gen_policy_is_ready(false),
+ _young_gen_size_increment_supplement(YoungGenerationSizeSupplement),
+ _old_gen_size_increment_supplement(TenuredGenerationSizeSupplement),
+ _bytes_absorbed_from_eden(0)
{
- // Sizing policy statistics
- _avg_major_pause =
- new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding);
- _avg_minor_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
- _avg_major_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
-
- _avg_base_footprint = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight);
- _major_pause_old_estimator =
- new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
- _major_pause_young_estimator =
- new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
- _major_collection_estimator =
- new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
-
- _young_gen_size_increment_supplement = YoungGenerationSizeSupplement;
- _old_gen_size_increment_supplement = TenuredGenerationSizeSupplement;
-
// Start the timers
_major_timer.start();
-
- _old_gen_policy_is_ready = false;
}
size_t PSAdaptiveSizePolicy::calculate_free_based_on_live(size_t live, uintx ratio_as_percentage) {
--- a/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psAdaptiveSizePolicy.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -75,7 +75,6 @@
// Statistical data gathered for GC
GCStats _gc_stats;
- size_t _survivor_size_limit; // Limit in bytes of survivor size
const double _collection_cost_margin_fraction;
// Variable for estimating the major and minor pause times.
@@ -111,13 +110,6 @@
// Flag indicating that the adaptive policy is ready to use
bool _old_gen_policy_is_ready;
- // Changing the generation sizing depends on the data that is
- // gathered about the effects of changes on the pause times and
- // throughput. These variable count the number of data points
- // gathered. The policy may use these counters as a threshold
- // for reliable data.
- julong _young_gen_change_for_major_pause_count;
-
// To facilitate faster growth at start up, supplement the normal
// growth percentage for the young gen eden and the
// old gen space for promotion with these value which decay
--- a/src/hotspot/share/gc/parallel/psFileBackedVirtualspace.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psFileBackedVirtualspace.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -51,10 +51,6 @@
return true;
}
-PSFileBackedVirtualSpace::PSFileBackedVirtualSpace(ReservedSpace rs, const char* path) {
- PSFileBackedVirtualSpace(rs, os::vm_page_size(), path);
-}
-
bool PSFileBackedVirtualSpace::expand_by(size_t bytes) {
assert(special(), "Since entire space is committed at initialization, _special should always be true for PSFileBackedVirtualSpace");
--- a/src/hotspot/share/gc/parallel/psFileBackedVirtualspace.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psFileBackedVirtualspace.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -34,7 +34,6 @@
bool _mapping_succeeded;
public:
PSFileBackedVirtualSpace(ReservedSpace rs, size_t alignment, const char* file_path);
- PSFileBackedVirtualSpace(ReservedSpace rs, const char* file_path);
bool initialize();
bool expand_by(size_t bytes);
--- a/src/hotspot/share/gc/parallel/psMarkSweepDecorator.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psMarkSweepDecorator.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -52,7 +52,11 @@
public:
PSMarkSweepDecorator(MutableSpace* space, ObjectStartArray* start_array,
size_t allowed_dead_ratio) :
- _space(space), _start_array(start_array),
+ _space(space),
+ _start_array(start_array),
+ _first_dead(NULL),
+ _end_of_live(NULL),
+ _compaction_top(NULL),
_allowed_dead_ratio(allowed_dead_ratio) { }
// During a compacting collection, we need to collapse objects into
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -406,19 +406,16 @@
size_t mark_bitmap_size;
#endif // #ifdef ASSERT
-ParallelCompactData::ParallelCompactData()
-{
- _region_start = 0;
-
- _region_vspace = 0;
- _reserved_byte_size = 0;
- _region_data = 0;
- _region_count = 0;
-
- _block_vspace = 0;
- _block_data = 0;
- _block_count = 0;
-}
+ParallelCompactData::ParallelCompactData() :
+ _region_start(NULL),
+ DEBUG_ONLY(_region_end(NULL) COMMA)
+ _region_vspace(NULL),
+ _reserved_byte_size(0),
+ _region_data(NULL),
+ _region_count(0),
+ _block_vspace(NULL),
+ _block_data(NULL),
+ _block_count(0) {}
bool ParallelCompactData::initialize(MemRegion covered_region)
{
--- a/src/hotspot/share/gc/parallel/psVirtualspace.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psVirtualspace.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,13 @@
}
// Deprecated.
-PSVirtualSpace::PSVirtualSpace(): _alignment(os::vm_page_size()) {
+PSVirtualSpace::PSVirtualSpace():
+ _alignment(os::vm_page_size()),
+ _reserved_low_addr(NULL),
+ _reserved_high_addr(NULL),
+ _committed_low_addr(NULL),
+ _committed_high_addr(NULL),
+ _special(false) {
}
// Deprecated.
--- a/src/hotspot/share/gc/parallel/psVirtualspace.hpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psVirtualspace.hpp Mon Mar 25 14:46:55 2019 +0100
@@ -64,7 +64,14 @@
// Eventually all instances should be created with the above 1- or 2-arg
// constructors. Then the 1st constructor below should become protected and
// the 2nd ctor and initialize() removed.
- PSVirtualSpace(size_t alignment): _alignment(alignment) { }
+ PSVirtualSpace(size_t alignment):
+ _alignment(alignment),
+ _reserved_low_addr(NULL),
+ _reserved_high_addr(NULL),
+ _committed_low_addr(NULL),
+ _committed_high_addr(NULL),
+ _special(false) {
+ }
PSVirtualSpace();
bool initialize(ReservedSpace rs, size_t commit_size);
--- a/src/hotspot/share/gc/parallel/psYoungGen.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/parallel/psYoungGen.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -35,12 +35,22 @@
#include "runtime/java.hpp"
#include "utilities/align.hpp"
-PSYoungGen::PSYoungGen(size_t initial_size,
- size_t min_size,
- size_t max_size) :
+PSYoungGen::PSYoungGen(size_t initial_size, size_t min_size, size_t max_size) :
+ _reserved(),
+ _virtual_space(NULL),
+ _eden_space(NULL),
+ _from_space(NULL),
+ _to_space(NULL),
+ _eden_mark_sweep(NULL),
+ _from_mark_sweep(NULL),
+ _to_mark_sweep(NULL),
_init_gen_size(initial_size),
_min_gen_size(min_size),
- _max_gen_size(max_size)
+ _max_gen_size(max_size),
+ _gen_counters(NULL),
+ _eden_counters(NULL),
+ _from_counters(NULL),
+ _to_counters(NULL)
{}
void PSYoungGen::initialize_virtual_space(ReservedSpace rs, size_t alignment) {
--- a/src/hotspot/share/gc/shared/adaptiveSizePolicy.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/shared/adaptiveSizePolicy.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -48,40 +48,38 @@
_eden_size(init_eden_size),
_promo_size(init_promo_size),
_survivor_size(init_survivor_size),
+ _avg_minor_pause(new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding)),
+ _avg_minor_interval(new AdaptiveWeightedAverage(AdaptiveTimeWeight)),
+ _avg_minor_gc_cost(new AdaptiveWeightedAverage(AdaptiveTimeWeight)),
+ _avg_major_interval(new AdaptiveWeightedAverage(AdaptiveTimeWeight)),
+ _avg_major_gc_cost(new AdaptiveWeightedAverage(AdaptiveTimeWeight)),
+ _avg_young_live(new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight)),
+ _avg_eden_live(new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight)),
+ _avg_old_live(new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight)),
+ _avg_survived(new AdaptivePaddedAverage(AdaptiveSizePolicyWeight, SurvivorPadding)),
+ _avg_pretenured(new AdaptivePaddedNoZeroDevAverage(AdaptiveSizePolicyWeight, SurvivorPadding)),
+ _minor_pause_old_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)),
+ _minor_pause_young_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)),
+ _minor_collection_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)),
+ _major_collection_estimator(new LinearLeastSquareFit(AdaptiveSizePolicyWeight)),
_latest_minor_mutator_interval_seconds(0),
_threshold_tolerance_percent(1.0 + ThresholdTolerance/100.0),
_gc_pause_goal_sec(gc_pause_goal_sec),
+ _young_gen_policy_is_ready(false),
+ _change_young_gen_for_min_pauses(0),
+ _change_old_gen_for_maj_pauses(0),
+ _change_old_gen_for_throughput(0),
+ _change_young_gen_for_throughput(0),
+ _increment_tenuring_threshold_for_gc_cost(false),
+ _decrement_tenuring_threshold_for_gc_cost(false),
+ _decrement_tenuring_threshold_for_survivor_limit(false),
+ _decrease_for_footprint(0),
+ _decide_at_full_gc(0),
_young_gen_change_for_minor_throughput(0),
_old_gen_change_for_major_throughput(0) {
- _avg_minor_pause =
- new AdaptivePaddedAverage(AdaptiveTimeWeight, PausePadding);
- _avg_minor_interval = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
- _avg_minor_gc_cost = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
- _avg_major_gc_cost = new AdaptiveWeightedAverage(AdaptiveTimeWeight);
-
- _avg_young_live = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight);
- _avg_old_live = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight);
- _avg_eden_live = new AdaptiveWeightedAverage(AdaptiveSizePolicyWeight);
-
- _avg_survived = new AdaptivePaddedAverage(AdaptiveSizePolicyWeight,
- SurvivorPadding);
- _avg_pretenured = new AdaptivePaddedNoZeroDevAverage(
- AdaptiveSizePolicyWeight,
- SurvivorPadding);
-
- _minor_pause_old_estimator =
- new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
- _minor_pause_young_estimator =
- new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
- _minor_collection_estimator =
- new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
- _major_collection_estimator =
- new LinearLeastSquareFit(AdaptiveSizePolicyWeight);
// Start the timers
_minor_timer.start();
-
- _young_gen_policy_is_ready = false;
}
bool AdaptiveSizePolicy::tenuring_threshold_change() const {
--- a/src/hotspot/share/gc/shared/gcStats.cpp Mon Mar 25 15:37:06 2019 +0100
+++ b/src/hotspot/share/gc/shared/gcStats.cpp Mon Mar 25 14:46:55 2019 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,4 @@
#include "gc/shared/gcStats.hpp"
#include "gc/shared/gcUtil.inline.hpp"
-GCStats::GCStats() {
- _avg_promoted = new AdaptivePaddedNoZeroDevAverage(
- AdaptiveSizePolicyWeight,
- PromotedPadding);
-}
+GCStats::GCStats() : _avg_promoted(new AdaptivePaddedNoZeroDevAverage(AdaptiveSizePolicyWeight, PromotedPadding)) {}