Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8242212: Shenandoah: initialize ShenandoahHeuristics::_region_data ea…
…gerly
Reviewed-by: rkennke
- Loading branch information
|
@@ -144,8 +144,6 @@ class ShenandoahPretouchBitmapTask : public AbstractGangTask { |
|
|
}; |
|
|
|
|
|
jint ShenandoahHeap::initialize() { |
|
|
initialize_heuristics(); |
|
|
|
|
|
// |
|
|
// Figure out heap sizing |
|
|
// |
|
@@ -167,6 +165,9 @@ jint ShenandoahHeap::initialize() { |
|
|
|
|
|
_num_regions = ShenandoahHeapRegion::region_count(); |
|
|
|
|
|
// Now we know the number of regions, initialize the heuristics. |
|
|
initialize_heuristics(); |
|
|
|
|
|
size_t num_committed_regions = init_byte_size / reg_size_bytes; |
|
|
num_committed_regions = MIN2(num_committed_regions, _num_regions); |
|
|
assert(num_committed_regions <= _num_regions, "sanity"); |
|
|
|
@@ -44,7 +44,6 @@ int ShenandoahHeuristics::compare_by_garbage(RegionData a, RegionData b) { |
|
|
|
|
|
ShenandoahHeuristics::ShenandoahHeuristics() : |
|
|
_region_data(NULL), |
|
|
_region_data_size(0), |
|
|
_degenerated_cycles_in_a_row(0), |
|
|
_successful_cycles_in_a_row(0), |
|
|
_bytes_in_cset(0), |
|
@@ -59,26 +58,15 @@ ShenandoahHeuristics::ShenandoahHeuristics() : |
|
|
if (!ClassUnloadingWithConcurrentMark) { |
|
|
FLAG_SET_DEFAULT(ShenandoahUnloadClassesFrequency, 0); |
|
|
} |
|
|
} |
|
|
|
|
|
ShenandoahHeuristics::~ShenandoahHeuristics() { |
|
|
if (_region_data != NULL) { |
|
|
FREE_C_HEAP_ARRAY(RegionGarbage, _region_data); |
|
|
} |
|
|
size_t num_regions = ShenandoahHeap::heap()->num_regions(); |
|
|
assert(num_regions > 0, "Sanity"); |
|
|
|
|
|
_region_data = NEW_C_HEAP_ARRAY(RegionData, num_regions, mtGC); |
|
|
} |
|
|
|
|
|
ShenandoahHeuristics::RegionData* ShenandoahHeuristics::get_region_data_cache(size_t num) { |
|
|
RegionData* res = _region_data; |
|
|
if (res == NULL) { |
|
|
res = NEW_C_HEAP_ARRAY(RegionData, num, mtGC); |
|
|
_region_data = res; |
|
|
_region_data_size = num; |
|
|
} else if (_region_data_size < num) { |
|
|
res = REALLOC_C_HEAP_ARRAY(RegionData, _region_data, num, mtGC); |
|
|
_region_data = res; |
|
|
_region_data_size = num; |
|
|
} |
|
|
return res; |
|
|
ShenandoahHeuristics::~ShenandoahHeuristics() { |
|
|
FREE_C_HEAP_ARRAY(RegionGarbage, _region_data); |
|
|
} |
|
|
|
|
|
void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collection_set) { |
|
@@ -93,7 +81,7 @@ void ShenandoahHeuristics::choose_collection_set(ShenandoahCollectionSet* collec |
|
|
|
|
|
size_t num_regions = heap->num_regions(); |
|
|
|
|
|
RegionData* candidates = get_region_data_cache(num_regions); |
|
|
RegionData* candidates = _region_data; |
|
|
|
|
|
size_t cand_idx = 0; |
|
|
|
|
|
|
@@ -78,7 +78,6 @@ class ShenandoahHeuristics : public CHeapObj<mtGC> { |
|
|
} RegionData; |
|
|
|
|
|
RegionData* _region_data; |
|
|
size_t _region_data_size; |
|
|
|
|
|
uint _degenerated_cycles_in_a_row; |
|
|
uint _successful_cycles_in_a_row; |
|
@@ -97,8 +96,6 @@ class ShenandoahHeuristics : public CHeapObj<mtGC> { |
|
|
|
|
|
static int compare_by_garbage(RegionData a, RegionData b); |
|
|
|
|
|
RegionData* get_region_data_cache(size_t num); |
|
|
|
|
|
virtual void choose_collection_set_from_regiondata(ShenandoahCollectionSet* set, |
|
|
RegionData* data, size_t data_size, |
|
|
size_t free) = 0; |
|
|