RFR: 8331609: GenShen: Refactor generational mode allocations [v4]

Y. Srinivas Ramakrishna ysr at openjdk.org
Fri May 10 00:31:17 UTC 2024


On Tue, 7 May 2024 21:11:03 GMT, William Kemper <wkemper at openjdk.org> wrote:

>> src/hotspot/share/gc/shenandoah/shenandoahOldGeneration.cpp line 229:
>> 
>>> 227: 
>>> 228:   const size_t requested_bytes = req.size() * HeapWordSize;
>>> 229:   if (can_promote(requested_bytes)) {
>> 
>> Even though we don't check whether this req.is_promotion(), we know:
>>   if there's room to promote requested_bytes, there is also room to evacuate requested_bytes
>> 
>> A comment could be helpful here.
>
> Done

Why not call it `bool can_allocate(size_t bytes)` and expend with the need for the comment to resolve the reader's confusion from the naming?


  // Check if there is space available to accommodate the allocation.
  if (can_allocate(requested_bytes)) {
    // the allocation might still fail because of alignment constraints
    // or because of fragmentation of available space.
    return true;
  }

-------------

PR Review Comment: https://git.openjdk.org/shenandoah/pull/427#discussion_r1596060717


More information about the shenandoah-dev mailing list