src/share/vm/memory/collectorPolicy.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/memory/collectorPolicy.cpp

src/share/vm/memory/collectorPolicy.cpp

Print this page
rev 6345 : 8027643: Merge GenCollectorPolicy and TwoGenerationCollectorPolicy
Summary: Merged the two calsses GenCollectorPolicy and TwoGenerationCollectorPolicy
Reviewed-by:

*** 198,207 **** --- 198,210 ---- GenCollectorPolicy::GenCollectorPolicy() : _min_gen0_size(0), _initial_gen0_size(0), _max_gen0_size(0), _gen_alignment(0), + _min_gen1_size(0), + _initial_gen1_size(0), + _max_gen1_size(0), _generations(NULL) {} size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) { return align_size_down_bounded(base_size / (NewRatio + 1), _gen_alignment);
*** 236,259 **** 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(NewSize % _gen_alignment == 0, "NewSize alignment"); assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % _gen_alignment == 0, "MaxNewSize alignment"); - } - - void TwoGenerationCollectorPolicy::assert_flags() { - GenCollectorPolicy::assert_flags(); assert(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes"); assert(OldSize % _gen_alignment == 0, "OldSize alignment"); } void GenCollectorPolicy::assert_size_info() { CollectorPolicy::assert_size_info(); // GenCollectorPolicy::initialize_size_info may update the MaxNewSize assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes"); assert(NewSize == _initial_gen0_size, "Discrepancy between NewSize flag and local storage"); assert(MaxNewSize == _max_gen0_size, "Discrepancy between MaxNewSize flag and local storage"); 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_gen0_size % _gen_alignment == 0, "_min_gen0_size alignment"); assert(_initial_gen0_size % _gen_alignment == 0, "_initial_gen0_size alignment"); assert(_max_gen0_size % _gen_alignment == 0, "_max_gen0_size alignment"); --- 239,259 ---- 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(NewSize % _gen_alignment == 0, "NewSize alignment"); assert(FLAG_IS_DEFAULT(MaxNewSize) || MaxNewSize % _gen_alignment == 0, "MaxNewSize alignment"); assert(OldSize + NewSize <= MaxHeapSize, "Ergonomics decided on incompatible generation and heap sizes"); assert(OldSize % _gen_alignment == 0, "OldSize alignment"); } void GenCollectorPolicy::assert_size_info() { CollectorPolicy::assert_size_info(); // GenCollectorPolicy::initialize_size_info may update the MaxNewSize assert(MaxNewSize < MaxHeapSize, "Ergonomics decided on incompatible maximum young and heap sizes"); assert(NewSize == _initial_gen0_size, "Discrepancy between NewSize flag and local storage"); assert(MaxNewSize == _max_gen0_size, "Discrepancy between MaxNewSize flag and local storage"); + assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage"); 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_gen0_size % _gen_alignment == 0, "_min_gen0_size alignment"); assert(_initial_gen0_size % _gen_alignment == 0, "_initial_gen0_size alignment"); assert(_max_gen0_size % _gen_alignment == 0, "_max_gen0_size alignment");
*** 261,275 **** "Ergonomics made minimum young generation larger than minimum heap"); assert(_initial_gen0_size <= bound_minus_alignment(_initial_gen0_size, _initial_heap_byte_size), "Ergonomics made initial young generation larger than initial heap"); assert(_max_gen0_size <= bound_minus_alignment(_max_gen0_size, _max_heap_byte_size), "Ergonomics made maximum young generation lager than maximum heap"); - } - - void TwoGenerationCollectorPolicy::assert_size_info() { - GenCollectorPolicy::assert_size_info(); - assert(OldSize == _initial_gen1_size, "Discrepancy between OldSize flag and local storage"); 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(_max_gen1_size % _gen_alignment == 0, "_max_gen1_size alignment"); assert(_initial_gen1_size % _gen_alignment == 0, "_initial_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"); --- 261,270 ----
*** 367,382 **** if (SurvivorRatio < 1 || NewRatio < 1) { vm_exit_during_initialization("Invalid young gen ratio specified"); } - DEBUG_ONLY(GenCollectorPolicy::assert_flags();) - } - - void TwoGenerationCollectorPolicy::initialize_flags() { - GenCollectorPolicy::initialize_flags(); - if (!is_size_aligned(OldSize, _gen_alignment)) { // Setting OldSize directly to preserve information about the possible // setting of OldSize on the command line. OldSize = align_size_down(OldSize, _gen_alignment); } --- 362,371 ----
*** 431,441 **** } } always_do_update_barrier = UseConcMarkSweepGC; ! DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_flags();) } // Values set on the command line win over any ergonomically // set command line parameters. // Ergonomic choice of parameters are done before this --- 420,430 ---- } } always_do_update_barrier = UseConcMarkSweepGC; ! DEBUG_ONLY(GenCollectorPolicy::assert_flags();) } // Values set on the command line win over any ergonomically // set command line parameters. // Ergonomic choice of parameters are done before this
*** 443,452 **** --- 432,448 ---- // and MaxNewSize feed those ergonomic choices into this method. // This method makes the final generation sizings consistent with // themselves and with overall heap sizings. // In the absence of explicitly set command line flags, policies // such as the use of NewRatio are used to size the generation. + + // Minimum sizes of the generations may be different than + // the initial sizes. An inconsistency is permitted here + // in the total size that can be specified explicitly by + // command line specification of OldSize and NewSize and + // also a command line specification of -Xms. Issue a warning + // but allow the values to pass. void GenCollectorPolicy::initialize_size_info() { CollectorPolicy::initialize_size_info(); // _space_alignment is used for alignment within a generation. // There is additional alignment done down stream for some
*** 518,540 **** 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); } - DEBUG_ONLY(GenCollectorPolicy::assert_size_info();) - } - - // Minimum sizes of the generations may be different than - // the initial sizes. An inconsistency is permitted here - // in the total size that can be specified explicitly by - // command line specification of OldSize and NewSize and - // also a command line specification of -Xms. Issue a warning - // but allow the values to pass. - - void TwoGenerationCollectorPolicy::initialize_size_info() { - GenCollectorPolicy::initialize_size_info(); - // 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. --- 514,523 ----
*** 623,633 **** 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); } ! DEBUG_ONLY(TwoGenerationCollectorPolicy::assert_size_info();) } HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, bool is_tlab, bool* gc_overhead_limit_was_exceeded) { --- 606,616 ---- 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); } ! DEBUG_ONLY(GenCollectorPolicy::assert_size_info();) } HeapWord* GenCollectorPolicy::mem_allocate_work(size_t size, bool is_tlab, bool* gc_overhead_limit_was_exceeded) {
src/share/vm/memory/collectorPolicy.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File