Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
8242040: Shenandoah: print allocation failure type
- Loading branch information
|
@@ -95,6 +95,10 @@ class ShenandoahAllocRequest : StackObj { |
|
|
return _alloc_type; |
|
|
} |
|
|
|
|
|
inline const char* type_string() { |
|
|
return alloc_type_to_string(_alloc_type); |
|
|
} |
|
|
|
|
|
inline size_t min_size() { |
|
|
assert (is_lab_alloc(), "Only access for LAB allocs"); |
|
|
return _min_size; |
|
|
|
@@ -506,15 +506,16 @@ void ShenandoahControlThread::handle_requested_gc(GCCause::Cause cause) { |
|
|
} |
|
|
} |
|
|
|
|
|
void ShenandoahControlThread::handle_alloc_failure(size_t words) { |
|
|
void ShenandoahControlThread::handle_alloc_failure(ShenandoahAllocRequest& req) { |
|
|
ShenandoahHeap* heap = ShenandoahHeap::heap(); |
|
|
|
|
|
assert(current()->is_Java_thread(), "expect Java thread here"); |
|
|
|
|
|
if (try_set_alloc_failure_gc()) { |
|
|
// Only report the first allocation failure |
|
|
log_info(gc)("Failed to allocate " SIZE_FORMAT "%s", |
|
|
byte_size_in_proper_unit(words * HeapWordSize), proper_unit_for_byte_size(words * HeapWordSize)); |
|
|
log_info(gc)("Failed to allocate %s, " SIZE_FORMAT "%s", |
|
|
req.type_string(), |
|
|
byte_size_in_proper_unit(req.size() * HeapWordSize), proper_unit_for_byte_size(req.size() * HeapWordSize)); |
|
|
|
|
|
// Now that alloc failure GC is scheduled, we can abort everything else |
|
|
heap->cancel_gc(GCCause::_allocation_failure); |
|
|
|
@@ -115,7 +115,7 @@ class ShenandoahControlThread: public ConcurrentGCThread { |
|
|
|
|
|
// Handle allocation failure from normal allocation. |
|
|
// Blocks until memory is available. |
|
|
void handle_alloc_failure(size_t words); |
|
|
void handle_alloc_failure(ShenandoahAllocRequest& req); |
|
|
|
|
|
// Handle allocation failure from evacuation path. |
|
|
// Optionally blocks while collector is handling the failure. |
|
|
|
@@ -821,13 +821,13 @@ HeapWord* ShenandoahHeap::allocate_memory(ShenandoahAllocRequest& req) { |
|
|
|
|
|
while (result == NULL && _progress_last_gc.is_set()) { |
|
|
tries++; |
|
|
control_thread()->handle_alloc_failure(req.size()); |
|
|
control_thread()->handle_alloc_failure(req); |
|
|
result = allocate_memory_under_lock(req, in_new_region); |
|
|
} |
|
|
|
|
|
while (result == NULL && tries <= ShenandoahFullGCThreshold) { |
|
|
tries++; |
|
|
control_thread()->handle_alloc_failure(req.size()); |
|
|
control_thread()->handle_alloc_failure(req); |
|
|
result = allocate_memory_under_lock(req, in_new_region); |
|
|
} |
|
|
|
|
|