2334 |
2334 |
2335 g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0); |
2335 g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0); |
2336 return blk.result(); |
2336 return blk.result(); |
2337 } |
2337 } |
2338 |
2338 |
2339 size_t G1CollectedHeap::unsafe_max_alloc() { |
|
2340 if (num_free_regions() > 0) return HeapRegion::GrainBytes; |
|
2341 // otherwise, is there space in the current allocation region? |
|
2342 |
|
2343 // We need to store the current allocation region in a local variable |
|
2344 // here. The problem is that this method doesn't take any locks and |
|
2345 // there may be other threads which overwrite the current allocation |
|
2346 // region field. attempt_allocation(), for example, sets it to NULL |
|
2347 // and this can happen *after* the NULL check here but before the call |
|
2348 // to free(), resulting in a SIGSEGV. Note that this doesn't appear |
|
2349 // to be a problem in the optimized build, since the two loads of the |
|
2350 // current allocation region field are optimized away. |
|
2351 HeapRegion* hr = _mutator_alloc_region.get(); |
|
2352 if (hr == NULL) { |
|
2353 return 0; |
|
2354 } |
|
2355 return hr->free(); |
|
2356 } |
|
2357 |
|
2358 bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { |
2339 bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) { |
2359 switch (cause) { |
2340 switch (cause) { |
2360 case GCCause::_gc_locker: return GCLockerInvokesConcurrent; |
2341 case GCCause::_gc_locker: return GCLockerInvokesConcurrent; |
2361 case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent; |
2342 case GCCause::_java_lang_system_gc: return ExplicitGCInvokesConcurrent; |
2362 case GCCause::_g1_humongous_allocation: return true; |
2343 case GCCause::_g1_humongous_allocation: return true; |