src/share/vm/memory/collectorPolicy.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/memory/collectorPolicy.cpp Thu Sep 19 22:40:50 2013
--- new/src/share/vm/memory/collectorPolicy.cpp Thu Sep 19 22:40:50 2013
*** 58,70 ****
--- 58,106 ----
_max_alignment, _min_alignment));
assert(_max_alignment % _min_alignment == 0,
err_msg("max_alignment: " SIZE_FORMAT " not aligned by min_alignment: " SIZE_FORMAT,
_max_alignment, _min_alignment));
! if (MaxHeapSize < InitialHeapSize) {
! if (FLAG_IS_CMDLINE(MaxHeapSize)) {
+ if (FLAG_IS_CMDLINE(InitialHeapSize) && InitialHeapSize > MaxHeapSize) {
vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified");
}
+ if (Arguments::min_heap_size() != 0 && MaxHeapSize < Arguments::min_heap_size()) {
+ vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified");
+ }
+ _max_heap_size_cmdline = true;
+ }
+
+ if (FLAG_IS_CMDLINE(InitialHeapSize) && Arguments::min_heap_size() != 0 &&
+ InitialHeapSize < Arguments::min_heap_size()) {
+ vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified");
+ }
+ if (!FLAG_IS_DEFAULT(InitialHeapSize) && InitialHeapSize > MaxHeapSize) {
+ FLAG_SET_ERGO(uintx, MaxHeapSize, InitialHeapSize);
+ } else if (!FLAG_IS_DEFAULT(MaxHeapSize) && InitialHeapSize > MaxHeapSize) {
+ FLAG_SET_ERGO(uintx, InitialHeapSize, MaxHeapSize);
+ if (InitialHeapSize < Arguments::min_heap_size()) {
+ Arguments::set_min_heap_size(InitialHeapSize);
+ }
+ }
+
+ // User inputs from -Xmx and -Xms must be aligned
+ Arguments::set_min_heap_size(align_size_up(Arguments::min_heap_size(), _min_alignment));
+ uintx alignedInitialHeapSize = align_size_up(InitialHeapSize, _min_alignment);
+ uintx alignedMaxHeapSize = align_size_up(MaxHeapSize, _max_alignment);
+
+ // Write back to flags if the values was changed
+ if (alignedInitialHeapSize != InitialHeapSize) {
+ FLAG_SET_ERGO(uintx, InitialHeapSize, alignedInitialHeapSize);
+ }
+ if (alignedMaxHeapSize != MaxHeapSize) {
+ FLAG_SET_ERGO(uintx, MaxHeapSize, alignedMaxHeapSize);
+ }
+
+ assert(InitialHeapSize <= MaxHeapSize, "Ergonomics decided on incompatible initial and maximum heap sizes");
+ assert(InitialHeapSize % _min_alignment == 0, "InitialHeapSize alignment");
+ assert(MaxHeapSize % _max_alignment == 0, "MaxHeapSize alignment");
if (!is_size_aligned(MaxMetaspaceSize, _max_alignment)) {
FLAG_SET_ERGO(uintx, MaxMetaspaceSize,
restricted_align_down(MaxMetaspaceSize, _max_alignment));
}
*** 91,126 ****
--- 127,155 ----
vm_exit_during_initialization("Too small initial Metaspace size");
}
}
void CollectorPolicy::initialize_size_info() {
// User inputs from -mx and ms must be aligned
! _min_heap_byte_size = align_size_up(Arguments::min_heap_size(), _min_alignment);
! _initial_heap_byte_size = align_size_up(InitialHeapSize, _min_alignment);
_max_heap_byte_size = align_size_up(MaxHeapSize, _max_alignment);
+ _min_heap_byte_size = Arguments::min_heap_size();
! _initial_heap_byte_size = InitialHeapSize;
! _max_heap_byte_size = MaxHeapSize;
// Check heap parameter properties
if (_initial_heap_byte_size < M) {
vm_exit_during_initialization("Too small initial heap");
}
// Check heap parameter properties
if (_min_heap_byte_size < M) {
vm_exit_during_initialization("Too small minimum heap");
}
if (_initial_heap_byte_size <= NewSize) {
// make sure there is at least some room in old space
! vm_exit_during_initialization("Too small initial heap for new size specified");
}
if (_max_heap_byte_size < _min_heap_byte_size) {
! vm_exit_during_initialization("Incompatible minimum and maximum heap sizes specified");
}
if (_initial_heap_byte_size < _min_heap_byte_size) {
vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified");
}
if (_max_heap_byte_size < _initial_heap_byte_size) {
vm_exit_during_initialization("Incompatible initial and maximum heap sizes specified");
}
+
+ assert(_max_heap_byte_size >= _min_heap_byte_size, "Ergonomics decided on incompatible minimum and maximum heap sizes");
! assert(_initial_heap_byte_size >= _min_heap_byte_size, "Ergonomics decided on incompatible initial and minimum heap sizes");
+ assert(_max_heap_byte_size >= _initial_heap_byte_size, "Ergonomics decided on incompatible initial and maximum heap sizes");
+ assert(_min_heap_byte_size % _min_alignment == 0, "min_heap_byte_size alignment");
! assert(_initial_heap_byte_size % _min_alignment == 0, "initial_heap_byte_size alignment");
+ assert(_max_heap_byte_size % _max_alignment == 0, "max_heap_byte_size alignment");
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("Minimum heap " SIZE_FORMAT " Initial heap "
SIZE_FORMAT " Maximum heap " SIZE_FORMAT,
_min_heap_byte_size, _initial_heap_byte_size, _max_heap_byte_size);
*** 207,310 ****
--- 236,399 ----
init_survivor_size,
max_gc_pause_sec,
GCTimeRatio);
}
+ size_t GenCollectorPolicy::compute_max_alignment() {
+ // The card marking array and the offset arrays for old generations are
+ // committed in os pages as well. Make sure they are entirely full (to
+ // avoid partial page problems), e.g. if 512 bytes heap corresponds to 1
+ // byte entry and the os page size is 4096, the maximum heap size should
+ // be 512*4096 = 2MB aligned.
+ size_t alignment = GenRemSet::max_alignment_constraint(rem_set_name());
+
+ // Parallel GC does its own alignment of the generations to avoid requiring a
+ // large page (256M on some platforms) for the permanent generation. The
+ // other collectors should also be updated to do their own alignment and then
+ // this use of lcm() should be removed.
+ if (UseLargePages && !UseParallelGC) {
+ // in presence of large pages we have to make sure that our
+ // alignment is large page aware
+ alignment = lcm(os::large_page_size(), alignment);
+ }
+
+ assert(alignment >= _min_alignment, "Must be");
+
+ return alignment;
+ }
+
void GenCollectorPolicy::initialize_flags() {
// All sizes must be multiples of the generation granularity.
_min_alignment = (uintx) Generation::GenGrain;
_max_alignment = compute_max_alignment();
CollectorPolicy::initialize_flags();
+ // This is the absolute minimum for the young generation. It has to hold two
+ // survivor areas and the eden. We set it here since it is used repeatedly
+ // throughout the initialization. However this is not necessarily the final
+ // value of _min_gen0_size.
+ _min_gen0_size = 3 * intra_heap_alignment();
+
+ // Make sure the heap is large enough for two generations.
+ uintx smallestHeapSize = _min_gen0_size + intra_heap_alignment();
+ if (MaxHeapSize < smallestHeapSize) {
+ FLAG_SET_ERGO(uintx, MaxHeapSize, align_size_up(smallestHeapSize, _max_alignment));
+ }
+
// All generational heaps have a youngest gen; handle those flags here.
// Adjust max size parameters
if (NewSize > MaxNewSize) {
MaxNewSize = NewSize;
+ if (FLAG_IS_CMDLINE(NewSize) && FLAG_IS_CMDLINE(MaxNewSize) && NewSize > MaxNewSize) {
+ vm_exit_during_initialization("Incompatible initial and maximum young gen sizes specified");
}
NewSize = align_size_down(NewSize, _min_alignment);
MaxNewSize = align_size_down(MaxNewSize, _min_alignment);
// Check validity of heap flags
! assert(NewSize % _min_alignment == 0, "eden space alignment");
assert(MaxNewSize % _min_alignment == 0, "survivor space alignment");
+ if (!FLAG_IS_DEFAULT(MaxNewSize)) {
! uintx minNewSize = MAX2(_min_alignment, _min_gen0_size);
+
+ if (MaxNewSize >= MaxHeapSize) {
+ uintx smallerMaxNewSize = align_size_down(MaxHeapSize - _min_alignment, _min_alignment);
+ if (FLAG_IS_CMDLINE(MaxNewSize)) {
+ warning("MaxNewSize (" SIZE_FORMAT "k) is equal to or greater than the entire "
+ "heap (" SIZE_FORMAT "k). A new max generation size of " SIZE_FORMAT "k will be used.",
+ MaxNewSize/K, MaxHeapSize/K, smallerMaxNewSize/K);
+ }
+ FLAG_SET_ERGO(uintx, MaxNewSize, smallerMaxNewSize);
+ if (NewSize > MaxNewSize) {
+ FLAG_SET_ERGO(uintx, NewSize, MaxNewSize);
+ }
+ } else if (MaxNewSize < minNewSize) {
+ FLAG_SET_ERGO(uintx, MaxNewSize, align_size_up(minNewSize, _min_alignment));
+ } else if (!is_size_aligned(MaxNewSize, _min_alignment)) {
+ FLAG_SET_ERGO(uintx, MaxNewSize, align_size_down(MaxNewSize, _min_alignment));
+ }
+ }
if (NewSize < 3 * _min_alignment) {
// make sure there room for eden and two survivor spaces
vm_exit_during_initialization("Too small new size specified");
+ // Young space must be aligned and have room for eden + two survivors.
+ // We will silently increase the NewSize even if the user specified a smaller value.
+ uintx smallestNewSize = MAX2(align_size_up(_min_gen0_size, _min_alignment),
+ align_size_down(NewSize, _min_alignment));
+ if (smallestNewSize != NewSize) {
+ FLAG_SET_ERGO(uintx, NewSize, smallestNewSize);
}
+
+ if (NewSize > MaxNewSize) {
+ // At this point this should only happen if the user specifies a large NewSize or
+ // a small (but not too small) MaxNewSize.
+ if (FLAG_IS_CMDLINE(NewSize)) {
+ warning("NewSize (" SIZE_FORMAT "k) is greater than the MaxNewSize (" SIZE_FORMAT "k). "
+ "A new generation size of " SIZE_FORMAT "k will be used.",
+ NewSize/K, MaxNewSize/K, MaxNewSize/K);
+ }
+ FLAG_SET_ERGO(uintx, NewSize, MaxNewSize);
+ }
+
+ assert(InitialHeapSize <= MaxHeapSize, "Ergonomics decided on incompatible initial and maximum heap sizes");
+ assert(NewSize >= _min_gen0_size, "Ergonomics decided on a too small young gen size");
+ 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(InitialHeapSize % _min_alignment == 0, "InitialHeapSize alignment");
+ assert(MaxHeapSize % _max_alignment == 0, "MaxHeapSize alignment");
+ assert(NewSize % _min_alignment == 0, "NewSize alignment");
+ assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % _min_alignment == 0, "MaxNewSize alignment");
+
if (SurvivorRatio < 1 || NewRatio < 1) {
vm_exit_during_initialization("Invalid young gen ratio specified");
}
}
void TwoGenerationCollectorPolicy::initialize_flags() {
GenCollectorPolicy::initialize_flags();
OldSize = align_size_down(OldSize, _min_alignment);
+ if (!is_size_aligned(OldSize, _min_alignment)) {
+ FLAG_SET_ERGO(uintx, OldSize, align_size_down(OldSize, _min_alignment));
+ }
! if (FLAG_IS_CMDLINE(OldSize) && FLAG_IS_DEFAULT(NewSize)) {
! if (FLAG_IS_CMDLINE(OldSize) && FLAG_IS_DEFAULT(MaxHeapSize)) {
// NewRatio will be used later to set the young generation size so we use
// it to calculate how big the heap should be based on the requested OldSize
// and NewRatio.
assert(NewRatio > 0, "NewRatio should have been set up earlier");
size_t calculated_heapsize = (OldSize / NewRatio) * (NewRatio + 1);
calculated_heapsize = align_size_up(calculated_heapsize, _max_alignment);
! MaxHeapSize = calculated_heapsize;
! InitialHeapSize = calculated_heapsize;
! FLAG_SET_ERGO(uintx, MaxHeapSize, calculated_heapsize);
! FLAG_SET_ERGO(uintx, InitialHeapSize, calculated_heapsize);
}
MaxHeapSize = align_size_up(MaxHeapSize, _max_alignment);
// adjust max heap size if necessary
if (NewSize + OldSize > MaxHeapSize) {
! if (FLAG_IS_CMDLINE(MaxHeapSize)) {
! if (_max_heap_size_cmdline) {
// Somebody has set a maximum heap size with the intention that we should not
// exceed it. Adjust New/OldSize as necessary.
uintx calculated_size = NewSize + OldSize;
double shrink_factor = (double) MaxHeapSize / calculated_size;
// align
! NewSize = align_size_down((uintx) (NewSize * shrink_factor), _min_alignment);
// OldSize is already aligned because above we aligned MaxHeapSize to
// _max_alignment, and we just made sure that NewSize is aligned to
// _min_alignment. In initialize_flags() we verified that _max_alignment
// is a multiple of _min_alignment.
OldSize = MaxHeapSize - NewSize;
} else {
MaxHeapSize = NewSize + OldSize;
}
}
// need to do this again
MaxHeapSize = align_size_up(MaxHeapSize, _max_alignment);
! FLAG_SET_ERGO(uintx, NewSize, MAX2(_min_gen0_size, (uintx)align_size_down((uintx)(NewSize * shrink_factor), _min_alignment)));
// adjust max heap size if necessary
if (NewSize + OldSize > MaxHeapSize) {
if (FLAG_IS_CMDLINE(MaxHeapSize)) {
// somebody set a maximum heap size with the intention that we should not
// exceed it. Adjust New/OldSize as necessary.
uintx calculated_size = NewSize + OldSize;
double shrink_factor = (double) MaxHeapSize / calculated_size;
// align
NewSize = align_size_down((uintx) (NewSize * shrink_factor), _min_alignment);
// OldSize is already aligned because above we aligned MaxHeapSize to
// _max_alignment, and we just made sure that NewSize is aligned to
// _min_alignment. In initialize_flags() we verified that _max_alignment
// is a multiple of _min_alignment.
! OldSize = MaxHeapSize - NewSize;
! FLAG_SET_ERGO(uintx, OldSize, MaxHeapSize - NewSize);
} else {
! MaxHeapSize = NewSize + OldSize;
! FLAG_SET_ERGO(uintx, MaxHeapSize, align_size_up(NewSize + OldSize, _max_alignment));
}
}
// need to do this again
MaxHeapSize = align_size_up(MaxHeapSize, _max_alignment);
always_do_update_barrier = UseConcMarkSweepGC;
// Check validity of heap flags
! assert(OldSize % _min_alignment == 0, "old space alignment");
! assert(MaxHeapSize % _max_alignment == 0, "maximum heap alignment");
! assert(InitialHeapSize <= MaxHeapSize, "Ergonomics decided on incompatible initial and maximum heap sizes");
! assert(NewSize >= _min_gen0_size, "Ergonomics decided on a too small young gen size");
+ 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(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes");
+ assert(InitialHeapSize % _min_alignment == 0, "InitialHeapSize alignment");
+ assert(MaxHeapSize % _max_alignment == 0, "MaxHeapSize alignment");
+ assert(NewSize % _min_alignment == 0, "NewSize alignment");
+ assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % _min_alignment == 0, "MaxNewSize alignment");
+ assert(OldSize % _min_alignment == 0, "OldSize alignment");
}
// Values set on the command line win over any ergonomically
// set command line parameters.
// Ergonomic choice of parameters are done before this
*** 323,361 ****
--- 412,423 ----
// generations sizes.
// Determine maximum size of gen0
size_t max_new_size = 0;
! if (FLAG_IS_CMDLINE(MaxNewSize) || FLAG_IS_ERGO(MaxNewSize)) {
if (MaxNewSize < _min_alignment) {
max_new_size = _min_alignment;
}
if (MaxNewSize >= _max_heap_byte_size) {
max_new_size = align_size_down(_max_heap_byte_size - _min_alignment,
_min_alignment);
warning("MaxNewSize (" SIZE_FORMAT "k) is equal to or "
"greater than the entire heap (" SIZE_FORMAT "k). A "
"new generation size of " SIZE_FORMAT "k will be used.",
MaxNewSize/K, _max_heap_byte_size/K, max_new_size/K);
} else {
max_new_size = align_size_down(MaxNewSize, _min_alignment);
}
// The case for FLAG_IS_ERGO(MaxNewSize) could be treated
// specially at this point to just use an ergonomically set
// MaxNewSize to set max_new_size. For cases with small
// heaps such a policy often did not work because the MaxNewSize
// was larger than the entire heap. The interpretation given
// to ergonomically set flags is that the flags are set
// by different collectors for their own special needs but
// are not allowed to badly shape the heap. This allows the
// different collectors to decide what's best for themselves
// without having to factor in the overall heap shape. It
// can be the case in the future that the collectors would
// only make "wise" ergonomics choices and this policy could
// just accept those choices. The choices currently made are
// not always "wise".
! if (!FLAG_IS_DEFAULT(MaxNewSize)) {
+ max_new_size = MaxNewSize;
} else {
max_new_size = scale_by_NewRatio_aligned(_max_heap_byte_size);
// Bound the maximum size by NewSize below (since it historically
// would have been NewSize and because the NewRatio calculation could
// yield a size that is too small) and bound it by MaxNewSize above.
*** 420,429 ****
--- 482,508 ----
_min_gen0_size = MIN2(_min_gen0_size, _max_gen0_size);
_initial_gen0_size = MAX2(MIN2(_initial_gen0_size, _max_gen0_size), _min_gen0_size);
_min_gen0_size = MIN2(_min_gen0_size, _initial_gen0_size);
}
+ // Write back to flag if necessary
+ if (MaxNewSize != _min_gen0_size) {
+ FLAG_SET_ERGO(uintx, MaxNewSize, _max_gen0_size);
+ }
+ assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes");
+ assert(_max_heap_byte_size >= _min_heap_byte_size, "Ergonomics decided on incompatible minimum and maximum heap sizes");
+ assert(_initial_heap_byte_size >= _min_heap_byte_size, "Ergonomics decided on incompatible initial and minimum heap sizes");
+ assert(_max_heap_byte_size >= _initial_heap_byte_size, "Ergonomics decided on incompatible initial and maximum heap sizes");
+ assert(_min_gen0_size <= _initial_gen0_size, "Ergonomics decided on incompatible minimum and initial young gen sizes");
+ assert(_initial_gen0_size <= _max_gen0_size, "Ergonomics decided on incompatible initial and maximum young gen sizes");
+ assert(_min_heap_byte_size % _min_alignment == 0, "min_heap_byte_size alignment");
+ assert(_initial_heap_byte_size % _min_alignment == 0, "initial_heap_byte_size alignment");
+ assert(_max_heap_byte_size % _max_alignment == 0, "max_heap_byte_size alignment");
+ assert(_min_gen0_size % _min_alignment == 0, "_min_gen0_size alignment");
+ assert(_initial_gen0_size % _min_alignment == 0, "_initial_gen0_size alignment");
+ assert(_max_gen0_size % _min_alignment == 0, "_max_gen0_size alignment");
+
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("1: Minimum gen0 " SIZE_FORMAT " Initial gen0 "
SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT,
_min_gen0_size, _initial_gen0_size, _max_gen0_size);
}
*** 474,507 ****
--- 553,580 ----
// At this point the minimum, initial and maximum sizes
// of the overall heap and of gen0 have been determined.
// The maximum gen1 size can be determined from the maximum gen0
// and maximum heap size since no explicit flags exist
// for setting the gen1 maximum.
! _max_gen1_size = MAX2(_max_heap_byte_size - _max_gen0_size, _min_alignment);
_max_gen1_size =
MAX2((uintx)align_size_down(_max_gen1_size, _min_alignment), _min_alignment);
// If no explicit command line flag has been set for the
// gen1 size, use what is left for gen1.
! if (FLAG_IS_DEFAULT(OldSize) || FLAG_IS_ERGO(OldSize)) {
! // The user has not specified any value or ergonomics
! // has chosen a value (which may or may not be consistent
! if (!FLAG_IS_CMDLINE(OldSize)) {
! // The user has not specified any value but the ergonomics
! // may have chosen a value (which may or may not be consistent
// with the overall heap size). In either case make
// the minimum, maximum and initial sizes consistent
// with the gen0 sizes and the overall heap sizes.
assert(_min_heap_byte_size > _min_gen0_size,
! "gen0 has an unexpected minimum size");
_min_gen1_size = _min_heap_byte_size - _min_gen0_size;
_min_gen1_size = MAX2((uintx)align_size_down(_min_gen1_size, _min_alignment),
_min_alignment);
_initial_gen1_size = _initial_heap_byte_size - _initial_gen0_size;
_initial_gen1_size = MAX2((uintx)align_size_down(_initial_gen1_size, _min_alignment),
_min_alignment);
+ _min_gen1_size = MAX2(_min_heap_byte_size - _min_gen0_size, _min_alignment);
! _initial_gen1_size = MAX2(_initial_heap_byte_size - _initial_gen0_size, _min_alignment);
+ // _max_gen1_size has already been made consistent above
+ FLAG_SET_ERGO(uintx, OldSize, _initial_gen1_size);
} else {
// OldSize has been explicitly set on the command line. Use the
// OldSize and then determine the consequences.
! _min_gen1_size = MIN2(OldSize, _min_heap_byte_size - _min_gen0_size);
_initial_gen1_size = OldSize;
// If the user has explicitly set an OldSize that is inconsistent
// with other command line flags, issue a warning.
// The generation minimums and the overall heap minimum should
*** 518,551 ****
--- 591,644 ----
_max_heap_byte_size);
}
// If there is an inconsistency between the OldSize and the minimum and/or
// initial size of gen0, since OldSize was explicitly set, OldSize wins.
if (adjust_gen0_sizes(&_min_gen0_size, &_min_gen1_size,
! _min_heap_byte_size, OldSize)) {
! _min_heap_byte_size, _min_gen1_size)) {
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("2: Minimum gen0 " SIZE_FORMAT " Initial gen0 "
SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT,
_min_gen0_size, _initial_gen0_size, _max_gen0_size);
}
}
// The same as above for the old gen initial size
if (adjust_gen0_sizes(&_initial_gen0_size, &_initial_gen1_size,
! _initial_heap_byte_size, OldSize)) {
! _initial_heap_byte_size, _initial_gen1_size)) {
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("3: Minimum gen0 " SIZE_FORMAT " Initial gen0 "
SIZE_FORMAT " Maximum gen0 " SIZE_FORMAT,
_min_gen0_size, _initial_gen0_size, _max_gen0_size);
}
}
+ // update OldSize
+ FLAG_SET_ERGO(uintx, OldSize, _initial_gen1_size);
}
// Enforce the maximum gen1 size.
+
_min_gen1_size = MIN2(_min_gen1_size, _max_gen1_size);
! // Check that min gen1 <= initial gen1 <= max gen1
! // Make sure that min gen1 <= initial gen1 <= max gen1
_initial_gen1_size = MAX2(_initial_gen1_size, _min_gen1_size);
_initial_gen1_size = MIN2(_initial_gen1_size, _max_gen1_size);
+ // check
+ assert(_max_heap_byte_size >= _min_heap_byte_size, "Ergonomics decided on incompatible minimum and maximum heap sizes");
+ assert(_initial_heap_byte_size >= _min_heap_byte_size, "Ergonomics decided on incompatible initial and minimum heap sizes");
+ assert(_max_heap_byte_size >= _initial_heap_byte_size, "Ergonomics decided on incompatible initial and maximum heap sizes");
+ assert(_min_gen0_size <= _initial_gen0_size, "Ergonomics decided on incompatible minimum and initial young gen sizes");
+ assert(_initial_gen0_size <= _max_gen0_size, "Ergonomics decided on incompatible initial and maximum young gen sizes");
+ assert(_min_gen1_size <= _initial_gen1_size, "Ergonomics decided on incompatible minimum and initial old gen sizes");
+ assert(_initial_gen1_size <= _max_gen1_size, "Ergonomics decided on incompatible initial and maximum old gen sizes");
+ assert(_min_heap_byte_size % _min_alignment == 0, "min_heap_byte_size alignment");
+ assert(_initial_heap_byte_size % _min_alignment == 0, "initial_heap_byte_size alignment");
+ assert(_max_heap_byte_size % _max_alignment == 0, "max_heap_byte_size alignment");
+ assert(_min_gen0_size % _min_alignment == 0, "_min_gen0_size alignment");
+ assert(_initial_gen0_size % _min_alignment == 0, "_initial_gen0_size alignment");
+ assert(_max_gen0_size % _min_alignment == 0, "_max_gen0_size alignment");
+ assert(_max_gen1_size % _min_alignment == 0, "_max_gen1_size alignment");
+
+ assert(_max_heap_byte_size <= (_max_gen0_size + _max_gen1_size), "Total maximum heap sizes must be sum of generation maximum sizes");
+
if (PrintGCDetails && Verbose) {
gclog_or_tty->print_cr("Minimum gen1 " SIZE_FORMAT " Initial gen1 "
SIZE_FORMAT " Maximum gen1 " SIZE_FORMAT,
_min_gen1_size, _initial_gen1_size, _max_gen1_size);
}
src/share/vm/memory/collectorPolicy.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File