76 |
76 |
77 void CollectorPolicy::initialize_flags() { |
77 void CollectorPolicy::initialize_flags() { |
78 assert(_space_alignment != 0, "Space alignment not set up properly"); |
78 assert(_space_alignment != 0, "Space alignment not set up properly"); |
79 assert(_heap_alignment != 0, "Heap alignment not set up properly"); |
79 assert(_heap_alignment != 0, "Heap alignment not set up properly"); |
80 assert(_heap_alignment >= _space_alignment, |
80 assert(_heap_alignment >= _space_alignment, |
81 err_msg("heap_alignment: " SIZE_FORMAT " less than space_alignment: " SIZE_FORMAT, |
81 "heap_alignment: " SIZE_FORMAT " less than space_alignment: " SIZE_FORMAT, |
82 _heap_alignment, _space_alignment)); |
82 _heap_alignment, _space_alignment); |
83 assert(_heap_alignment % _space_alignment == 0, |
83 assert(_heap_alignment % _space_alignment == 0, |
84 err_msg("heap_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, |
84 "heap_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, |
85 _heap_alignment, _space_alignment)); |
85 _heap_alignment, _space_alignment); |
86 |
86 |
87 if (FLAG_IS_CMDLINE(MaxHeapSize)) { |
87 if (FLAG_IS_CMDLINE(MaxHeapSize)) { |
88 if (FLAG_IS_CMDLINE(InitialHeapSize) && InitialHeapSize > MaxHeapSize) { |
88 if (FLAG_IS_CMDLINE(InitialHeapSize) && InitialHeapSize > MaxHeapSize) { |
89 vm_exit_during_initialization("Initial heap size set to a larger value than the maximum heap size"); |
89 vm_exit_during_initialization("Initial heap size set to a larger value than the maximum heap size"); |
90 } |
90 } |
273 void GenCollectorPolicy::initialize_flags() { |
273 void GenCollectorPolicy::initialize_flags() { |
274 CollectorPolicy::initialize_flags(); |
274 CollectorPolicy::initialize_flags(); |
275 |
275 |
276 assert(_gen_alignment != 0, "Generation alignment not set up properly"); |
276 assert(_gen_alignment != 0, "Generation alignment not set up properly"); |
277 assert(_heap_alignment >= _gen_alignment, |
277 assert(_heap_alignment >= _gen_alignment, |
278 err_msg("heap_alignment: " SIZE_FORMAT " less than gen_alignment: " SIZE_FORMAT, |
278 "heap_alignment: " SIZE_FORMAT " less than gen_alignment: " SIZE_FORMAT, |
279 _heap_alignment, _gen_alignment)); |
279 _heap_alignment, _gen_alignment); |
280 assert(_gen_alignment % _space_alignment == 0, |
280 assert(_gen_alignment % _space_alignment == 0, |
281 err_msg("gen_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, |
281 "gen_alignment: " SIZE_FORMAT " not aligned by space_alignment: " SIZE_FORMAT, |
282 _gen_alignment, _space_alignment)); |
282 _gen_alignment, _space_alignment); |
283 assert(_heap_alignment % _gen_alignment == 0, |
283 assert(_heap_alignment % _gen_alignment == 0, |
284 err_msg("heap_alignment: " SIZE_FORMAT " not aligned by gen_alignment: " SIZE_FORMAT, |
284 "heap_alignment: " SIZE_FORMAT " not aligned by gen_alignment: " SIZE_FORMAT, |
285 _heap_alignment, _gen_alignment)); |
285 _heap_alignment, _gen_alignment); |
286 |
286 |
287 // All generational heaps have a youngest gen; handle those flags here |
287 // All generational heaps have a youngest gen; handle those flags here |
288 |
288 |
289 // Make sure the heap is large enough for two generations |
289 // Make sure the heap is large enough for two generations |
290 size_t smallest_new_size = young_gen_size_lower_bound(); |
290 size_t smallest_new_size = young_gen_size_lower_bound(); |
1010 |
1010 |
1011 static void verify_young_min(size_t expected) { |
1011 static void verify_young_min(size_t expected) { |
1012 MarkSweepPolicy msp; |
1012 MarkSweepPolicy msp; |
1013 msp.initialize_all(); |
1013 msp.initialize_all(); |
1014 |
1014 |
1015 assert(msp.min_young_size() <= expected, err_msg("%zu > %zu", msp.min_young_size(), expected)); |
1015 assert(msp.min_young_size() <= expected, "%zu > %zu", msp.min_young_size(), expected); |
1016 } |
1016 } |
1017 |
1017 |
1018 static void verify_young_initial(size_t expected) { |
1018 static void verify_young_initial(size_t expected) { |
1019 MarkSweepPolicy msp; |
1019 MarkSweepPolicy msp; |
1020 msp.initialize_all(); |
1020 msp.initialize_all(); |
1021 |
1021 |
1022 assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected)); |
1022 assert(msp.initial_young_size() == expected, "%zu != %zu", msp.initial_young_size(), expected); |
1023 } |
1023 } |
1024 |
1024 |
1025 static void verify_scaled_young_initial(size_t initial_heap_size) { |
1025 static void verify_scaled_young_initial(size_t initial_heap_size) { |
1026 MarkSweepPolicy msp; |
1026 MarkSweepPolicy msp; |
1027 msp.initialize_all(); |
1027 msp.initialize_all(); |
1031 // caused by 64K page size. |
1031 // caused by 64K page size. |
1032 initial_heap_size = InitialHeapSize; |
1032 initial_heap_size = InitialHeapSize; |
1033 } |
1033 } |
1034 |
1034 |
1035 size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size); |
1035 size_t expected = msp.scale_by_NewRatio_aligned(initial_heap_size); |
1036 assert(msp.initial_young_size() == expected, err_msg("%zu != %zu", msp.initial_young_size(), expected)); |
1036 assert(msp.initial_young_size() == expected, "%zu != %zu", msp.initial_young_size(), expected); |
1037 assert(FLAG_IS_ERGO(NewSize) && NewSize == expected, |
1037 assert(FLAG_IS_ERGO(NewSize) && NewSize == expected, |
1038 err_msg("NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize)); |
1038 "NewSize should have been set ergonomically to %zu, but was %zu", expected, NewSize); |
1039 } |
1039 } |
1040 |
1040 |
1041 static void verify_old_min(size_t expected) { |
1041 static void verify_old_min(size_t expected) { |
1042 MarkSweepPolicy msp; |
1042 MarkSweepPolicy msp; |
1043 msp.initialize_all(); |
1043 msp.initialize_all(); |
1044 |
1044 |
1045 assert(msp.min_old_size() <= expected, err_msg("%zu > %zu", msp.min_old_size(), expected)); |
1045 assert(msp.min_old_size() <= expected, "%zu > %zu", msp.min_old_size(), expected); |
1046 } |
1046 } |
1047 |
1047 |
1048 static void verify_old_initial(size_t expected) { |
1048 static void verify_old_initial(size_t expected) { |
1049 MarkSweepPolicy msp; |
1049 MarkSweepPolicy msp; |
1050 msp.initialize_all(); |
1050 msp.initialize_all(); |
1051 |
1051 |
1052 assert(msp.initial_old_size() == expected, err_msg("%zu != %zu", msp.initial_old_size(), expected)); |
1052 assert(msp.initial_old_size() == expected, "%zu != %zu", msp.initial_old_size(), expected); |
1053 } |
1053 } |
1054 |
1054 |
1055 |
1055 |
1056 private: |
1056 private: |
1057 static size_t original_InitialHeapSize; |
1057 static size_t original_InitialHeapSize; |