137 if (_pause_succeeded) { |
137 if (_pause_succeeded) { |
138 if (_word_size > 0) { |
138 if (_word_size > 0) { |
139 // An allocation had been requested. Do it, eventually trying a stronger |
139 // An allocation had been requested. Do it, eventually trying a stronger |
140 // kind of GC. |
140 // kind of GC. |
141 _result = g1h->satisfy_failed_allocation(_word_size, _allocation_context, &_pause_succeeded); |
141 _result = g1h->satisfy_failed_allocation(_word_size, _allocation_context, &_pause_succeeded); |
142 } else if (!g1h->has_regions_left_for_allocation()) { |
142 } else { |
143 // There has been a request to perform a GC to free some space. We have no |
143 bool should_upgrade_to_full = !g1h->should_do_concurrent_full_gc(_gc_cause) && |
144 // information on how much memory has been asked for. In case there are |
144 !g1h->has_regions_left_for_allocation(); |
145 // absolutely no regions left to allocate into, do a maximally compacting full GC. |
145 if (should_upgrade_to_full) { |
146 log_info(gc, ergo)("Attempting maximally compacting collection"); |
146 // There has been a request to perform a GC to free some space. We have no |
147 _pause_succeeded = g1h->do_full_collection(false, /* explicit gc */ |
147 // information on how much memory has been asked for. In case there are |
148 true /* clear_all_soft_refs */); |
148 // absolutely no regions left to allocate into, do a maximally compacting full GC. |
|
149 log_info(gc, ergo)("Attempting maximally compacting collection"); |
|
150 _pause_succeeded = g1h->do_full_collection(false, /* explicit gc */ |
|
151 true /* clear_all_soft_refs */); |
|
152 } |
149 } |
153 } |
150 guarantee(_pause_succeeded, "Elevated collections during the safepoint must always succeed."); |
154 guarantee(_pause_succeeded, "Elevated collections during the safepoint must always succeed."); |
151 } else { |
155 } else { |
152 assert(_result == NULL, "invariant"); |
156 assert(_result == NULL, "invariant"); |
153 // The only reason for the pause to not be successful is that, the GC locker is |
157 // The only reason for the pause to not be successful is that, the GC locker is |