RFR: 8294278: ForkJoinPool.getAndAddPoolIds should use Unsafe.staticFieldBase

Alan Bateman alanb at openjdk.org
Tue Nov 29 16:38:48 UTC 2022


On Tue, 29 Nov 2022 16:26:54 GMT, Bernhard Urban-Forster <burban at openjdk.org> wrote:

>> Two (since 19) usages of Unsafe.getAndAddInt to update a static field provide the Class object as the base instead of the base object returned by Unsafe.staticFieldBase. This doesn't change anything on the HotSpot VM.
>
> src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java line 1532:
> 
>> 1530:     private static final long THREADIDS;
>> 1531:     private static final Object POOLIDS_BASE;
>> 1532:     private static final long POOLIDS;
> 
> Minor nit: Maybe `POOLIDS` should be renamed to `POOLIDS_OFFSET`?

ForkJoinPool has several fields for field offsets so renaming one would be inconsistent and we'd end up renaming all of them. We also don't want to get too much out of sync with the "master" in Doug Lea's CVS.

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

PR: https://git.openjdk.org/jdk/pull/11369


More information about the core-libs-dev mailing list