< prev index next >

src/share/vm/gc/shared/collectorPolicy.cpp

Print this page

        

*** 103,115 **** if (_min_heap_byte_size < M) { vm_exit_during_initialization("Too small minimum heap"); } // User inputs from -Xmx and -Xms must be aligned ! _min_heap_byte_size = align_size_up(_min_heap_byte_size, _heap_alignment); ! size_t aligned_initial_heap_size = align_size_up(InitialHeapSize, _heap_alignment); ! size_t aligned_max_heap_size = align_size_up(MaxHeapSize, _heap_alignment); // Write back to flags if the values changed if (aligned_initial_heap_size != InitialHeapSize) { FLAG_SET_ERGO(size_t, InitialHeapSize, aligned_initial_heap_size); } --- 103,115 ---- if (_min_heap_byte_size < M) { vm_exit_during_initialization("Too small minimum heap"); } // User inputs from -Xmx and -Xms must be aligned ! _min_heap_byte_size = align_up(_min_heap_byte_size, _heap_alignment); ! size_t aligned_initial_heap_size = align_up(InitialHeapSize, _heap_alignment); ! size_t aligned_max_heap_size = align_up(MaxHeapSize, _heap_alignment); // Write back to flags if the values changed if (aligned_initial_heap_size != InitialHeapSize) { FLAG_SET_ERGO(size_t, InitialHeapSize, aligned_initial_heap_size); }
*** 131,141 **** } _initial_heap_byte_size = InitialHeapSize; _max_heap_byte_size = MaxHeapSize; ! FLAG_SET_ERGO(size_t, MinHeapDeltaBytes, align_size_up(MinHeapDeltaBytes, _space_alignment)); DEBUG_ONLY(CollectorPolicy::assert_flags();) } void CollectorPolicy::initialize_size_info() { --- 131,141 ---- } _initial_heap_byte_size = InitialHeapSize; _max_heap_byte_size = MaxHeapSize; ! FLAG_SET_ERGO(size_t, MinHeapDeltaBytes, align_up(MinHeapDeltaBytes, _space_alignment)); DEBUG_ONLY(CollectorPolicy::assert_flags();) } void CollectorPolicy::initialize_size_info() {
*** 196,206 **** _young_gen_spec(NULL), _old_gen_spec(NULL) {} size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) { ! return align_size_down_bounded(base_size / (NewRatio + 1), _gen_alignment); } size_t GenCollectorPolicy::bound_minus_alignment(size_t desired_size, size_t maximum_size) { size_t max_minus = maximum_size - _gen_alignment; --- 196,206 ---- _young_gen_spec(NULL), _old_gen_spec(NULL) {} size_t GenCollectorPolicy::scale_by_NewRatio_aligned(size_t base_size) { ! return align_down_bounded(base_size / (NewRatio + 1), _gen_alignment); } size_t GenCollectorPolicy::bound_minus_alignment(size_t desired_size, size_t maximum_size) { size_t max_minus = maximum_size - _gen_alignment;
*** 219,233 **** GCTimeRatio); } size_t GenCollectorPolicy::young_gen_size_lower_bound() { // The young generation must be aligned and have room for eden + two survivors ! return align_size_up(3 * _space_alignment, _gen_alignment); } size_t GenCollectorPolicy::old_gen_size_lower_bound() { ! return align_size_up(_space_alignment, _gen_alignment); } #ifdef ASSERT void GenCollectorPolicy::assert_flags() { CollectorPolicy::assert_flags(); --- 219,233 ---- GCTimeRatio); } size_t GenCollectorPolicy::young_gen_size_lower_bound() { // The young generation must be aligned and have room for eden + two survivors ! return align_up(3 * _space_alignment, _gen_alignment); } size_t GenCollectorPolicy::old_gen_size_lower_bound() { ! return align_up(_space_alignment, _gen_alignment); } #ifdef ASSERT void GenCollectorPolicy::assert_flags() { CollectorPolicy::assert_flags();
*** 285,295 **** // All generational heaps have a young gen; handle those flags here // Make sure the heap is large enough for two generations size_t smallest_new_size = young_gen_size_lower_bound(); ! size_t smallest_heap_size = align_size_up(smallest_new_size + old_gen_size_lower_bound(), _heap_alignment); if (MaxHeapSize < smallest_heap_size) { FLAG_SET_ERGO(size_t, MaxHeapSize, smallest_heap_size); _max_heap_byte_size = MaxHeapSize; } --- 285,295 ---- // All generational heaps have a young gen; handle those flags here // Make sure the heap is large enough for two generations size_t smallest_new_size = young_gen_size_lower_bound(); ! size_t smallest_heap_size = align_up(smallest_new_size + old_gen_size_lower_bound(), _heap_alignment); if (MaxHeapSize < smallest_heap_size) { FLAG_SET_ERGO(size_t, MaxHeapSize, smallest_heap_size); _max_heap_byte_size = MaxHeapSize; }
*** 309,319 **** } // Now take the actual NewSize into account. We will silently increase NewSize // if the user specified a smaller or unaligned value. size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize); ! bounded_new_size = MAX2(smallest_new_size, align_size_down(bounded_new_size, _gen_alignment)); if (bounded_new_size != NewSize) { FLAG_SET_ERGO(size_t, NewSize, bounded_new_size); } _min_young_size = smallest_new_size; _initial_young_size = NewSize; --- 309,319 ---- } // Now take the actual NewSize into account. We will silently increase NewSize // if the user specified a smaller or unaligned value. size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize); ! bounded_new_size = MAX2(smallest_new_size, align_down(bounded_new_size, _gen_alignment)); if (bounded_new_size != NewSize) { FLAG_SET_ERGO(size_t, NewSize, bounded_new_size); } _min_young_size = smallest_new_size; _initial_young_size = NewSize;
*** 332,343 **** FLAG_SET_ERGO(size_t, NewSize, MaxNewSize); _initial_young_size = NewSize; } } else if (MaxNewSize < _initial_young_size) { FLAG_SET_ERGO(size_t, MaxNewSize, _initial_young_size); ! } else if (!is_size_aligned(MaxNewSize, _gen_alignment)) { ! FLAG_SET_ERGO(size_t, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment)); } _max_young_size = MaxNewSize; } if (NewSize > MaxNewSize) { --- 332,343 ---- FLAG_SET_ERGO(size_t, NewSize, MaxNewSize); _initial_young_size = NewSize; } } else if (MaxNewSize < _initial_young_size) { FLAG_SET_ERGO(size_t, MaxNewSize, _initial_young_size); ! } else if (!is_aligned(MaxNewSize, _gen_alignment)) { ! FLAG_SET_ERGO(size_t, MaxNewSize, align_down(MaxNewSize, _gen_alignment)); } _max_young_size = MaxNewSize; } if (NewSize > MaxNewSize) {
*** 357,378 **** } if (OldSize < old_gen_size_lower_bound()) { FLAG_SET_ERGO(size_t, OldSize, old_gen_size_lower_bound()); } ! if (!is_size_aligned(OldSize, _gen_alignment)) { ! FLAG_SET_ERGO(size_t, OldSize, align_size_down(OldSize, _gen_alignment)); } 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, _heap_alignment); FLAG_SET_ERGO(size_t, MaxHeapSize, calculated_heapsize); _max_heap_byte_size = MaxHeapSize; FLAG_SET_ERGO(size_t, InitialHeapSize, calculated_heapsize); _initial_heap_byte_size = InitialHeapSize; } --- 357,378 ---- } if (OldSize < old_gen_size_lower_bound()) { FLAG_SET_ERGO(size_t, OldSize, old_gen_size_lower_bound()); } ! if (!is_aligned(OldSize, _gen_alignment)) { ! FLAG_SET_ERGO(size_t, OldSize, align_down(OldSize, _gen_alignment)); } 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_up(calculated_heapsize, _heap_alignment); FLAG_SET_ERGO(size_t, MaxHeapSize, calculated_heapsize); _max_heap_byte_size = MaxHeapSize; FLAG_SET_ERGO(size_t, InitialHeapSize, calculated_heapsize); _initial_heap_byte_size = InitialHeapSize; }
*** 382,402 **** if (FLAG_IS_CMDLINE(MaxHeapSize)) { // Somebody has set a maximum heap size with the intention that we should not // exceed it. Adjust New/OldSize as necessary. size_t calculated_size = NewSize + OldSize; double shrink_factor = (double) MaxHeapSize / calculated_size; ! size_t smaller_new_size = align_size_down((size_t)(NewSize * shrink_factor), _gen_alignment); FLAG_SET_ERGO(size_t, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size)); _initial_young_size = NewSize; // OldSize is already aligned because above we aligned MaxHeapSize to // _heap_alignment, and we just made sure that NewSize is aligned to // _gen_alignment. In initialize_flags() we verified that _heap_alignment // is a multiple of _gen_alignment. FLAG_SET_ERGO(size_t, OldSize, MaxHeapSize - NewSize); } else { ! FLAG_SET_ERGO(size_t, MaxHeapSize, align_size_up(NewSize + OldSize, _heap_alignment)); _max_heap_byte_size = MaxHeapSize; } } // Update NewSize, if possible, to avoid sizing the young gen too small when only --- 382,402 ---- if (FLAG_IS_CMDLINE(MaxHeapSize)) { // Somebody has set a maximum heap size with the intention that we should not // exceed it. Adjust New/OldSize as necessary. size_t calculated_size = NewSize + OldSize; double shrink_factor = (double) MaxHeapSize / calculated_size; ! size_t smaller_new_size = align_down((size_t)(NewSize * shrink_factor), _gen_alignment); FLAG_SET_ERGO(size_t, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size)); _initial_young_size = NewSize; // OldSize is already aligned because above we aligned MaxHeapSize to // _heap_alignment, and we just made sure that NewSize is aligned to // _gen_alignment. In initialize_flags() we verified that _heap_alignment // is a multiple of _gen_alignment. FLAG_SET_ERGO(size_t, OldSize, MaxHeapSize - NewSize); } else { ! FLAG_SET_ERGO(size_t, MaxHeapSize, align_up(NewSize + OldSize, _heap_alignment)); _max_heap_byte_size = MaxHeapSize; } } // Update NewSize, if possible, to avoid sizing the young gen too small when only
< prev index next >