RFR: 8366155: Serial: Obsolete PretenureSizeThreshold
Albert Mingkun Yang
ayang at openjdk.org
Tue Aug 26 13:37:34 UTC 2025
On Tue, 26 Aug 2025 12:51:21 GMT, Francesco Andreuzzi <duke at openjdk.org> wrote:
>> Remove obj-size checking before young/old-gen allocation -- an allocation succeeds iff there is enough free space.
>>
>> This simplifies the allocation logic:
>> 1. before attempting gc: `mem_allocate_work` does young-gen allocation then old-gen-no-expansion allocation
>> 2. after gc (still inside gc safepoint): `satisfy_failed_allocation` does young-gen allocation old-gen-with-expansion allocation
>>
>> Test: tier1-3
>
> src/hotspot/share/gc/serial/serialHeap.cpp line 286:
>
>> 284:
>> 285: HeapWord* SerialHeap::expand_heap_and_allocate(size_t size, bool is_tlab) {
>> 286: HeapWord* result = _young_gen->allocate(size);
>
> The order of `_young_gen->allocate` and `old_gen->expand_and_allocate` is reversed now. It used to be `_old_gen->expand_and_allocate == nullptr --> _young_gen->allocate`, now it's the other way around. Is that intended?
On master, before the method is invoked, young-gen allocation is already attempted inside `attempt_allocation(size, is_tlab, false /*first_only*/);`.
With this cleanup, it become clearer that we try young-gen first, then old-gen. So, yes, this is intended.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26941#discussion_r2301014403
More information about the hotspot-dev
mailing list