[jdk21u-dev] RFR: 8351934: Inaccurate masking of TC subfield decrement in ForkJoinPool

Dmitry Chuyko dchuyko at openjdk.org
Thu Mar 13 14:37:20 UTC 2025


This a backport of JDK-8351933 [0] (PR [1]) for 21u. At one of code paths the TC subfield of ctl field is decremented and the result is not masked correctly. The target code is also in tryTrim() but the surrounding is different from the current master, as well as the original mask name. The core change is the same, candidate for compareAndSetCtl() is constructed using '(c & RC_MASK) | ((c - TC_UNIT) & TC_MASK' instead of '(UC_MASK & (c - TC_UNIT))' to correctly preserve the RC subfield.

[0] https://bugs.openjdk.org/browse/JDK-8351933
[1] https://github.com/openjdk/jdk/pull/24034

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

Commit messages:
 - RC_MASK and TC_MASK instead of UC_MASK

Changes: https://git.openjdk.org/jdk21u-dev/pull/1485/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk21u-dev&pr=1485&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8351934
  Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
  Patch: https://git.openjdk.org/jdk21u-dev/pull/1485.diff
  Fetch: git fetch https://git.openjdk.org/jdk21u-dev.git pull/1485/head:pull/1485

PR: https://git.openjdk.org/jdk21u-dev/pull/1485


More information about the jdk-updates-dev mailing list