8358294: Remove unnecessary GenAlignment
Reviewed-by: iwalulya, tschatzl
This commit is contained in:
parent
8f487d26c0
commit
38b877e941
@ -98,15 +98,15 @@ void ParallelArguments::initialize() {
|
|||||||
FullGCForwarding::initialize_flags(heap_reserved_size_bytes());
|
FullGCForwarding::initialize_flags(heap_reserved_size_bytes());
|
||||||
}
|
}
|
||||||
|
|
||||||
// The alignment used for boundary between young gen and old gen
|
// The alignment used for spaces in young gen and old gen
|
||||||
static size_t default_gen_alignment() {
|
static size_t default_space_alignment() {
|
||||||
return 64 * K * HeapWordSize;
|
return 64 * K * HeapWordSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParallelArguments::initialize_alignments() {
|
void ParallelArguments::initialize_alignments() {
|
||||||
// Initialize card size before initializing alignments
|
// Initialize card size before initializing alignments
|
||||||
CardTable::initialize_card_size();
|
CardTable::initialize_card_size();
|
||||||
SpaceAlignment = GenAlignment = default_gen_alignment();
|
SpaceAlignment = default_space_alignment();
|
||||||
HeapAlignment = compute_heap_alignment();
|
HeapAlignment = compute_heap_alignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -123,9 +123,8 @@ void ParallelArguments::initialize_heap_flags_and_sizes() {
|
|||||||
|
|
||||||
// Can a page size be something else than a power of two?
|
// Can a page size be something else than a power of two?
|
||||||
assert(is_power_of_2((intptr_t)page_sz), "must be a power of 2");
|
assert(is_power_of_2((intptr_t)page_sz), "must be a power of 2");
|
||||||
size_t new_alignment = align_up(page_sz, GenAlignment);
|
size_t new_alignment = align_up(page_sz, SpaceAlignment);
|
||||||
if (new_alignment != GenAlignment) {
|
if (new_alignment != SpaceAlignment) {
|
||||||
GenAlignment = new_alignment;
|
|
||||||
SpaceAlignment = new_alignment;
|
SpaceAlignment = new_alignment;
|
||||||
// Redo everything from the start
|
// Redo everything from the start
|
||||||
initialize_heap_flags_and_sizes_one_pass();
|
initialize_heap_flags_and_sizes_one_pass();
|
||||||
|
@ -29,10 +29,8 @@
|
|||||||
void ParallelInitLogger::print_heap() {
|
void ParallelInitLogger::print_heap() {
|
||||||
log_info_p(gc, init)("Alignments:"
|
log_info_p(gc, init)("Alignments:"
|
||||||
" Space " EXACTFMT ","
|
" Space " EXACTFMT ","
|
||||||
" Generation " EXACTFMT ","
|
|
||||||
" Heap " EXACTFMT,
|
" Heap " EXACTFMT,
|
||||||
EXACTFMTARGS(SpaceAlignment),
|
EXACTFMTARGS(SpaceAlignment),
|
||||||
EXACTFMTARGS(GenAlignment),
|
|
||||||
EXACTFMTARGS(HeapAlignment));
|
EXACTFMTARGS(HeapAlignment));
|
||||||
GCInitLogger::print_heap();
|
GCInitLogger::print_heap();
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,8 @@ jint ParallelScavengeHeap::initialize() {
|
|||||||
|
|
||||||
initialize_reserved_region(heap_rs);
|
initialize_reserved_region(heap_rs);
|
||||||
// Layout the reserved space for the generations.
|
// Layout the reserved space for the generations.
|
||||||
ReservedSpace old_rs = heap_rs.first_part(MaxOldSize, GenAlignment);
|
ReservedSpace old_rs = heap_rs.first_part(MaxOldSize, SpaceAlignment);
|
||||||
ReservedSpace young_rs = heap_rs.last_part(MaxOldSize, GenAlignment);
|
ReservedSpace young_rs = heap_rs.last_part(MaxOldSize, SpaceAlignment);
|
||||||
assert(young_rs.size() == MaxNewSize, "Didn't reserve all of the heap");
|
assert(young_rs.size() == MaxNewSize, "Didn't reserve all of the heap");
|
||||||
|
|
||||||
PSCardTable* card_table = new PSCardTable(_reserved);
|
PSCardTable* card_table = new PSCardTable(_reserved);
|
||||||
@ -107,7 +107,7 @@ jint ParallelScavengeHeap::initialize() {
|
|||||||
new PSAdaptiveSizePolicy(eden_capacity,
|
new PSAdaptiveSizePolicy(eden_capacity,
|
||||||
initial_promo_size,
|
initial_promo_size,
|
||||||
young_gen()->to_space()->capacity_in_bytes(),
|
young_gen()->to_space()->capacity_in_bytes(),
|
||||||
GenAlignment,
|
SpaceAlignment,
|
||||||
max_gc_pause_sec,
|
max_gc_pause_sec,
|
||||||
GCTimeRatio
|
GCTimeRatio
|
||||||
);
|
);
|
||||||
|
@ -41,7 +41,7 @@ PSOldGen::PSOldGen(ReservedSpace rs, size_t initial_size, size_t min_size,
|
|||||||
_min_gen_size(min_size),
|
_min_gen_size(min_size),
|
||||||
_max_gen_size(max_size)
|
_max_gen_size(max_size)
|
||||||
{
|
{
|
||||||
initialize(rs, initial_size, GenAlignment);
|
initialize(rs, initial_size, SpaceAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PSOldGen::initialize(ReservedSpace rs, size_t initial_size, size_t alignment) {
|
void PSOldGen::initialize(ReservedSpace rs, size_t initial_size, size_t alignment) {
|
||||||
|
@ -47,7 +47,7 @@ PSYoungGen::PSYoungGen(ReservedSpace rs, size_t initial_size, size_t min_size, s
|
|||||||
_from_counters(nullptr),
|
_from_counters(nullptr),
|
||||||
_to_counters(nullptr)
|
_to_counters(nullptr)
|
||||||
{
|
{
|
||||||
initialize(rs, initial_size, GenAlignment);
|
initialize(rs, initial_size, SpaceAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PSYoungGen::initialize_virtual_space(ReservedSpace rs,
|
void PSYoungGen::initialize_virtual_space(ReservedSpace rs,
|
||||||
@ -746,7 +746,7 @@ size_t PSYoungGen::available_to_live() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t delta_in_bytes = unused_committed + delta_in_survivor;
|
size_t delta_in_bytes = unused_committed + delta_in_survivor;
|
||||||
delta_in_bytes = align_down(delta_in_bytes, GenAlignment);
|
delta_in_bytes = align_down(delta_in_bytes, SpaceAlignment);
|
||||||
return delta_in_bytes;
|
return delta_in_bytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,8 +188,8 @@ jint SerialHeap::initialize() {
|
|||||||
|
|
||||||
initialize_reserved_region(heap_rs);
|
initialize_reserved_region(heap_rs);
|
||||||
|
|
||||||
ReservedSpace young_rs = heap_rs.first_part(MaxNewSize, GenAlignment);
|
ReservedSpace young_rs = heap_rs.first_part(MaxNewSize, SpaceAlignment);
|
||||||
ReservedSpace old_rs = heap_rs.last_part(MaxNewSize, GenAlignment);
|
ReservedSpace old_rs = heap_rs.last_part(MaxNewSize, SpaceAlignment);
|
||||||
|
|
||||||
_rem_set = new CardTableRS(_reserved);
|
_rem_set = new CardTableRS(_reserved);
|
||||||
_rem_set->initialize(young_rs.base(), old_rs.base());
|
_rem_set->initialize(young_rs.base(), old_rs.base());
|
||||||
|
@ -35,7 +35,7 @@ extern size_t SpaceAlignment;
|
|||||||
|
|
||||||
class GCArguments {
|
class GCArguments {
|
||||||
protected:
|
protected:
|
||||||
// Initialize HeapAlignment, SpaceAlignment, and extra alignments (E.g. GenAlignment)
|
// Initialize HeapAlignment, SpaceAlignment
|
||||||
virtual void initialize_alignments() = 0;
|
virtual void initialize_alignments() = 0;
|
||||||
virtual void initialize_heap_flags_and_sizes();
|
virtual void initialize_heap_flags_and_sizes();
|
||||||
virtual void initialize_size_info();
|
virtual void initialize_size_info();
|
||||||
|
@ -42,17 +42,15 @@ size_t MaxOldSize = 0;
|
|||||||
// See more in JDK-8346005
|
// See more in JDK-8346005
|
||||||
size_t OldSize = ScaleForWordSize(4*M);
|
size_t OldSize = ScaleForWordSize(4*M);
|
||||||
|
|
||||||
size_t GenAlignment = 0;
|
|
||||||
|
|
||||||
size_t GenArguments::conservative_max_heap_alignment() { return (size_t)Generation::GenGrain; }
|
size_t GenArguments::conservative_max_heap_alignment() { return (size_t)Generation::GenGrain; }
|
||||||
|
|
||||||
static size_t young_gen_size_lower_bound() {
|
static size_t young_gen_size_lower_bound() {
|
||||||
// The young generation must be aligned and have room for eden + two survivors
|
// The young generation must be aligned and have room for eden + two survivors
|
||||||
return align_up(3 * SpaceAlignment, GenAlignment);
|
return 3 * SpaceAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t old_gen_size_lower_bound() {
|
static size_t old_gen_size_lower_bound() {
|
||||||
return align_up(SpaceAlignment, GenAlignment);
|
return SpaceAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t GenArguments::scale_by_NewRatio_aligned(size_t base_size, size_t alignment) {
|
size_t GenArguments::scale_by_NewRatio_aligned(size_t base_size, size_t alignment) {
|
||||||
@ -69,23 +67,20 @@ static size_t bound_minus_alignment(size_t desired_size,
|
|||||||
void GenArguments::initialize_alignments() {
|
void GenArguments::initialize_alignments() {
|
||||||
// Initialize card size before initializing alignments
|
// Initialize card size before initializing alignments
|
||||||
CardTable::initialize_card_size();
|
CardTable::initialize_card_size();
|
||||||
SpaceAlignment = GenAlignment = (size_t)Generation::GenGrain;
|
SpaceAlignment = (size_t)Generation::GenGrain;
|
||||||
HeapAlignment = compute_heap_alignment();
|
HeapAlignment = compute_heap_alignment();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenArguments::initialize_heap_flags_and_sizes() {
|
void GenArguments::initialize_heap_flags_and_sizes() {
|
||||||
GCArguments::initialize_heap_flags_and_sizes();
|
GCArguments::initialize_heap_flags_and_sizes();
|
||||||
|
|
||||||
assert(GenAlignment != 0, "Generation alignment not set up properly");
|
assert(SpaceAlignment != 0, "Generation alignment not set up properly");
|
||||||
assert(HeapAlignment >= GenAlignment,
|
assert(HeapAlignment >= SpaceAlignment,
|
||||||
"HeapAlignment: %zu less than GenAlignment: %zu",
|
"HeapAlignment: %zu less than SpaceAlignment: %zu",
|
||||||
HeapAlignment, GenAlignment);
|
HeapAlignment, SpaceAlignment);
|
||||||
assert(GenAlignment % SpaceAlignment == 0,
|
assert(HeapAlignment % SpaceAlignment == 0,
|
||||||
"GenAlignment: %zu not aligned by SpaceAlignment: %zu",
|
"HeapAlignment: %zu not aligned by SpaceAlignment: %zu",
|
||||||
GenAlignment, SpaceAlignment);
|
HeapAlignment, SpaceAlignment);
|
||||||
assert(HeapAlignment % GenAlignment == 0,
|
|
||||||
"HeapAlignment: %zu not aligned by GenAlignment: %zu",
|
|
||||||
HeapAlignment, GenAlignment);
|
|
||||||
|
|
||||||
// All generational heaps have a young gen; handle those flags here
|
// All generational heaps have a young gen; handle those flags here
|
||||||
|
|
||||||
@ -106,7 +101,7 @@ void GenArguments::initialize_heap_flags_and_sizes() {
|
|||||||
|
|
||||||
// Make sure NewSize allows an old generation to fit even if set on the command line
|
// Make sure NewSize allows an old generation to fit even if set on the command line
|
||||||
if (FLAG_IS_CMDLINE(NewSize) && NewSize >= InitialHeapSize) {
|
if (FLAG_IS_CMDLINE(NewSize) && NewSize >= InitialHeapSize) {
|
||||||
size_t revised_new_size = bound_minus_alignment(NewSize, InitialHeapSize, GenAlignment);
|
size_t revised_new_size = bound_minus_alignment(NewSize, InitialHeapSize, SpaceAlignment);
|
||||||
log_warning(gc, ergo)("NewSize (%zuk) is equal to or greater than initial heap size (%zuk). A new "
|
log_warning(gc, ergo)("NewSize (%zuk) is equal to or greater than initial heap size (%zuk). A new "
|
||||||
"NewSize of %zuk will be used to accomodate an old generation.",
|
"NewSize of %zuk will be used to accomodate an old generation.",
|
||||||
NewSize/K, InitialHeapSize/K, revised_new_size/K);
|
NewSize/K, InitialHeapSize/K, revised_new_size/K);
|
||||||
@ -115,8 +110,8 @@ void GenArguments::initialize_heap_flags_and_sizes() {
|
|||||||
|
|
||||||
// Now take the actual NewSize into account. We will silently increase NewSize
|
// Now take the actual NewSize into account. We will silently increase NewSize
|
||||||
// if the user specified a smaller or unaligned value.
|
// if the user specified a smaller or unaligned value.
|
||||||
size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize, GenAlignment);
|
size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize, SpaceAlignment);
|
||||||
bounded_new_size = MAX2(smallest_new_size, align_down(bounded_new_size, GenAlignment));
|
bounded_new_size = MAX2(smallest_new_size, align_down(bounded_new_size, SpaceAlignment));
|
||||||
if (bounded_new_size != NewSize) {
|
if (bounded_new_size != NewSize) {
|
||||||
FLAG_SET_ERGO(NewSize, bounded_new_size);
|
FLAG_SET_ERGO(NewSize, bounded_new_size);
|
||||||
}
|
}
|
||||||
@ -125,7 +120,7 @@ void GenArguments::initialize_heap_flags_and_sizes() {
|
|||||||
if (!FLAG_IS_DEFAULT(MaxNewSize)) {
|
if (!FLAG_IS_DEFAULT(MaxNewSize)) {
|
||||||
if (MaxNewSize >= MaxHeapSize) {
|
if (MaxNewSize >= MaxHeapSize) {
|
||||||
// Make sure there is room for an old generation
|
// Make sure there is room for an old generation
|
||||||
size_t smaller_max_new_size = MaxHeapSize - GenAlignment;
|
size_t smaller_max_new_size = MaxHeapSize - SpaceAlignment;
|
||||||
if (FLAG_IS_CMDLINE(MaxNewSize)) {
|
if (FLAG_IS_CMDLINE(MaxNewSize)) {
|
||||||
log_warning(gc, ergo)("MaxNewSize (%zuk) is equal to or greater than the entire "
|
log_warning(gc, ergo)("MaxNewSize (%zuk) is equal to or greater than the entire "
|
||||||
"heap (%zuk). A new max generation size of %zuk will be used.",
|
"heap (%zuk). A new max generation size of %zuk will be used.",
|
||||||
@ -137,8 +132,8 @@ void GenArguments::initialize_heap_flags_and_sizes() {
|
|||||||
}
|
}
|
||||||
} else if (MaxNewSize < NewSize) {
|
} else if (MaxNewSize < NewSize) {
|
||||||
FLAG_SET_ERGO(MaxNewSize, NewSize);
|
FLAG_SET_ERGO(MaxNewSize, NewSize);
|
||||||
} else if (!is_aligned(MaxNewSize, GenAlignment)) {
|
} else if (!is_aligned(MaxNewSize, SpaceAlignment)) {
|
||||||
FLAG_SET_ERGO(MaxNewSize, align_down(MaxNewSize, GenAlignment));
|
FLAG_SET_ERGO(MaxNewSize, align_down(MaxNewSize, SpaceAlignment));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -166,13 +161,13 @@ void GenArguments::initialize_heap_flags_and_sizes() {
|
|||||||
// exceed it. Adjust New/OldSize as necessary.
|
// exceed it. Adjust New/OldSize as necessary.
|
||||||
size_t calculated_size = NewSize + OldSize;
|
size_t calculated_size = NewSize + OldSize;
|
||||||
double shrink_factor = (double) MaxHeapSize / calculated_size;
|
double shrink_factor = (double) MaxHeapSize / calculated_size;
|
||||||
size_t smaller_new_size = align_down((size_t)(NewSize * shrink_factor), GenAlignment);
|
size_t smaller_new_size = align_down((size_t)(NewSize * shrink_factor), SpaceAlignment);
|
||||||
FLAG_SET_ERGO(NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size));
|
FLAG_SET_ERGO(NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size));
|
||||||
|
|
||||||
// OldSize is already aligned because above we aligned MaxHeapSize to
|
// OldSize is already aligned because above we aligned MaxHeapSize to
|
||||||
// HeapAlignment, and we just made sure that NewSize is aligned to
|
// HeapAlignment, and we just made sure that NewSize is aligned to
|
||||||
// GenAlignment. In initialize_flags() we verified that HeapAlignment
|
// SpaceAlignment. In initialize_flags() we verified that HeapAlignment
|
||||||
// is a multiple of GenAlignment.
|
// is a multiple of SpaceAlignment.
|
||||||
OldSize = MaxHeapSize - NewSize;
|
OldSize = MaxHeapSize - NewSize;
|
||||||
} else {
|
} else {
|
||||||
FLAG_SET_ERGO(MaxHeapSize, align_up(NewSize + OldSize, HeapAlignment));
|
FLAG_SET_ERGO(MaxHeapSize, align_up(NewSize + OldSize, HeapAlignment));
|
||||||
@ -200,7 +195,7 @@ void GenArguments::initialize_size_info() {
|
|||||||
// Determine maximum size of the young generation.
|
// Determine maximum size of the young generation.
|
||||||
|
|
||||||
if (FLAG_IS_DEFAULT(MaxNewSize)) {
|
if (FLAG_IS_DEFAULT(MaxNewSize)) {
|
||||||
max_young_size = scale_by_NewRatio_aligned(MaxHeapSize, GenAlignment);
|
max_young_size = scale_by_NewRatio_aligned(MaxHeapSize, SpaceAlignment);
|
||||||
// Bound the maximum size by NewSize below (since it historically
|
// Bound the maximum size by NewSize below (since it historically
|
||||||
// would have been NewSize and because the NewRatio calculation could
|
// would have been NewSize and because the NewRatio calculation could
|
||||||
// yield a size that is too small) and bound it by MaxNewSize above.
|
// yield a size that is too small) and bound it by MaxNewSize above.
|
||||||
@ -229,18 +224,18 @@ void GenArguments::initialize_size_info() {
|
|||||||
// If NewSize is set on the command line, we should use it as
|
// If NewSize is set on the command line, we should use it as
|
||||||
// the initial size, but make sure it is within the heap bounds.
|
// the initial size, but make sure it is within the heap bounds.
|
||||||
initial_young_size =
|
initial_young_size =
|
||||||
MIN2(max_young_size, bound_minus_alignment(NewSize, InitialHeapSize, GenAlignment));
|
MIN2(max_young_size, bound_minus_alignment(NewSize, InitialHeapSize, SpaceAlignment));
|
||||||
MinNewSize = bound_minus_alignment(initial_young_size, MinHeapSize, GenAlignment);
|
MinNewSize = bound_minus_alignment(initial_young_size, MinHeapSize, SpaceAlignment);
|
||||||
} else {
|
} else {
|
||||||
// For the case where NewSize is not set on the command line, use
|
// For the case where NewSize is not set on the command line, use
|
||||||
// NewRatio to size the initial generation size. Use the current
|
// NewRatio to size the initial generation size. Use the current
|
||||||
// NewSize as the floor, because if NewRatio is overly large, the resulting
|
// NewSize as the floor, because if NewRatio is overly large, the resulting
|
||||||
// size can be too small.
|
// size can be too small.
|
||||||
initial_young_size =
|
initial_young_size =
|
||||||
clamp(scale_by_NewRatio_aligned(InitialHeapSize, GenAlignment), NewSize, max_young_size);
|
clamp(scale_by_NewRatio_aligned(InitialHeapSize, SpaceAlignment), NewSize, max_young_size);
|
||||||
|
|
||||||
// Derive MinNewSize from MinHeapSize
|
// Derive MinNewSize from MinHeapSize
|
||||||
MinNewSize = MIN2(scale_by_NewRatio_aligned(MinHeapSize, GenAlignment), initial_young_size);
|
MinNewSize = MIN2(scale_by_NewRatio_aligned(MinHeapSize, SpaceAlignment), initial_young_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -252,7 +247,7 @@ void GenArguments::initialize_size_info() {
|
|||||||
// The maximum old size can be determined from the maximum young
|
// The maximum old size can be determined from the maximum young
|
||||||
// and maximum heap size since no explicit flags exist
|
// and maximum heap size since no explicit flags exist
|
||||||
// for setting the old generation maximum.
|
// for setting the old generation maximum.
|
||||||
MaxOldSize = MAX2(MaxHeapSize - max_young_size, GenAlignment);
|
MaxOldSize = MAX2(MaxHeapSize - max_young_size, SpaceAlignment);
|
||||||
MinOldSize = MIN3(MaxOldSize,
|
MinOldSize = MIN3(MaxOldSize,
|
||||||
InitialHeapSize - initial_young_size,
|
InitialHeapSize - initial_young_size,
|
||||||
MinHeapSize - MinNewSize);
|
MinHeapSize - MinNewSize);
|
||||||
@ -315,10 +310,10 @@ void GenArguments::assert_flags() {
|
|||||||
assert(NewSize >= MinNewSize, "Ergonomics decided on a too small young gen size");
|
assert(NewSize >= MinNewSize, "Ergonomics decided on a too small young gen size");
|
||||||
assert(NewSize <= MaxNewSize, "Ergonomics decided on incompatible initial and maximum young gen sizes");
|
assert(NewSize <= MaxNewSize, "Ergonomics decided on incompatible initial and maximum young gen sizes");
|
||||||
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes");
|
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young gen and heap sizes");
|
||||||
assert(NewSize % GenAlignment == 0, "NewSize alignment");
|
assert(NewSize % SpaceAlignment == 0, "NewSize alignment");
|
||||||
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % GenAlignment == 0, "MaxNewSize alignment");
|
assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % SpaceAlignment == 0, "MaxNewSize alignment");
|
||||||
assert(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes");
|
assert(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes");
|
||||||
assert(OldSize % GenAlignment == 0, "OldSize alignment");
|
assert(OldSize % SpaceAlignment == 0, "OldSize alignment");
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenArguments::assert_size_info() {
|
void GenArguments::assert_size_info() {
|
||||||
@ -327,19 +322,19 @@ void GenArguments::assert_size_info() {
|
|||||||
assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes");
|
assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes");
|
||||||
assert(MinNewSize <= NewSize, "Ergonomics decided on incompatible minimum and initial young gen sizes");
|
assert(MinNewSize <= NewSize, "Ergonomics decided on incompatible minimum and initial young gen sizes");
|
||||||
assert(NewSize <= MaxNewSize, "Ergonomics decided on incompatible initial and maximum young gen sizes");
|
assert(NewSize <= MaxNewSize, "Ergonomics decided on incompatible initial and maximum young gen sizes");
|
||||||
assert(MinNewSize % GenAlignment == 0, "_min_young_size alignment");
|
assert(MinNewSize % SpaceAlignment == 0, "_min_young_size alignment");
|
||||||
assert(NewSize % GenAlignment == 0, "_initial_young_size alignment");
|
assert(NewSize % SpaceAlignment == 0, "_initial_young_size alignment");
|
||||||
assert(MaxNewSize % GenAlignment == 0, "MaxNewSize alignment");
|
assert(MaxNewSize % SpaceAlignment == 0, "MaxNewSize alignment");
|
||||||
assert(MinNewSize <= bound_minus_alignment(MinNewSize, MinHeapSize, GenAlignment),
|
assert(MinNewSize <= bound_minus_alignment(MinNewSize, MinHeapSize, SpaceAlignment),
|
||||||
"Ergonomics made minimum young generation larger than minimum heap");
|
"Ergonomics made minimum young generation larger than minimum heap");
|
||||||
assert(NewSize <= bound_minus_alignment(NewSize, InitialHeapSize, GenAlignment),
|
assert(NewSize <= bound_minus_alignment(NewSize, InitialHeapSize, SpaceAlignment),
|
||||||
"Ergonomics made initial young generation larger than initial heap");
|
"Ergonomics made initial young generation larger than initial heap");
|
||||||
assert(MaxNewSize <= bound_minus_alignment(MaxNewSize, MaxHeapSize, GenAlignment),
|
assert(MaxNewSize <= bound_minus_alignment(MaxNewSize, MaxHeapSize, SpaceAlignment),
|
||||||
"Ergonomics made maximum young generation lager than maximum heap");
|
"Ergonomics made maximum young generation lager than maximum heap");
|
||||||
assert(MinOldSize <= OldSize, "Ergonomics decided on incompatible minimum and initial old gen sizes");
|
assert(MinOldSize <= OldSize, "Ergonomics decided on incompatible minimum and initial old gen sizes");
|
||||||
assert(OldSize <= MaxOldSize, "Ergonomics decided on incompatible initial and maximum old gen sizes");
|
assert(OldSize <= MaxOldSize, "Ergonomics decided on incompatible initial and maximum old gen sizes");
|
||||||
assert(MaxOldSize % GenAlignment == 0, "MaxOldSize alignment");
|
assert(MaxOldSize % SpaceAlignment == 0, "MaxOldSize alignment");
|
||||||
assert(OldSize % GenAlignment == 0, "OldSize alignment");
|
assert(OldSize % SpaceAlignment == 0, "OldSize alignment");
|
||||||
assert(MaxHeapSize <= (MaxNewSize + MaxOldSize), "Total maximum heap sizes must be sum of generation maximum sizes");
|
assert(MaxHeapSize <= (MaxNewSize + MaxOldSize), "Total maximum heap sizes must be sum of generation maximum sizes");
|
||||||
assert(MinNewSize + MinOldSize <= MinHeapSize, "Minimum generation sizes exceed minimum heap size");
|
assert(MinNewSize + MinOldSize <= MinHeapSize, "Minimum generation sizes exceed minimum heap size");
|
||||||
assert(NewSize + OldSize == InitialHeapSize, "Initial generation sizes should match initial heap size");
|
assert(NewSize + OldSize == InitialHeapSize, "Initial generation sizes should match initial heap size");
|
||||||
|
@ -35,8 +35,6 @@ extern size_t MaxOldSize;
|
|||||||
|
|
||||||
extern size_t OldSize;
|
extern size_t OldSize;
|
||||||
|
|
||||||
extern size_t GenAlignment;
|
|
||||||
|
|
||||||
class GenArguments : public GCArguments {
|
class GenArguments : public GCArguments {
|
||||||
friend class TestGenCollectorPolicy; // Testing
|
friend class TestGenCollectorPolicy; // Testing
|
||||||
private:
|
private:
|
||||||
|
@ -583,28 +583,6 @@ WB_ENTRY(jboolean, WB_G1HasRegionsToUncommit(JNIEnv* env, jobject o))
|
|||||||
THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_G1HasRegionsToUncommit: G1 GC is not enabled");
|
THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_G1HasRegionsToUncommit: G1 GC is not enabled");
|
||||||
WB_END
|
WB_END
|
||||||
|
|
||||||
#endif // INCLUDE_G1GC
|
|
||||||
|
|
||||||
#if INCLUDE_PARALLELGC
|
|
||||||
|
|
||||||
WB_ENTRY(jlong, WB_PSVirtualSpaceAlignment(JNIEnv* env, jobject o))
|
|
||||||
if (UseParallelGC) {
|
|
||||||
return GenAlignment;
|
|
||||||
}
|
|
||||||
THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_PSVirtualSpaceAlignment: Parallel GC is not enabled");
|
|
||||||
WB_END
|
|
||||||
|
|
||||||
WB_ENTRY(jlong, WB_PSHeapGenerationAlignment(JNIEnv* env, jobject o))
|
|
||||||
if (UseParallelGC) {
|
|
||||||
return GenAlignment;
|
|
||||||
}
|
|
||||||
THROW_MSG_0(vmSymbols::java_lang_UnsupportedOperationException(), "WB_PSHeapGenerationAlignment: Parallel GC is not enabled");
|
|
||||||
WB_END
|
|
||||||
|
|
||||||
#endif // INCLUDE_PARALLELGC
|
|
||||||
|
|
||||||
#if INCLUDE_G1GC
|
|
||||||
|
|
||||||
WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
|
WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
|
||||||
if (UseG1GC) {
|
if (UseG1GC) {
|
||||||
ResourceMark rm(THREAD);
|
ResourceMark rm(THREAD);
|
||||||
@ -2773,10 +2751,6 @@ static JNINativeMethod methods[] = {
|
|||||||
{CC"g1MemoryNodeIds", CC"()[I", (void*)&WB_G1MemoryNodeIds },
|
{CC"g1MemoryNodeIds", CC"()[I", (void*)&WB_G1MemoryNodeIds },
|
||||||
{CC"g1GetMixedGCInfo", CC"(I)[J", (void*)&WB_G1GetMixedGCInfo },
|
{CC"g1GetMixedGCInfo", CC"(I)[J", (void*)&WB_G1GetMixedGCInfo },
|
||||||
#endif // INCLUDE_G1GC
|
#endif // INCLUDE_G1GC
|
||||||
#if INCLUDE_PARALLELGC
|
|
||||||
{CC"psVirtualSpaceAlignment",CC"()J", (void*)&WB_PSVirtualSpaceAlignment},
|
|
||||||
{CC"psHeapGenerationAlignment",CC"()J", (void*)&WB_PSHeapGenerationAlignment},
|
|
||||||
#endif
|
|
||||||
{CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc },
|
{CC"NMTMalloc", CC"(J)J", (void*)&WB_NMTMalloc },
|
||||||
{CC"NMTMallocWithPseudoStack", CC"(JI)J", (void*)&WB_NMTMallocWithPseudoStack},
|
{CC"NMTMallocWithPseudoStack", CC"(JI)J", (void*)&WB_NMTMallocWithPseudoStack},
|
||||||
{CC"NMTMallocWithPseudoStackAndType", CC"(JII)J", (void*)&WB_NMTMallocWithPseudoStackAndType},
|
{CC"NMTMallocWithPseudoStackAndType", CC"(JII)J", (void*)&WB_NMTMallocWithPseudoStackAndType},
|
||||||
|
@ -117,7 +117,7 @@ class TestGenCollectorPolicy {
|
|||||||
initial_heap_size = InitialHeapSize;
|
initial_heap_size = InitialHeapSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t expected = scale_by_NewRatio_aligned(initial_heap_size, GenAlignment);
|
size_t expected = scale_by_NewRatio_aligned(initial_heap_size, SpaceAlignment);
|
||||||
ASSERT_EQ(expected, NewSize);
|
ASSERT_EQ(expected, NewSize);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -162,12 +162,12 @@ public class TestMinAndInitialSurvivorRatioFlags {
|
|||||||
MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage();
|
MemoryUsage survivorUsage = HeapRegionUsageTool.getSurvivorUsage();
|
||||||
|
|
||||||
long alignedNewSize = edenUsage.getMax() + 2 * survivorUsage.getMax();
|
long alignedNewSize = edenUsage.getMax() + 2 * survivorUsage.getMax();
|
||||||
long generationAlignment = wb.psHeapGenerationAlignment();
|
long spaceAlignment = wb.getHeapSpaceAlignment();
|
||||||
|
|
||||||
if (survivorRatio >= 0) {
|
if (survivorRatio >= 0) {
|
||||||
// -XX:SurvivorRatio was passed to JVM, actual ratio should be SurvivorRatio + 2
|
// -XX:SurvivorRatio was passed to JVM, actual ratio should be SurvivorRatio + 2
|
||||||
long expectedSize = HeapRegionUsageTool.alignDown(alignedNewSize / (survivorRatio + 2),
|
long expectedSize = HeapRegionUsageTool.alignDown(alignedNewSize / (survivorRatio + 2),
|
||||||
generationAlignment);
|
spaceAlignment);
|
||||||
|
|
||||||
if (survivorUsage.getCommitted() != expectedSize) {
|
if (survivorUsage.getCommitted() != expectedSize) {
|
||||||
throw new RuntimeException("Expected survivor size is: " + expectedSize
|
throw new RuntimeException("Expected survivor size is: " + expectedSize
|
||||||
@ -177,7 +177,7 @@ public class TestMinAndInitialSurvivorRatioFlags {
|
|||||||
// In case of initial ratio verification or disabled adaptive size policy
|
// In case of initial ratio verification or disabled adaptive size policy
|
||||||
// ratio should be equal to InitialSurvivorRatio value
|
// ratio should be equal to InitialSurvivorRatio value
|
||||||
long expectedSize = HeapRegionUsageTool.alignDown(alignedNewSize / initRatio,
|
long expectedSize = HeapRegionUsageTool.alignDown(alignedNewSize / initRatio,
|
||||||
generationAlignment);
|
spaceAlignment);
|
||||||
if (survivorUsage.getCommitted() != expectedSize) {
|
if (survivorUsage.getCommitted() != expectedSize) {
|
||||||
throw new RuntimeException("Expected survivor size is: " + expectedSize
|
throw new RuntimeException("Expected survivor size is: " + expectedSize
|
||||||
+ ", but observed size is: " + survivorUsage.getCommitted());
|
+ ", but observed size is: " + survivorUsage.getCommitted());
|
||||||
@ -186,9 +186,9 @@ public class TestMinAndInitialSurvivorRatioFlags {
|
|||||||
// In any other case actual survivor ratio should not be lower than MinSurvivorRatio
|
// In any other case actual survivor ratio should not be lower than MinSurvivorRatio
|
||||||
// or is should be equal to InitialSurvivorRatio
|
// or is should be equal to InitialSurvivorRatio
|
||||||
long expectedMinSize = HeapRegionUsageTool.alignDown(alignedNewSize / minRatio,
|
long expectedMinSize = HeapRegionUsageTool.alignDown(alignedNewSize / minRatio,
|
||||||
generationAlignment);
|
spaceAlignment);
|
||||||
long expectedInitSize = HeapRegionUsageTool.alignDown(alignedNewSize / initRatio,
|
long expectedInitSize = HeapRegionUsageTool.alignDown(alignedNewSize / initRatio,
|
||||||
generationAlignment);
|
spaceAlignment);
|
||||||
if (survivorUsage.getCommitted() != expectedInitSize
|
if (survivorUsage.getCommitted() != expectedInitSize
|
||||||
&& survivorUsage.getCommitted() < expectedMinSize) {
|
&& survivorUsage.getCommitted() < expectedMinSize) {
|
||||||
throw new RuntimeException("Expected survivor size should be " + expectedMinSize
|
throw new RuntimeException("Expected survivor size should be " + expectedMinSize
|
||||||
|
@ -146,10 +146,8 @@ public class TestNewRatioFlag {
|
|||||||
long newSize = initEden + 2 * initSurv;
|
long newSize = initEden + 2 * initSurv;
|
||||||
|
|
||||||
// See GenArguments::scale_by_NewRatio_aligned for calculation in the JVM.
|
// See GenArguments::scale_by_NewRatio_aligned for calculation in the JVM.
|
||||||
long alignedDownNewSize = HeapRegionUsageTool.alignDown(initHeap / (expectedRatio + 1),
|
long expectedNewSize = HeapRegionUsageTool.alignDown(initHeap / (expectedRatio + 1),
|
||||||
wb.getHeapSpaceAlignment());
|
wb.getHeapSpaceAlignment());
|
||||||
long expectedNewSize = HeapRegionUsageTool.alignUp(alignedDownNewSize,
|
|
||||||
wb.psVirtualSpaceAlignment());
|
|
||||||
|
|
||||||
if (expectedNewSize != newSize) {
|
if (expectedNewSize != newSize) {
|
||||||
throw new RuntimeException("Expected young gen size is: " + expectedNewSize
|
throw new RuntimeException("Expected young gen size is: " + expectedNewSize
|
||||||
|
@ -182,8 +182,6 @@ public class TestNewSizeFlags {
|
|||||||
private static final GCTypes.YoungGCType YOUNG_GC_TYPE = GCTypes.YoungGCType.getYoungGCType();
|
private static final GCTypes.YoungGCType YOUNG_GC_TYPE = GCTypes.YoungGCType.getYoungGCType();
|
||||||
private static final long HEAP_SPACE_ALIGNMENT = WB.getHeapSpaceAlignment();
|
private static final long HEAP_SPACE_ALIGNMENT = WB.getHeapSpaceAlignment();
|
||||||
private static final long HEAP_ALIGNMENT = WB.getHeapAlignment();
|
private static final long HEAP_ALIGNMENT = WB.getHeapAlignment();
|
||||||
private static final long PS_VIRTUAL_SPACE_ALIGNMENT =
|
|
||||||
(YOUNG_GC_TYPE == GCTypes.YoungGCType.PSNew) ? WB.psVirtualSpaceAlignment() : 0;
|
|
||||||
|
|
||||||
public static final int ARRAY_LENGTH = 100;
|
public static final int ARRAY_LENGTH = 100;
|
||||||
public static final int CHUNK_SIZE = 1024;
|
public static final int CHUNK_SIZE = 1024;
|
||||||
@ -303,9 +301,7 @@ public class TestNewSizeFlags {
|
|||||||
case DefNew:
|
case DefNew:
|
||||||
return HeapRegionUsageTool.alignDown(value, HEAP_SPACE_ALIGNMENT);
|
return HeapRegionUsageTool.alignDown(value, HEAP_SPACE_ALIGNMENT);
|
||||||
case PSNew:
|
case PSNew:
|
||||||
return HeapRegionUsageTool.alignUp(HeapRegionUsageTool.alignDown(value,
|
return HeapRegionUsageTool.alignDown(value, HEAP_SPACE_ALIGNMENT);
|
||||||
HEAP_SPACE_ALIGNMENT),
|
|
||||||
PS_VIRTUAL_SPACE_ALIGNMENT);
|
|
||||||
case G1:
|
case G1:
|
||||||
return HeapRegionUsageTool.alignUp(value, WB.g1RegionSize());
|
return HeapRegionUsageTool.alignUp(value, WB.g1RegionSize());
|
||||||
default:
|
default:
|
||||||
|
@ -154,7 +154,7 @@ public class TestSurvivorRatioFlag {
|
|||||||
long youngGenSize = edenUsage.getMax() + 2 * survivorUsage.getMax();
|
long youngGenSize = edenUsage.getMax() + 2 * survivorUsage.getMax();
|
||||||
// for Paralle GC Min/InitialSurvivorRatio = SurvivorRatio + 2
|
// for Paralle GC Min/InitialSurvivorRatio = SurvivorRatio + 2
|
||||||
long expectedSize = HeapRegionUsageTool.alignDown(youngGenSize / (expectedRatio + 2),
|
long expectedSize = HeapRegionUsageTool.alignDown(youngGenSize / (expectedRatio + 2),
|
||||||
wb.psHeapGenerationAlignment());
|
wb.getHeapSpaceAlignment());
|
||||||
|
|
||||||
if (expectedSize != survivorUsage.getCommitted()) {
|
if (expectedSize != survivorUsage.getCommitted()) {
|
||||||
throw new RuntimeException("Expected survivor size is: " + expectedSize
|
throw new RuntimeException("Expected survivor size is: " + expectedSize
|
||||||
|
@ -297,10 +297,6 @@ public class WhiteBox {
|
|||||||
public native int g1ActiveMemoryNodeCount();
|
public native int g1ActiveMemoryNodeCount();
|
||||||
public native int[] g1MemoryNodeIds();
|
public native int[] g1MemoryNodeIds();
|
||||||
|
|
||||||
// Parallel GC
|
|
||||||
public native long psVirtualSpaceAlignment();
|
|
||||||
public native long psHeapGenerationAlignment();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enumerates old regions with liveness less than specified and produces some statistics
|
* Enumerates old regions with liveness less than specified and produces some statistics
|
||||||
* @param liveness percent of region's liveness (live_objects / total_region_size * 100).
|
* @param liveness percent of region's liveness (live_objects / total_region_size * 100).
|
||||||
|
Loading…
x
Reference in New Issue
Block a user