comparison src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp @ 4834:6a78aa6ac1ff

7132311: G1: assert((s == klass->oop_size(this)) || (Universe::heap()->is_gc_active() && ((is_typeArray()... Summary: Move the check for when to call collect() to before we do a humongous object allocation Reviewed-by: stefank, tonyp
author brutisso
date Mon, 23 Jan 2012 20:36:16 +0100
parents 9509c20bba28
children eff609af17d7
comparison
equal deleted inserted replaced
4833:57025542827f 4834:6a78aa6ac1ff
1136 } 1136 }
1137 } 1137 }
1138 return ret; 1138 return ret;
1139 } 1139 }
1140 1140
1141 bool G1CollectorPolicy::need_to_start_conc_mark(const char* source) { 1141 bool G1CollectorPolicy::need_to_start_conc_mark(const char* source, size_t alloc_word_size) {
1142 if (_g1->mark_in_progress()) { 1142 if (_g1->concurrent_mark()->cmThread()->during_cycle()) {
1143 return false; 1143 return false;
1144 } 1144 }
1145 1145
1146 size_t marking_initiating_used_threshold = 1146 size_t marking_initiating_used_threshold =
1147 (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent; 1147 (_g1->capacity() / 100) * InitiatingHeapOccupancyPercent;
1148 size_t cur_used_bytes = _g1->non_young_capacity_bytes(); 1148 size_t cur_used_bytes = _g1->non_young_capacity_bytes();
1149 1149 size_t alloc_byte_size = alloc_word_size * HeapWordSize;
1150 if (cur_used_bytes > marking_initiating_used_threshold) { 1150
1151 if ((cur_used_bytes + alloc_byte_size) > marking_initiating_used_threshold) {
1151 if (gcs_are_young()) { 1152 if (gcs_are_young()) {
1152 ergo_verbose4(ErgoConcCycles, 1153 ergo_verbose5(ErgoConcCycles,
1153 "request concurrent cycle initiation", 1154 "request concurrent cycle initiation",
1154 ergo_format_reason("occupancy higher than threshold") 1155 ergo_format_reason("occupancy higher than threshold")
1155 ergo_format_byte("occupancy") 1156 ergo_format_byte("occupancy")
1157 ergo_format_byte("allocation request")
1156 ergo_format_byte_perc("threshold") 1158 ergo_format_byte_perc("threshold")
1157 ergo_format_str("source"), 1159 ergo_format_str("source"),
1158 cur_used_bytes, 1160 cur_used_bytes,
1161 alloc_byte_size,
1159 marking_initiating_used_threshold, 1162 marking_initiating_used_threshold,
1160 (double) InitiatingHeapOccupancyPercent, 1163 (double) InitiatingHeapOccupancyPercent,
1161 source); 1164 source);
1162 return true; 1165 return true;
1163 } else { 1166 } else {
1164 ergo_verbose4(ErgoConcCycles, 1167 ergo_verbose5(ErgoConcCycles,
1165 "do not request concurrent cycle initiation", 1168 "do not request concurrent cycle initiation",
1166 ergo_format_reason("still doing mixed collections") 1169 ergo_format_reason("still doing mixed collections")
1167 ergo_format_byte("occupancy") 1170 ergo_format_byte("occupancy")
1171 ergo_format_byte("allocation request")
1168 ergo_format_byte_perc("threshold") 1172 ergo_format_byte_perc("threshold")
1169 ergo_format_str("source"), 1173 ergo_format_str("source"),
1170 cur_used_bytes, 1174 cur_used_bytes,
1175 alloc_byte_size,
1171 marking_initiating_used_threshold, 1176 marking_initiating_used_threshold,
1172 (double) InitiatingHeapOccupancyPercent, 1177 (double) InitiatingHeapOccupancyPercent,
1173 source); 1178 source);
1174 } 1179 }
1175 } 1180 }