mirror of
https://github.com/openjdk/jdk.git
synced 2026-07-28 03:43:21 +00:00
8357188: Remove the field MemAllocator::Allocation::_overhead_limit_exceeded and the related code
Reviewed-by: ayang, shade
This commit is contained in:
parent
124fcf1d9a
commit
33794d1614
@ -260,8 +260,7 @@ HeapWord* EpsilonHeap::allocate_new_tlab(size_t min_size,
|
||||
return res;
|
||||
}
|
||||
|
||||
HeapWord* EpsilonHeap::mem_allocate(size_t size, bool *gc_overhead_limit_was_exceeded) {
|
||||
*gc_overhead_limit_was_exceeded = false;
|
||||
HeapWord* EpsilonHeap::mem_allocate(size_t size) {
|
||||
return allocate_work(size);
|
||||
}
|
||||
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
|
||||
// Allocation
|
||||
HeapWord* allocate_work(size_t size, bool verbose = true);
|
||||
HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) override;
|
||||
HeapWord* mem_allocate(size_t size) override;
|
||||
HeapWord* allocate_new_tlab(size_t min_size,
|
||||
size_t requested_size,
|
||||
size_t* actual_size) override;
|
||||
|
||||
@ -396,8 +396,7 @@ HeapWord* G1CollectedHeap::allocate_new_tlab(size_t min_size,
|
||||
}
|
||||
|
||||
HeapWord*
|
||||
G1CollectedHeap::mem_allocate(size_t word_size,
|
||||
bool* gc_overhead_limit_was_exceeded) {
|
||||
G1CollectedHeap::mem_allocate(size_t word_size) {
|
||||
assert_heap_not_locked_and_not_at_safepoint();
|
||||
|
||||
if (is_humongous(word_size)) {
|
||||
|
||||
@ -442,8 +442,7 @@ private:
|
||||
size_t requested_size,
|
||||
size_t* actual_size) override;
|
||||
|
||||
HeapWord* mem_allocate(size_t word_size,
|
||||
bool* gc_overhead_limit_was_exceeded) override;
|
||||
HeapWord* mem_allocate(size_t word_size) override;
|
||||
|
||||
// First-level mutator allocation attempt: try to allocate out of
|
||||
// the mutator alloc region without taking the Heap_lock. This
|
||||
|
||||
@ -266,19 +266,16 @@ bool ParallelScavengeHeap::requires_barriers(stackChunkOop p) const {
|
||||
// and the rest will not be executed. For that reason, this method loops
|
||||
// during failed allocation attempts. If the java heap becomes exhausted,
|
||||
// we rely on the size_policy object to force a bail out.
|
||||
HeapWord* ParallelScavengeHeap::mem_allocate(size_t size,
|
||||
bool* gc_overhead_limit_was_exceeded) {
|
||||
HeapWord* ParallelScavengeHeap::mem_allocate(size_t size) {
|
||||
assert(!SafepointSynchronize::is_at_safepoint(), "should not be at safepoint");
|
||||
assert(Thread::current() != (Thread*)VMThread::vm_thread(), "should not be in vm thread");
|
||||
assert(!Heap_lock->owned_by_self(), "this thread should not own the Heap_lock");
|
||||
|
||||
bool is_tlab = false;
|
||||
return mem_allocate_work(size, is_tlab, gc_overhead_limit_was_exceeded);
|
||||
return mem_allocate_work(size, is_tlab);
|
||||
}
|
||||
|
||||
HeapWord* ParallelScavengeHeap::mem_allocate_work(size_t size,
|
||||
bool is_tlab,
|
||||
bool* gc_overhead_limit_was_exceeded) {
|
||||
HeapWord* ParallelScavengeHeap::mem_allocate_work(size_t size, bool is_tlab) {
|
||||
for (uint loop_count = 0; /* empty */; ++loop_count) {
|
||||
// Try young-gen first.
|
||||
HeapWord* result = young_gen()->allocate(size);
|
||||
@ -442,10 +439,8 @@ size_t ParallelScavengeHeap::unsafe_max_tlab_alloc(Thread* thr) const {
|
||||
}
|
||||
|
||||
HeapWord* ParallelScavengeHeap::allocate_new_tlab(size_t min_size, size_t requested_size, size_t* actual_size) {
|
||||
bool dummy;
|
||||
HeapWord* result = mem_allocate_work(requested_size /* size */,
|
||||
true /* is_tlab */,
|
||||
&dummy);
|
||||
true /* is_tlab */);
|
||||
if (result != nullptr) {
|
||||
*actual_size = requested_size;
|
||||
}
|
||||
|
||||
@ -102,9 +102,7 @@ class ParallelScavengeHeap : public CollectedHeap {
|
||||
|
||||
inline bool should_alloc_in_eden(size_t size) const;
|
||||
|
||||
HeapWord* mem_allocate_work(size_t size,
|
||||
bool is_tlab,
|
||||
bool* gc_overhead_limit_was_exceeded);
|
||||
HeapWord* mem_allocate_work(size_t size, bool is_tlab);
|
||||
|
||||
HeapWord* expand_heap_and_allocate(size_t size, bool is_tlab);
|
||||
|
||||
@ -192,12 +190,8 @@ public:
|
||||
MemRegion reserved_region() const { return _reserved; }
|
||||
HeapWord* base() const { return _reserved.start(); }
|
||||
|
||||
// Memory allocation. "gc_time_limit_was_exceeded" will
|
||||
// be set to true if the adaptive size policy determine that
|
||||
// an excessive amount of time is being spent doing collections
|
||||
// and caused a null to be returned. If a null is not returned,
|
||||
// "gc_time_limit_was_exceeded" has an undefined meaning.
|
||||
HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) override;
|
||||
// Memory allocation.
|
||||
HeapWord* mem_allocate(size_t size) override;
|
||||
|
||||
HeapWord* satisfy_failed_allocation(size_t size, bool is_tlab);
|
||||
|
||||
|
||||
@ -335,8 +335,7 @@ HeapWord* SerialHeap::mem_allocate_work(size_t size, bool is_tlab) {
|
||||
return result;
|
||||
}
|
||||
|
||||
HeapWord* SerialHeap::mem_allocate(size_t size,
|
||||
bool* gc_overhead_limit_was_exceeded) {
|
||||
HeapWord* SerialHeap::mem_allocate(size_t size) {
|
||||
return mem_allocate_work(size,
|
||||
false /* is_tlab */);
|
||||
}
|
||||
|
||||
@ -133,7 +133,7 @@ public:
|
||||
|
||||
size_t max_capacity() const override;
|
||||
|
||||
HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) override;
|
||||
HeapWord* mem_allocate(size_t size) override;
|
||||
|
||||
// Callback from VM_SerialCollectForAllocation operation.
|
||||
// This function does everything necessary/possible to satisfy an
|
||||
|
||||
@ -162,8 +162,7 @@ class CollectedHeap : public CHeapObj<mtGC> {
|
||||
// The obj and array allocate methods are covers for these methods.
|
||||
// mem_allocate() should never be
|
||||
// called to allocate TLABs, only individual objects.
|
||||
virtual HeapWord* mem_allocate(size_t size,
|
||||
bool* gc_overhead_limit_was_exceeded) = 0;
|
||||
virtual HeapWord* mem_allocate(size_t size) = 0;
|
||||
|
||||
// Filler object utilities.
|
||||
static inline size_t filler_array_hdr_size();
|
||||
|
||||
@ -48,7 +48,6 @@ class MemAllocator::Allocation: StackObj {
|
||||
const MemAllocator& _allocator;
|
||||
JavaThread* _thread;
|
||||
oop* _obj_ptr;
|
||||
bool _overhead_limit_exceeded;
|
||||
bool _allocated_outside_tlab;
|
||||
size_t _allocated_tlab_size;
|
||||
|
||||
@ -71,7 +70,6 @@ public:
|
||||
: _allocator(allocator),
|
||||
_thread(JavaThread::cast(allocator._thread)), // Do not use Allocation in non-JavaThreads.
|
||||
_obj_ptr(obj_ptr),
|
||||
_overhead_limit_exceeded(false),
|
||||
_allocated_outside_tlab(false),
|
||||
_allocated_tlab_size(0)
|
||||
{
|
||||
@ -119,7 +117,7 @@ bool MemAllocator::Allocation::check_out_of_memory() {
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* message = _overhead_limit_exceeded ? "GC overhead limit exceeded" : "Java heap space";
|
||||
const char* message = "Java heap space";
|
||||
if (!_thread->is_in_internal_oome_mark()) {
|
||||
// -XX:+HeapDumpOnOutOfMemoryError and -XX:OnOutOfMemoryError support
|
||||
report_java_out_of_memory(message);
|
||||
@ -133,10 +131,7 @@ bool MemAllocator::Allocation::check_out_of_memory() {
|
||||
message);
|
||||
}
|
||||
|
||||
oop exception = _overhead_limit_exceeded ?
|
||||
Universe::out_of_memory_error_gc_overhead_limit() :
|
||||
Universe::out_of_memory_error_java_heap();
|
||||
THROW_OOP_(exception, true);
|
||||
THROW_OOP_(Universe::out_of_memory_error_java_heap(), true);
|
||||
} else {
|
||||
THROW_OOP_(Universe::out_of_memory_error_java_heap_without_backtrace(), true);
|
||||
}
|
||||
@ -238,7 +233,7 @@ void MemAllocator::Allocation::notify_allocation() {
|
||||
|
||||
HeapWord* MemAllocator::mem_allocate_outside_tlab(Allocation& allocation) const {
|
||||
allocation._allocated_outside_tlab = true;
|
||||
HeapWord* mem = Universe::heap()->mem_allocate(_word_size, &allocation._overhead_limit_exceeded);
|
||||
HeapWord* mem = Universe::heap()->mem_allocate(_word_size);
|
||||
if (mem == nullptr) {
|
||||
return mem;
|
||||
}
|
||||
|
||||
@ -1094,8 +1094,7 @@ HeapWord* ShenandoahHeap::allocate_memory_under_lock(ShenandoahAllocRequest& req
|
||||
return result;
|
||||
}
|
||||
|
||||
HeapWord* ShenandoahHeap::mem_allocate(size_t size,
|
||||
bool* gc_overhead_limit_was_exceeded) {
|
||||
HeapWord* ShenandoahHeap::mem_allocate(size_t size) {
|
||||
ShenandoahAllocRequest req = ShenandoahAllocRequest::for_shared(size);
|
||||
return allocate_memory(req);
|
||||
}
|
||||
|
||||
@ -704,7 +704,7 @@ private:
|
||||
|
||||
public:
|
||||
HeapWord* allocate_memory(ShenandoahAllocRequest& request);
|
||||
HeapWord* mem_allocate(size_t size, bool* what) override;
|
||||
HeapWord* mem_allocate(size_t size) override;
|
||||
MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
|
||||
size_t size,
|
||||
Metaspace::MetadataType mdtype) override;
|
||||
|
||||
@ -149,7 +149,7 @@ oop ZCollectedHeap::array_allocate(Klass* klass, size_t size, int length, bool d
|
||||
return allocator.allocate();
|
||||
}
|
||||
|
||||
HeapWord* ZCollectedHeap::mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) {
|
||||
HeapWord* ZCollectedHeap::mem_allocate(size_t size) {
|
||||
const size_t size_in_bytes = ZUtils::words_to_bytes(align_object_size(size));
|
||||
return (HeapWord*)ZHeap::heap()->alloc_object(size_in_bytes);
|
||||
}
|
||||
|
||||
@ -76,7 +76,7 @@ public:
|
||||
bool requires_barriers(stackChunkOop obj) const override;
|
||||
|
||||
oop array_allocate(Klass* klass, size_t size, int length, bool do_zero, TRAPS) override;
|
||||
HeapWord* mem_allocate(size_t size, bool* gc_overhead_limit_was_exceeded) override;
|
||||
HeapWord* mem_allocate(size_t size) override;
|
||||
MetaWord* satisfy_failed_metadata_allocation(ClassLoaderData* loader_data,
|
||||
size_t size,
|
||||
Metaspace::MetadataType mdtype) override;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user