On Fri, 10 May 2024 12:09:20 GMT, Doug Lea <d...@openjdk.org> wrote:

>> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 2167:
>> 
>>> 2165:             }
>>> 2166:         }
>>> 2167:         return stat;
>> 
>> @DougLea Since `stat` is a local, and is only written to once per branch it 
>> might make sense to just return from each of the branches?
>
> A similar answer as above: using a single return avoids compiler generating 
> branches to its own synthetic single return. Worthwhile only when whole 
> method is of this form (I did check this one.)

I prefer having methods with a single return, placed on the last line of the 
method, but I wanted to make sure I wasn't missing any underlying reason. :)

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19131#discussion_r1596706172

Reply via email to