RFR: 8319447: Improve performance of delayed task handling [v8]

Doug Lea dl at openjdk.org
Tue Mar 11 20:29:20 UTC 2025


On Tue, 11 Mar 2025 13:46:52 GMT, Viktor Klang <vklang at openjdk.org> wrote:

>> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1301:
>> 
>>> 1299:                 if ((room == 0 ||        // pad if no caller-run
>>> 1300:                      a[m & (s - ((internal || task == null ||
>>> 1301:                                   task.noUserHelp() == 0) ? 1 : 2))] == null) &&
>> 
>> Not saying that we should, but it would be possible to make this branch-free.
>
> Something like `1 + (task.noUserHelp() >>> 24)`

Right; thanks. Also moving the (nonvolatile) read up seems slightly better.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/23702#discussion_r1990080545


More information about the core-libs-dev mailing list