8327022: Parallel: Remove experimental dense prefix calculation
Reviewed-by: shade, ayang, gli
This commit is contained in:
parent
a065eba56d
commit
5b75199769
src/hotspot/share/gc/parallel
@ -1044,142 +1044,6 @@ void PSParallelCompact::post_compact()
|
||||
Universe::heap()->record_whole_heap_examined_timestamp();
|
||||
}
|
||||
|
||||
HeapWord*
|
||||
PSParallelCompact::compute_dense_prefix_via_density(const SpaceId id,
|
||||
bool maximum_compaction)
|
||||
{
|
||||
const size_t region_size = ParallelCompactData::RegionSize;
|
||||
const ParallelCompactData& sd = summary_data();
|
||||
|
||||
const MutableSpace* const space = _space_info[id].space();
|
||||
HeapWord* const top_aligned_up = sd.region_align_up(space->top());
|
||||
const RegionData* const beg_cp = sd.addr_to_region_ptr(space->bottom());
|
||||
const RegionData* const end_cp = sd.addr_to_region_ptr(top_aligned_up);
|
||||
|
||||
// Skip full regions at the beginning of the space--they are necessarily part
|
||||
// of the dense prefix.
|
||||
size_t full_count = 0;
|
||||
const RegionData* cp;
|
||||
for (cp = beg_cp; cp < end_cp && cp->data_size() == region_size; ++cp) {
|
||||
++full_count;
|
||||
}
|
||||
|
||||
const uint total_invocations = ParallelScavengeHeap::heap()->total_full_collections();
|
||||
assert(total_invocations >= _maximum_compaction_gc_num, "sanity");
|
||||
const size_t gcs_since_max = total_invocations - _maximum_compaction_gc_num;
|
||||
const bool interval_ended = gcs_since_max > HeapMaximumCompactionInterval;
|
||||
if (maximum_compaction || cp == end_cp || interval_ended) {
|
||||
_maximum_compaction_gc_num = total_invocations;
|
||||
return sd.region_to_addr(cp);
|
||||
}
|
||||
|
||||
HeapWord* const new_top = _space_info[id].new_top();
|
||||
const size_t space_live = pointer_delta(new_top, space->bottom());
|
||||
const size_t space_used = space->used_in_words();
|
||||
const size_t space_capacity = space->capacity_in_words();
|
||||
|
||||
const double cur_density = double(space_live) / space_capacity;
|
||||
const double deadwood_density =
|
||||
(1.0 - cur_density) * (1.0 - cur_density) * cur_density * cur_density;
|
||||
const size_t deadwood_goal = size_t(space_capacity * deadwood_density);
|
||||
|
||||
log_develop_debug(gc, compaction)(
|
||||
"cur_dens=%5.3f dw_dens=%5.3f dw_goal=" SIZE_FORMAT,
|
||||
cur_density, deadwood_density, deadwood_goal);
|
||||
log_develop_debug(gc, compaction)(
|
||||
"space_live=" SIZE_FORMAT " space_used=" SIZE_FORMAT " "
|
||||
"space_cap=" SIZE_FORMAT,
|
||||
space_live, space_used,
|
||||
space_capacity);
|
||||
|
||||
// XXX - Use binary search?
|
||||
HeapWord* dense_prefix = sd.region_to_addr(cp);
|
||||
const RegionData* full_cp = cp;
|
||||
const RegionData* const top_cp = sd.addr_to_region_ptr(space->top() - 1);
|
||||
while (cp < end_cp) {
|
||||
HeapWord* region_destination = cp->destination();
|
||||
const size_t cur_deadwood = pointer_delta(dense_prefix, region_destination);
|
||||
|
||||
log_develop_trace(gc, compaction)(
|
||||
"c#=" SIZE_FORMAT_W(4) " dst=" PTR_FORMAT " "
|
||||
"dp=" PTR_FORMAT " cdw=" SIZE_FORMAT_W(8),
|
||||
sd.region(cp), p2i(region_destination),
|
||||
p2i(dense_prefix), cur_deadwood);
|
||||
|
||||
if (cur_deadwood >= deadwood_goal) {
|
||||
// Found the region that has the correct amount of deadwood to the left.
|
||||
// This typically occurs after crossing a fairly sparse set of regions, so
|
||||
// iterate backwards over those sparse regions, looking for the region
|
||||
// that has the lowest density of live objects 'to the right.'
|
||||
size_t space_to_left = sd.region(cp) * region_size;
|
||||
size_t live_to_left = space_to_left - cur_deadwood;
|
||||
size_t space_to_right = space_capacity - space_to_left;
|
||||
size_t live_to_right = space_live - live_to_left;
|
||||
double density_to_right = double(live_to_right) / space_to_right;
|
||||
while (cp > full_cp) {
|
||||
--cp;
|
||||
const size_t prev_region_live_to_right = live_to_right -
|
||||
cp->data_size();
|
||||
const size_t prev_region_space_to_right = space_to_right + region_size;
|
||||
double prev_region_density_to_right =
|
||||
double(prev_region_live_to_right) / prev_region_space_to_right;
|
||||
if (density_to_right <= prev_region_density_to_right) {
|
||||
return dense_prefix;
|
||||
}
|
||||
|
||||
log_develop_trace(gc, compaction)(
|
||||
"backing up from c=" SIZE_FORMAT_W(4) " d2r=%10.8f "
|
||||
"pc_d2r=%10.8f",
|
||||
sd.region(cp), density_to_right,
|
||||
prev_region_density_to_right);
|
||||
|
||||
dense_prefix -= region_size;
|
||||
live_to_right = prev_region_live_to_right;
|
||||
space_to_right = prev_region_space_to_right;
|
||||
density_to_right = prev_region_density_to_right;
|
||||
}
|
||||
return dense_prefix;
|
||||
}
|
||||
|
||||
dense_prefix += region_size;
|
||||
++cp;
|
||||
}
|
||||
|
||||
return dense_prefix;
|
||||
}
|
||||
|
||||
#ifndef PRODUCT
|
||||
void PSParallelCompact::print_dense_prefix_stats(const char* const algorithm,
|
||||
const SpaceId id,
|
||||
const bool maximum_compaction,
|
||||
HeapWord* const addr)
|
||||
{
|
||||
const size_t region_idx = summary_data().addr_to_region_idx(addr);
|
||||
RegionData* const cp = summary_data().region(region_idx);
|
||||
const MutableSpace* const space = _space_info[id].space();
|
||||
HeapWord* const new_top = _space_info[id].new_top();
|
||||
|
||||
const size_t space_live = pointer_delta(new_top, space->bottom());
|
||||
const size_t dead_to_left = pointer_delta(addr, cp->destination());
|
||||
const size_t space_cap = space->capacity_in_words();
|
||||
const double dead_to_left_pct = double(dead_to_left) / space_cap;
|
||||
const size_t live_to_right = new_top - cp->destination();
|
||||
const size_t dead_to_right = space->top() - addr - live_to_right;
|
||||
|
||||
log_develop_debug(gc, compaction)(
|
||||
"%s=" PTR_FORMAT " dpc=" SIZE_FORMAT_W(5) " "
|
||||
"spl=" SIZE_FORMAT " "
|
||||
"d2l=" SIZE_FORMAT " d2l%%=%6.4f "
|
||||
"d2r=" SIZE_FORMAT " l2r=" SIZE_FORMAT " "
|
||||
"ratio=%10.8f",
|
||||
algorithm, p2i(addr), region_idx,
|
||||
space_live,
|
||||
dead_to_left, dead_to_left_pct,
|
||||
dead_to_right, live_to_right,
|
||||
double(dead_to_right) / live_to_right);
|
||||
}
|
||||
#endif // #ifndef PRODUCT
|
||||
|
||||
// Return a fraction indicating how much of the generation can be treated as
|
||||
// "dead wood" (i.e., not reclaimed). The function uses a normal distribution
|
||||
// based on the density of live objects in the generation to determine a limit,
|
||||
@ -1507,15 +1371,6 @@ PSParallelCompact::summarize_space(SpaceId id, bool maximum_compaction)
|
||||
HeapWord* dense_prefix_end = compute_dense_prefix(id, maximum_compaction);
|
||||
_space_info[id].set_dense_prefix(dense_prefix_end);
|
||||
|
||||
#ifndef PRODUCT
|
||||
if (log_is_enabled(Debug, gc, compaction)) {
|
||||
print_dense_prefix_stats("ratio", id, maximum_compaction,
|
||||
dense_prefix_end);
|
||||
HeapWord* addr = compute_dense_prefix_via_density(id, maximum_compaction);
|
||||
print_dense_prefix_stats("density", id, maximum_compaction, addr);
|
||||
}
|
||||
#endif // #ifndef PRODUCT
|
||||
|
||||
// Recompute the summary data, taking into account the dense prefix. If
|
||||
// every last byte will be reclaimed, then the existing summary data which
|
||||
// compacts everything can be left in place.
|
||||
|
@ -975,11 +975,6 @@ class PSParallelCompact : AllStatic {
|
||||
// Mark live objects
|
||||
static void marking_phase(ParallelOldTracer *gc_tracer);
|
||||
|
||||
// Compute the dense prefix for the designated space. This is an experimental
|
||||
// implementation currently not used in production.
|
||||
static HeapWord* compute_dense_prefix_via_density(const SpaceId id,
|
||||
bool maximum_compaction);
|
||||
|
||||
// Methods used to compute the dense prefix.
|
||||
|
||||
// Compute the value of the normal distribution at x = density. The mean and
|
||||
@ -1170,10 +1165,6 @@ class PSParallelCompact : AllStatic {
|
||||
// Debugging support.
|
||||
static const char* space_names[last_space_id];
|
||||
static void print_region_ranges();
|
||||
static void print_dense_prefix_stats(const char* const algorithm,
|
||||
const SpaceId id,
|
||||
const bool maximum_compaction,
|
||||
HeapWord* const addr);
|
||||
static void summary_phase_msg(SpaceId dst_space_id,
|
||||
HeapWord* dst_beg, HeapWord* dst_end,
|
||||
SpaceId src_space_id,
|
||||
|
Loading…
x
Reference in New Issue
Block a user