108 used_in_bytes() + (size_t) policy->avg_promoted()->padded_average(); 109 const size_t working_aligned = align_size_up(working_size, gen_alignment); 110 const size_t working_or_min = MAX2(working_aligned, min_gen_size()); 111 if (working_or_min > reserved().byte_size()) { 112 // If the used or minimum gen size (aligned up) is greater 113 // than the total reserved size, then the space available 114 // for contraction should (after proper alignment) be 0 115 return 0; 116 } 117 const size_t max_contraction = 118 reserved().byte_size() - working_or_min; 119 120 // Use the "increment" fraction instead of the "decrement" fraction 121 // to allow the other gen to expand more aggressively. The 122 // "decrement" fraction is conservative because its intent is to 123 // only reduce the footprint. 124 125 size_t result = policy->promo_increment_aligned_down(max_contraction); 126 // Also adjust for inter-generational alignment 127 size_t result_aligned = align_size_down(result, gen_alignment); 128 if (PrintAdaptiveSizePolicy && Verbose) { 129 gclog_or_tty->print_cr("\nASPSOldGen::available_for_contraction:" 130 " " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, result_aligned/K, result_aligned); 131 gclog_or_tty->print_cr(" reserved().byte_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 132 reserved().byte_size()/K, reserved().byte_size()); 133 size_t working_promoted = (size_t) policy->avg_promoted()->padded_average(); 134 gclog_or_tty->print_cr(" padded promoted " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 135 working_promoted/K, working_promoted); 136 gclog_or_tty->print_cr(" used " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 137 used_in_bytes()/K, used_in_bytes()); 138 gclog_or_tty->print_cr(" min_gen_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 139 min_gen_size()/K, min_gen_size()); 140 gclog_or_tty->print_cr(" max_contraction " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 141 max_contraction/K, max_contraction); 142 gclog_or_tty->print_cr(" without alignment " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 143 policy->promo_increment(max_contraction)/K, 144 policy->promo_increment(max_contraction)); 145 gclog_or_tty->print_cr(" alignment " SIZE_FORMAT_HEX, gen_alignment); 146 } 147 assert(result_aligned <= max_contraction, "arithmetic is wrong"); 148 return result_aligned; 149 } | 108 used_in_bytes() + (size_t) policy->avg_promoted()->padded_average(); 109 const size_t working_aligned = align_size_up(working_size, gen_alignment); 110 const size_t working_or_min = MAX2(working_aligned, min_gen_size()); 111 if (working_or_min > reserved().byte_size()) { 112 // If the used or minimum gen size (aligned up) is greater 113 // than the total reserved size, then the space available 114 // for contraction should (after proper alignment) be 0 115 return 0; 116 } 117 const size_t max_contraction = 118 reserved().byte_size() - working_or_min; 119 120 // Use the "increment" fraction instead of the "decrement" fraction 121 // to allow the other gen to expand more aggressively. The 122 // "decrement" fraction is conservative because its intent is to 123 // only reduce the footprint. 124 125 size_t result = policy->promo_increment_aligned_down(max_contraction); 126 // Also adjust for inter-generational alignment 127 size_t result_aligned = align_size_down(result, gen_alignment); 128 129 log_trace(gc, ergo)("ASPSOldGen::available_for_contraction: " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 130 result_aligned/K, result_aligned); 131 log_trace(gc, ergo)(" reserved().byte_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 132 reserved().byte_size()/K, reserved().byte_size()); 133 size_t working_promoted = (size_t) policy->avg_promoted()->padded_average(); 134 log_trace(gc, ergo)(" padded promoted " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 135 working_promoted/K, working_promoted); 136 log_trace(gc, ergo)(" used " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 137 used_in_bytes()/K, used_in_bytes()); 138 log_trace(gc, ergo)(" min_gen_size() " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 139 min_gen_size()/K, min_gen_size()); 140 log_trace(gc, ergo)(" max_contraction " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 141 max_contraction/K, max_contraction); 142 log_trace(gc, ergo)(" without alignment " SIZE_FORMAT " K / " SIZE_FORMAT_HEX, 143 policy->promo_increment(max_contraction)/K, policy->promo_increment(max_contraction)); 144 log_trace(gc, ergo)(" alignment " SIZE_FORMAT_HEX, gen_alignment); 145 146 assert(result_aligned <= max_contraction, "arithmetic is wrong"); 147 return result_aligned; 148 } |