本文整理汇总了C++中ParallelScavengeHeap::generation_alignment方法的典型用法代码示例。如果您正苦于以下问题:C++ ParallelScavengeHeap::generation_alignment方法的具体用法?C++ ParallelScavengeHeap::generation_alignment怎么用?C++ ParallelScavengeHeap::generation_alignment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParallelScavengeHeap
的用法示例。
在下文中一共展示了ParallelScavengeHeap::generation_alignment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: available_to_live
// This method assumes that from-space has live data and that
// any shrinkage of the young gen is limited by location of
// from-space.
size_t PSYoungGen::available_to_live() {
size_t delta_in_survivor = 0;
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
const size_t space_alignment = heap->space_alignment();
const size_t gen_alignment = heap->generation_alignment();
MutableSpace* space_shrinking = NULL;
if (from_space()->end() > to_space()->end()) {
space_shrinking = from_space();
} else {
space_shrinking = to_space();
}
// Include any space that is committed but not included in
// the survivor spaces.
assert(((HeapWord*)virtual_space()->high()) >= space_shrinking->end(),
"Survivor space beyond high end");
size_t unused_committed = pointer_delta(virtual_space()->high(),
space_shrinking->end(), sizeof(char));
if (space_shrinking->is_empty()) {
// Don't let the space shrink to 0
assert(space_shrinking->capacity_in_bytes() >= space_alignment,
"Space is too small");
delta_in_survivor = space_shrinking->capacity_in_bytes() - space_alignment;
} else {
delta_in_survivor = pointer_delta(space_shrinking->end(),
space_shrinking->top(),
sizeof(char));
}
size_t delta_in_bytes = unused_committed + delta_in_survivor;
delta_in_bytes = align_size_down(delta_in_bytes, gen_alignment);
return delta_in_bytes;
}
示例2: available_for_expansion
size_t ASPSOldGen::available_for_expansion() {
assert(virtual_space()->is_aligned(gen_size_limit()), "not aligned");
assert(gen_size_limit() >= virtual_space()->committed_size(), "bad gen size");
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
size_t result = gen_size_limit() - virtual_space()->committed_size();
size_t result_aligned = align_size_down(result, heap->generation_alignment());
return result_aligned;
}
示例3: available_for_expansion
size_t ASPSYoungGen::available_for_expansion() {
size_t current_committed_size = virtual_space()->committed_size();
assert((gen_size_limit() >= current_committed_size),
"generation size limit is wrong");
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
size_t result = gen_size_limit() - current_committed_size;
size_t result_aligned = align_size_down(result, heap->generation_alignment());
return result_aligned;
}
示例4: available_for_contraction
size_t ASPSOldGen::available_for_contraction() {
size_t uncommitted_bytes = virtual_space()->uncommitted_size();
if (uncommitted_bytes != 0) {
return uncommitted_bytes;
}
ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap();
const size_t gen_alignment = heap->generation_alignment();
PSAdaptiveSizePolicy* policy = heap->size_policy();
const size_t working_size =
used_in_bytes() + (size_t) policy->avg_promoted()->padded_average();
const size_t working_aligned = align_size_up(working_size, gen_alignment);
const size_t working_or_min = MAX2(working_aligned, min_gen_size());
if (working_or_min > reserved().byte_size()) {
// If the used or minimum gen size (aligned up) is greater
// than the total reserved size, then the space available
// for contraction should (after proper alignment) be 0
return 0;
}
const size_t max_contraction =
reserved().byte_size() - working_or_min;
// Use the "increment" fraction instead of the "decrement" fraction
// to allow the other gen to expand more aggressively. The
// "decrement" fraction is conservative because its intent is to
// only reduce the footprint.
size_t result = policy->promo_increment_aligned_down(max_contraction);
// Also adjust for inter-generational alignment
size_t result_aligned = align_size_down(result, gen_alignment);
if (PrintAdaptiveSizePolicy && Verbose) {
gclog_or_tty->print_cr("\nASPSOldGen::available_for_contraction:"
" " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, result_aligned/K, result_aligned);
gclog_or_tty->print_cr(" reserved().byte_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
reserved().byte_size()/K, reserved().byte_size());
size_t working_promoted = (size_t) policy->avg_promoted()->padded_average();
gclog_or_tty->print_cr(" padded promoted " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
working_promoted/K, working_promoted);
gclog_or_tty->print_cr(" used " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
used_in_bytes()/K, used_in_bytes());
gclog_or_tty->print_cr(" min_gen_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
min_gen_size()/K, min_gen_size());
gclog_or_tty->print_cr(" max_contraction " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
max_contraction/K, max_contraction);
gclog_or_tty->print_cr(" without alignment " SIZE_FORMAT " K / " SIZE_FORMAT_HEX,
policy->promo_increment(max_contraction)/K,
policy->promo_increment(max_contraction));
gclog_or_tty->print_cr(" alignment " SIZE_FORMAT_HEX, gen_alignment);
}
assert(result_aligned <= max_contraction, "arithmetic is wrong");
return result_aligned;
}
示例5: available_for_contraction
// Return the number of bytes the young gen is willing give up.
//
// Future implementations could check the survivors and if to_space is in the
// right place (below from_space), take a chunk from to_space.
size_t ASPSYoungGen::available_for_contraction() {
size_t uncommitted_bytes = virtual_space()->uncommitted_size();
if (uncommitted_bytes != 0) {
return uncommitted_bytes;
}
if (eden_space()->is_empty()) {
// Respect the minimum size for eden and for the young gen as a whole.
ParallelScavengeHeap* heap = ParallelScavengeHeap::heap();
const size_t eden_alignment = heap->space_alignment();
const size_t gen_alignment = heap->generation_alignment();
assert(eden_space()->capacity_in_bytes() >= eden_alignment,
"Alignment is wrong");
size_t eden_avail = eden_space()->capacity_in_bytes() - eden_alignment;
eden_avail = align_size_down(eden_avail, gen_alignment);
assert(virtual_space()->committed_size() >= min_gen_size(),
"minimum gen size is wrong");
size_t gen_avail = virtual_space()->committed_size() - min_gen_size();
assert(virtual_space()->is_aligned(gen_avail), "not aligned");
const size_t max_contraction = MIN2(eden_avail, gen_avail);
// See comment for ASPSOldGen::available_for_contraction()
// for reasons the "increment" fraction is used.
PSAdaptiveSizePolicy* policy = heap->size_policy();
size_t result = policy->eden_increment_aligned_down(max_contraction);
size_t result_aligned = align_size_down(result, gen_alignment);
log_trace(gc, ergo)("ASPSYoungGen::available_for_contraction: " SIZE_FORMAT " K", result_aligned/K);
log_trace(gc, ergo)(" max_contraction " SIZE_FORMAT " K", max_contraction/K);
log_trace(gc, ergo)(" eden_avail " SIZE_FORMAT " K", eden_avail/K);
log_trace(gc, ergo)(" gen_avail " SIZE_FORMAT " K", gen_avail/K);
return result_aligned;
}
return 0;
}